async def alive(event): uptime = readable_time.get_readable_time((time.time() - StartTime)) status_pn = f"**Yes, Bot is running perfectly!** \ **\nBot uptime:** {uptime} " #=====================================GET_204=====================================================# oauth = {"Authorization": "Bearer " + database.return_token()} getplay = requests.get( 'https://api.spotify.com/v1/me/player/currently-playing', headers=oauth) #=====================================GET_DEVICE_INFO==============================================# device = requests.get('https://api.spotify.com/v1/me/player/devices', headers=oauth) #=====================================GET_FIVE_RECETLY_PLAYED_SONGS=================================# oauth = {"Authorization": "Bearer " + database.return_token()} recetly_pl = requests.get( 'https://api.spotify.com/v1/me/player/recently-played?type=track&limit=5', headers=oauth) if getplay.status_code == 204: status_pn += "\n**I'm not listening anything right now :)**" else: #==========START_RECETLY_FIVE_SONGS_EXTRATIONS============================================================# recent_play = recetly_pl.json() get_rec = recent_play['items'] for for_rec in get_rec: track = for_rec['track'] get_name = track['name'] sf = open("status_recent_played_song.txt", "a") sf.write('• __' + get_name + '__' + "\n") sf.close() f = open("status_recent_played_song.txt", "r+") recent_p = f.read() f.truncate(0) device_info = device.json() g_dlist = device_info["devices"][0] device_name = g_dlist['name'] device_type = g_dlist['type'] device_vol = g_dlist['volume_percent'] #==================PLAYING_SONGS_INFO=======================================# currently_playing_song = f"{work.title} - {work.interpret}" currently_playing_song_dur = f"{work.progress}/{work.duration}" #==================ASSINGING_VAR_VLAUE=======================================# status_pn += f""" **Device name:** {device_name} ({device_type}) **Device volume:** {device_vol}% **Currently playing song:** {currently_playing_song} **Duration:** {currently_playing_song_dur} **Recently played songs:** \n{recent_p}""" await event.edit(status_pn)
async def bio_handler(event): me = await client.get_me() username = me.username full = await client(GetFullUserRequest(username)) user_bio = full.about bio_s = f"**Bio:** {user_bio}" oauth = { "Authorization": "Bearer " + database.return_token()} r = requests.get('https://api.spotify.com/v1/me/player/currently-playing', headers=oauth) if r.status_code == 204: bio_mode = "`Initial`" else: bio_mode = "`Spotify`" if work.lrt: lrt = readable_time.get_readable_time((time.time() - work.lrt)) bio_s += f"\n**Last refresh:** {lrt} ago" else: bio_s += "\n**Last refresh:** **[ERROR] failed to get last refresh rate.**" bio_s += f"\n**Currently in {bio_mode} mode.**" await event.edit(bio_s)
if result == 200: g = g + 1 os.system('cls' if os.name == 'nt' else 'clear') print("") print(" WARP-PLUS-CLOUDFLARE (script)" + " By ALIILAPRO") print("") animation = ["[■□□□□□□□□□] 10%","[■■□□□□□□□□] 20%", "[■■■□□□□□□□] 30%", "[■■■■□□□□□□] 40%", "[■■■■■□□□□□] 50%", "[■■■■■■□□□□] 60%", "[■■■■■■■□□□] 70%", "[■■■■■■■■□□] 80%", "[■■■■■■■■■□] 90%", "[■■■■■■■■■■] 100%"] for i in range(len(animation)): time.sleep(0.5) sys.stdout.write("\r[+] Preparing... " + animation[i % len(animation)]) sys.stdout.flush() print(f"\n[-] WORK ON ID: {referrer}") print(f"[:)] {g} GB has been successfully added to your account.") print(f"[#] Total: {g} Good {b} Bad") print("[*] After 18 seconds, a new request will be sent.") uptime = readable_time.get_readable_time((time.time() - StartTime)) uro = f'https://api.telegram.org/bot{token}/sendMessage' values = {'chat_id': LOG_CHAT_ID,'text': f"\n{g} GB has been successfully added to your account." + f"\nTotal: {g} Good {b} Bad" + f"\nBot uptime: {uptime}" + "\nAfter 18 seconds, a new request will be sent."} dat = urllib.parse.urlencode(values) dat = dat.encode('ascii') rek = urllib.request.Request(uro, dat) urllib.request.urlopen(rek) time.sleep(18) else: b = b + 1 os.system('cls' if os.name == 'nt' else 'clear') print("") print(" WARP-PLUS-CLOUDFLARE (script)" + " By ALIILAPRO") print("") print("[:(] Error when connecting to server.") print(f"[#] Total: {g} Good {b} Bad")