Skip to content

Commit

Permalink
Modify GuildEmojiEdit function of restapi.go (#1022)
Browse files Browse the repository at this point in the history
* 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 <fe.lap.prog@gmail.com>
  • Loading branch information
awildboop and FedorLap2006 committed Apr 15, 2022
1 parent 8a126aa commit 2482806
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions restapi.go
Expand Up @@ -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))
Expand Down

0 comments on commit 2482806

Please sign in to comment.