From d952c988299cca1aabcc49acb03ca0b4817b0886 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Mon, 3 Oct 2022 04:48:50 -0700 Subject: [PATCH] gateway: Fix RequestGuildMembersCommand.GuildIDs --- gateway/events.go | 4 +++- gateway/events_test.go | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gateway/events.go b/gateway/events.go index 472a4b6..2c92d1f 100644 --- a/gateway/events.go +++ b/gateway/events.go @@ -77,7 +77,9 @@ type InvalidSessionEvent bool type RequestGuildMembersCommand struct { // GuildIDs contains the IDs of the guilds to request data from. Multiple // guilds can only be requested when using user accounts. - GuildIDs []discord.GuildID `json:"guild_ids"` + // + // The guild_id JSON key is intentional, despite the type being an array. + GuildIDs []discord.GuildID `json:"guild_id"` // UserIDs contains the IDs of the users to request data for. If this is // filled, then the Query field must be empty. diff --git a/gateway/events_test.go b/gateway/events_test.go index 1217b53..82a68a7 100644 --- a/gateway/events_test.go +++ b/gateway/events_test.go @@ -36,7 +36,7 @@ func TestRequestGuildMembersCommand(t *testing.T) { } assert(&cmd, map[string]interface{}{ - "guild_ids": []interface{}{"123"}, + "guild_id": []interface{}{"123"}, "user_ids": []interface{}{"456"}, "presences": false, }) @@ -49,7 +49,7 @@ func TestRequestGuildMembersCommand(t *testing.T) { } assert(&cmd, map[string]interface{}{ - "guild_ids": []interface{}{"123"}, + "guild_id": []interface{}{"123"}, "query": "", "limit": float64(0), "presences": false, @@ -63,7 +63,7 @@ func TestRequestGuildMembersCommand(t *testing.T) { } assert(&cmd, map[string]interface{}{ - "guild_ids": []interface{}{"123"}, + "guild_id": []interface{}{"123"}, "query": "abc", "limit": float64(0), "presences": false,