diff options
| -rw-r--r-- | rubys_song_skipper/bot.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/rubys_song_skipper/bot.py b/rubys_song_skipper/bot.py index 328e66b..2b2b370 100644 --- a/rubys_song_skipper/bot.py +++ b/rubys_song_skipper/bot.py @@ -30,6 +30,16 @@ class Bot(commands.Bot): refresh = lines[1].strip() expire = lines[2].strip() + refreshed = spotify.refresh_bearer(refresh) + access = refreshed[0] + expire = refreshed[1] + + with open("code.txt", "w") as file: + file.write(f"{access}\n{refresh}\n{expire}") + file.close() + + file.close() + # if time.time() > float(expire): # file.close() @@ -44,16 +54,12 @@ class Bot(commands.Bot): if data == "": await ctx.send("i'm not authorized to do that. sign in.") else: - print( - requests.post( - "https://api.spotify.com/v1/me/player/next", - headers={ - "Authorization": "Bearer " + access, - "Content-Type": "application/json", - }, - ).text + requests.post( + "https://api.spotify.com/v1/me/player/next", + headers={ + "Authorization": "Bearer " + access, + "Content-Type": "application/json", + }, ) await ctx.send("i've skipped that song.") - - file.close() |