aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-30 04:36:32 -0500
committerRapptz <[email protected]>2016-01-30 04:36:32 -0500
commitf9a3979008537fd8fff8eb7b18323c8fd2a1d63a (patch)
tree2bd9a8ea60c101212b00a1475e9e14a9fb4d6170
parent[commands] Change signature convention to use POSIX standards. (diff)
downloaddiscord.py-f9a3979008537fd8fff8eb7b18323c8fd2a1d63a.tar.xz
discord.py-f9a3979008537fd8fff8eb7b18323c8fd2a1d63a.zip
Update member references when status changes.
-rw-r--r--discord/client.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/discord/client.py b/discord/client.py
index 40713751..4e7083f7 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -39,7 +39,7 @@ from .errors import *
from .state import ConnectionState
from .permissions import Permissions
from . import utils
-from .enums import ChannelType, ServerRegion
+from .enums import ChannelType, ServerRegion, Status
from .voice_client import VoiceClient
from .iterators import LogsFromIterator
@@ -1457,12 +1457,12 @@ class Client:
raise InvalidArgument('game must be of Game or None')
idle_since = None if idle == False else int(time.time() * 1000)
- game = game and {'name': game.name}
+ sent_game = game and {'name': game.name}
payload = {
'op': 3,
'd': {
- 'game': game,
+ 'game': sent_game,
'idle_since': idle_since
}
}
@@ -1470,6 +1470,10 @@ class Client:
sent = utils.to_json(payload)
log.debug('Sending "{}" to change status'.format(sent))
yield from self._send_ws(sent)
+ for server in self.servers:
+ server.me.game = game
+ status = Status.idle if idle_since else Status.online
+ server.me.status = status
# Channel management