Browse Source

Fix exception when handling login failure

Logging in with an invalid token would throw a TypeError due to improper
passing of arguments to HTTPClient._token.  Fix by properly passing the
keyword only bot argument.
pull/246/head
Hornwitser 9 years ago
parent
commit
e516c24746
  1. 4
      discord/http.py

4
discord/http.py

@ -189,13 +189,13 @@ class HTTPClient:
@asyncio.coroutine
def static_login(self, token, *, bot):
old_state = (self.token, self.bot_token)
old_token, old_bot = self.token, self.bot_token
self._token(token, bot=bot)
try:
data = yield from self.get(self.ME)
except HTTPException as e:
self._token(*old_state)
self._token(old_token, bot=old_bot)
if e.response.status == 401:
raise LoginFailure('Improper token has been passed.') from e
raise e

Loading…
Cancel
Save