From 94f93a8b68c3b2cdfe1559d4202261f9d171c67d Mon Sep 17 00:00:00 2001 From: Puncher <65789180+Puncher1@users.noreply.github.com> Date: Sun, 14 Aug 2022 11:39:06 +0200 Subject: [PATCH] Raise TypeError when token is not a string Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com> --- discord/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/discord/client.py b/discord/client.py index 7c579b446..28375879e 100644 --- a/discord/client.py +++ b/discord/client.py @@ -737,6 +737,9 @@ class Client: if self.loop is _loop: await self._async_setup_hook() + if not isinstance(token, str): + raise TypeError(f'expected token to be a str, received {token.__class__!r} instead') + state = self._connection data = await state.http.static_login(token.strip()) state.analytics_token = data.get('analytics_token', '')