diff options
| author | Rapptz <[email protected]> | 2015-12-29 00:01:59 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-12-29 00:01:59 -0500 |
| commit | 43ee53fa990f63a5fcb2f291f9c10d426d3a551d (patch) | |
| tree | 29d0124a4712b84d5824b4133d7f7303cadc6d4e | |
| parent | Client.email is now set when using the cache (diff) | |
| download | discord.py-43ee53fa990f63a5fcb2f291f9c10d426d3a551d.tar.xz discord.py-43ee53fa990f63a5fcb2f291f9c10d426d3a551d.zip | |
Client.get_invite now works without a websocket connection
| -rw-r--r-- | discord/client.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py index 10d000b1..157b2986 100644 --- a/discord/client.py +++ b/discord/client.py @@ -109,6 +109,7 @@ class Client: self.gateway = None self.voice = None self.session_id = None + self.connection = None self.sequence = 0 self.loop = asyncio.get_event_loop() if loop is None else loop self._listeners = [] @@ -1827,7 +1828,9 @@ class Client: log.debug(request_logging_format.format(method='GET', response=response)) yield from utils._verify_successful_response(response) data = yield from response.json() - server = self.connection._get_server(data['guild']['id']) + server = None + if self.connection is not None: + server = self.connection._get_server(data['guild']['id']) if server is not None: ch_id = data['channel']['id'] channels = getattr(server, 'channels', []) |