From dae2a0ffc13546ebba0645617d9dd88142ef6122 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Wed, 16 Dec 2020 14:30:00 -0800 Subject: [PATCH] Discord: APIEmoji shouldn't be path-encoded --- api/message_reaction.go | 8 ++++---- discord/emoji.go | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/api/message_reaction.go b/api/message_reaction.go index f902e20..4ffc234 100644 --- a/api/message_reaction.go +++ b/api/message_reaction.go @@ -21,7 +21,7 @@ func (c *Client) React( "PUT", EndpointChannels+channelID.String()+ "/messages/"+messageID.String()+ - "/reactions/"+emoji.PathString()+"/@me", + "/reactions/"+emoji.String()+"/@me", ) } @@ -176,7 +176,7 @@ func (c *Client) reactionsRange( return users, c.RequestJSON( &users, "GET", EndpointChannels+channelID.String()+ "/messages/"+messageID.String()+ - "/reactions/"+emoji.PathString(), + "/reactions/"+emoji.String(), httputil.WithSchema(c, param), ) } @@ -200,7 +200,7 @@ func (c *Client) DeleteUserReaction( "DELETE", EndpointChannels+channelID.String()+ "/messages/"+messageID.String()+ - "/reactions/"+emoji.PathString()+"/"+user, + "/reactions/"+emoji.String()+"/"+user, ) } @@ -216,7 +216,7 @@ func (c *Client) DeleteReactions( "DELETE", EndpointChannels+channelID.String()+ "/messages/"+messageID.String()+ - "/reactions/"+emoji.PathString(), + "/reactions/"+emoji.String(), ) } diff --git a/discord/emoji.go b/discord/emoji.go index 9a332ca..db18381 100644 --- a/discord/emoji.go +++ b/discord/emoji.go @@ -1,7 +1,6 @@ package discord import ( - "net/url" "strings" ) @@ -82,9 +81,9 @@ func NewCustomEmoji(id EmojiID, name string) APIEmoji { return APIEmoji(name + ":" + id.String()) } -// PathString returns the APIEmoji as a path-encoded string. -func (e APIEmoji) PathString() string { - return url.PathEscape(string(e)) +// String converts the APIEmoji to a string. +func (e APIEmoji) String() string { + return string(e) } // APIString returns a string usable for sending over to the API.