From 24828068bc9143f631d095241678e32e68652893 Mon Sep 17 00:00:00 2001 From: Zander Date: Fri, 15 Apr 2022 13:18:47 -0500 Subject: [PATCH] Modify GuildEmojiEdit function of restapi.go (#1022) * Modify GuildEmojiEdit function of restapi.go Changes function to not omit empty role information. This allows for properly resetting the roles of an emoji, otherwise it appears to be presently impossible to reset the roles (without including a role ID in the edit request). * feat: code review changes * feat: fix typo and rephrase Co-authored-by: nitroflap --- restapi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restapi.go b/restapi.go index 2d5c914..a890631 100644 --- a/restapi.go +++ b/restapi.go @@ -1378,12 +1378,12 @@ func (s *Session) GuildEmojiCreate(guildID, name, image string, roles []string) // guildID : The ID of a Guild. // emojiID : The ID of an Emoji. // name : The Name of the Emoji. -// roles : The roles for which this emoji will be whitelisted, can be nil. +// roles : The roles for which this emoji will be whitelisted, if nil or empty the roles will be reset. func (s *Session) GuildEmojiEdit(guildID, emojiID, name string, roles []string) (emoji *Emoji, err error) { data := struct { Name string `json:"name"` - Roles []string `json:"roles,omitempty"` + Roles []string `json:"roles"` }{name, roles} body, err := s.RequestWithBucketID("PATCH", EndpointGuildEmoji(guildID, emojiID), data, EndpointGuildEmojis(guildID))