From 81b259ab3668d0083e4bac4290d5ea88a7a69424 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 16 May 2021 03:51:27 -0400 Subject: [PATCH] Fix sending arrays with nulls in them when changing presences --- discord/gateway.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/discord/gateway.py b/discord/gateway.py index 735544930..afac2c031 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -599,7 +599,9 @@ class DiscordWebSocket: if activity is not None: if not isinstance(activity, BaseActivity): raise InvalidArgument('activity must derive from BaseActivity.') - activity = activity.to_dict() + activity = [activity.to_dict()] + else: + activity = [] if status == 'idle': since = int(time.time() * 1000) @@ -607,7 +609,7 @@ class DiscordWebSocket: payload = { 'op': self.PRESENCE, 'd': { - 'activities': [activity], + 'activities': activity, 'afk': afk, 'since': since, 'status': status