Browse Source

Fix sending arrays with nulls in them when changing presences

pull/6915/head
Rapptz 4 years ago
parent
commit
81b259ab36
  1. 6
      discord/gateway.py

6
discord/gateway.py

@ -599,7 +599,9 @@ class DiscordWebSocket:
if activity is not None: if activity is not None:
if not isinstance(activity, BaseActivity): if not isinstance(activity, BaseActivity):
raise InvalidArgument('activity must derive from BaseActivity.') raise InvalidArgument('activity must derive from BaseActivity.')
activity = activity.to_dict() activity = [activity.to_dict()]
else:
activity = []
if status == 'idle': if status == 'idle':
since = int(time.time() * 1000) since = int(time.time() * 1000)
@ -607,7 +609,7 @@ class DiscordWebSocket:
payload = { payload = {
'op': self.PRESENCE, 'op': self.PRESENCE,
'd': { 'd': {
'activities': [activity], 'activities': activity,
'afk': afk, 'afk': afk,
'since': since, 'since': since,
'status': status 'status': status

Loading…
Cancel
Save