Discord: Revert "APIEmoji shouldn't be path-encoded"

This reverts commit dae2a0ffc1.
This commit is contained in:
diamondburned 2020-12-16 14:51:00 -08:00
parent dae2a0ffc1
commit 78a76ecb42
2 changed files with 8 additions and 7 deletions

View File

@ -21,7 +21,7 @@ func (c *Client) React(
"PUT",
EndpointChannels+channelID.String()+
"/messages/"+messageID.String()+
"/reactions/"+emoji.String()+"/@me",
"/reactions/"+emoji.PathString()+"/@me",
)
}
@ -176,7 +176,7 @@ func (c *Client) reactionsRange(
return users, c.RequestJSON(
&users, "GET", EndpointChannels+channelID.String()+
"/messages/"+messageID.String()+
"/reactions/"+emoji.String(),
"/reactions/"+emoji.PathString(),
httputil.WithSchema(c, param),
)
}
@ -200,7 +200,7 @@ func (c *Client) DeleteUserReaction(
"DELETE",
EndpointChannels+channelID.String()+
"/messages/"+messageID.String()+
"/reactions/"+emoji.String()+"/"+user,
"/reactions/"+emoji.PathString()+"/"+user,
)
}
@ -216,7 +216,7 @@ func (c *Client) DeleteReactions(
"DELETE",
EndpointChannels+channelID.String()+
"/messages/"+messageID.String()+
"/reactions/"+emoji.String(),
"/reactions/"+emoji.PathString(),
)
}

View File

@ -1,6 +1,7 @@
package discord
import (
"net/url"
"strings"
)
@ -81,9 +82,9 @@ func NewCustomEmoji(id EmojiID, name string) APIEmoji {
return APIEmoji(name + ":" + id.String())
}
// String converts the APIEmoji to a string.
func (e APIEmoji) String() string {
return string(e)
// PathString returns the APIEmoji as a path-encoded string.
func (e APIEmoji) PathString() string {
return url.PathEscape(string(e))
}
// APIString returns a string usable for sending over to the API.