mirror of https://gitlab.com/litecord/litecord.git
gateway.websocket: merge default presence with given presence
should fix problems when presence does not have status field
This commit is contained in:
parent
5c3928069e
commit
1ba6fa5a3e
|
|
@ -398,19 +398,16 @@ class GatewayWebsocket:
|
|||
# are just silently dropped.
|
||||
return
|
||||
|
||||
if status is None:
|
||||
status = {
|
||||
'afk': False,
|
||||
default_status = {
|
||||
'afk': False,
|
||||
|
||||
# TODO: fetch status from settings
|
||||
'status': 'online',
|
||||
'game': None,
|
||||
# TODO: fetch status from settings
|
||||
'status': 'online',
|
||||
'game': None,
|
||||
|
||||
# TODO: this
|
||||
'since': 0,
|
||||
}
|
||||
|
||||
self.state.presence = status
|
||||
# TODO: this
|
||||
'since': 0,
|
||||
}
|
||||
|
||||
try:
|
||||
status = validate(status, GW_STATUS_UPDATE)
|
||||
|
|
@ -418,6 +415,8 @@ class GatewayWebsocket:
|
|||
log.warning(f'Invalid status update: {err}')
|
||||
return
|
||||
|
||||
status = {**status, **default_status}
|
||||
|
||||
# try to extract game from activities
|
||||
# when game not provided
|
||||
if not status.get('game'):
|
||||
|
|
|
|||
Loading…
Reference in New Issue