Raise TypeError when token is not a string

Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
This commit is contained in:
Puncher 2022-08-14 11:39:06 +02:00 committed by GitHub
parent c8db766be4
commit 584c22f642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -630,7 +630,11 @@ class Client:
if self.loop is _loop:
await self._async_setup_hook()
data = await self.http.static_login(token.strip())
if not isinstance(token, str):
raise TypeError(f'expected token to be a str, received {token.__class__!r} instead')
token = token.strip()
data = await self.http.static_login(token)
self._connection.user = ClientUser(state=self._connection, data=data)
self._application = await self.application_info()
if self._connection.application_id is None: