aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-12 23:23:36 -0400
committerRapptz <[email protected]>2016-06-12 23:25:22 -0400
commit3895cf9295ff02339c809f5a07ebd35fd30e2025 (patch)
treed64d68cc3aa149933fee90cd6e7c0945262155d3
parentFix bug with logs_from URL params not being correct. (diff)
downloaddiscord.py-3895cf9295ff02339c809f5a07ebd35fd30e2025.tar.xz
discord.py-3895cf9295ff02339c809f5a07ebd35fd30e2025.zip
Fix bug with login token not being properly written in cache.
-rw-r--r--discord/client.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/discord/client.py b/discord/client.py
index a0de20f9..61a8f86a 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -125,7 +125,6 @@ class Client:
"""
def __init__(self, *, loop=None, **options):
self.ws = None
- self.token = None
self.loop = asyncio.get_event_loop() if loop is None else loop
self._listeners = []
self.cache_auth = options.get('cache_auth', True)
@@ -171,7 +170,7 @@ class Client:
os.makedirs(os.path.dirname(cache_file), exist_ok=True)
with os.fdopen(os.open(cache_file, os.O_WRONLY | os.O_CREAT, 0o0600), 'w') as f:
log.info('updating login cache')
- f.write(self.token)
+ f.write(self.http.token)
except OSError:
log.info('a problem occurred while updating the login cache')
pass
@@ -300,7 +299,7 @@ class Client:
if self.cache_auth:
token = self._get_cache_token(email, password)
try:
- self.http.static_login(token, bot=False)
+ yield from self.http.static_login(token, bot=False)
except:
log.info('cache auth token is out of date')
else:
@@ -1383,6 +1382,8 @@ class Client:
yield from self.http.edit_profile(**args)
if not_bot_account:
self.email = data['email']
+ if 'token' in data:
+ self.http._token(data['token'], bot=False)
if self.cache_auth:
self._update_cache(self.email, password)