diff options
| author | Rapptz <[email protected]> | 2017-05-20 15:19:47 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-05-20 15:19:47 -0400 |
| commit | 3436792614d6478e25e43a717c4f393a16dd43bb (patch) | |
| tree | 652c249e83be6a43ecf50d17f8ea6906c3128b65 /discord/gateway.py | |
| parent | Rewrite Client.run yet again. (diff) | |
| download | discord.py-3436792614d6478e25e43a717c4f393a16dd43bb.tar.xz discord.py-3436792614d6478e25e43a717c4f393a16dd43bb.zip | |
Allow setting a presence upon logging in.
Diffstat (limited to 'discord/gateway.py')
| -rw-r--r-- | discord/gateway.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 56d26c02..8cc13f04 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -275,6 +275,15 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): if self.shard_id is not None and self.shard_count is not None: payload['d']['shard'] = [self.shard_id, self.shard_count] + state = self._connection + if state._game is not None or state._status is not None: + payload['d']['presence'] = { + 'status': state._status, + 'game': state._game, + 'since': 0, + 'afk': False + } + yield from self.send_as_json(payload) log.info('Shard ID %s has sent the IDENTIFY payload.', self.shard_id) |