mirror of https://gitlab.com/litecord/litecord.git
schemas: add better handlers for GW_STATUS_UPDATE fields
This commit is contained in:
parent
1d7ea31a11
commit
28811da1b4
|
|
@ -415,7 +415,7 @@ class GatewayWebsocket:
|
|||
try:
|
||||
status = validate(status, GW_STATUS_UPDATE)
|
||||
except BadRequest as err:
|
||||
log.warning(f'Invalid payload: {err}')
|
||||
log.warning(f'Invalid status update: {err}')
|
||||
return
|
||||
|
||||
# try to extract game from activities
|
||||
|
|
|
|||
|
|
@ -84,10 +84,6 @@ class LitecordValidator(Validator):
|
|||
|
||||
def _validate_type_status_external(self, value: str) -> bool:
|
||||
statuses = StatusType.values()
|
||||
|
||||
# clients should send INVISIBLE instead of OFFLINE
|
||||
statuses.remove(StatusType.OFFLINE.value)
|
||||
|
||||
return value in statuses
|
||||
|
||||
def _validate_type_explicit(self, value: str) -> bool:
|
||||
|
|
@ -441,12 +437,13 @@ GW_ACTIVITY = {
|
|||
}
|
||||
|
||||
GW_STATUS_UPDATE = {
|
||||
'status': {'type': 'status_external', 'required': False},
|
||||
'status': {'type': 'status_external', 'required': False,
|
||||
'default': 'online'},
|
||||
'activities': {
|
||||
'type': 'list', 'required': False, 'schema': GW_ACTIVITY},
|
||||
'afk': {'type': 'boolean', 'required': False},
|
||||
|
||||
'since': {'type': 'number', 'required': True, 'nullable': True},
|
||||
'since': {'type': 'number', 'required': False, 'nullable': True},
|
||||
'game': {
|
||||
'type': 'dict',
|
||||
'required': False,
|
||||
|
|
|
|||
Loading…
Reference in New Issue