Discord: APIEmoji shouldn't be path-encoded

This commit is contained in:
diamondburned 2020-12-16 14:30:00 -08:00
parent 808dfb28bb
commit dae2a0ffc1
2 changed files with 7 additions and 8 deletions

View File

@ -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(),
)
}

View File

@ -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.