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

View File

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