mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-12 00:39:56 +00:00
Update member references when status changes.
This commit is contained in:
parent
7056a1f0ec
commit
f9a3979008
@ -39,7 +39,7 @@ from .errors import *
|
|||||||
from .state import ConnectionState
|
from .state import ConnectionState
|
||||||
from .permissions import Permissions
|
from .permissions import Permissions
|
||||||
from . import utils
|
from . import utils
|
||||||
from .enums import ChannelType, ServerRegion
|
from .enums import ChannelType, ServerRegion, Status
|
||||||
from .voice_client import VoiceClient
|
from .voice_client import VoiceClient
|
||||||
from .iterators import LogsFromIterator
|
from .iterators import LogsFromIterator
|
||||||
|
|
||||||
@ -1457,12 +1457,12 @@ class Client:
|
|||||||
raise InvalidArgument('game must be of Game or None')
|
raise InvalidArgument('game must be of Game or None')
|
||||||
|
|
||||||
idle_since = None if idle == False else int(time.time() * 1000)
|
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 = {
|
payload = {
|
||||||
'op': 3,
|
'op': 3,
|
||||||
'd': {
|
'd': {
|
||||||
'game': game,
|
'game': sent_game,
|
||||||
'idle_since': idle_since
|
'idle_since': idle_since
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1470,6 +1470,10 @@ class Client:
|
|||||||
sent = utils.to_json(payload)
|
sent = utils.to_json(payload)
|
||||||
log.debug('Sending "{}" to change status'.format(sent))
|
log.debug('Sending "{}" to change status'.format(sent))
|
||||||
yield from self._send_ws(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
|
# Channel management
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user