From cea3e47c27e50251d7a5b70956b750fff8eb0d17 Mon Sep 17 00:00:00 2001 From: "diamondburned (Forefront)" Date: Sat, 25 Jan 2020 00:05:14 -0800 Subject: [PATCH] discord: Fixed APIString method for emoji --- api/webhook.go | 3 ++- discord/emoji.go | 6 +++--- state/state.go | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/api/webhook.go b/api/webhook.go index 7f9dabd..2939867 100644 --- a/api/webhook.go +++ b/api/webhook.go @@ -112,7 +112,8 @@ func (c *Client) ExecuteWebhook( param.Set("wait", "true") } - var URL = EndpointWebhooks + webhookID.String() + "?" + param.Encode() + var URL = EndpointWebhooks + webhookID.String() + "/" + token + + "?" + param.Encode() var msg *discord.Message if len(data.Files) == 0 { diff --git a/discord/emoji.go b/discord/emoji.go index ef9640d..ac48cb1 100644 --- a/discord/emoji.go +++ b/discord/emoji.go @@ -22,7 +22,7 @@ func (e Emoji) APIString() string { return e.Name // is unicode } - return e.ID.String() + ":" + e.Name + return e.Name + ":" + e.ID.String() } // String formats the string like how the client does. @@ -31,7 +31,7 @@ func (e Emoji) String() string { return e.Name } - var parts = []string{ + var parts = [3]string{ "", e.Name, e.ID.String(), } @@ -39,5 +39,5 @@ func (e Emoji) String() string { parts[0] = "a" } - return "<" + strings.Join(parts, ":") + ">" + return "<" + strings.Join(parts[:], ":") + ">" } diff --git a/state/state.go b/state/state.go index 5eb64d1..b0c0bb7 100644 --- a/state/state.go +++ b/state/state.go @@ -336,6 +336,13 @@ func (s *State) Message( return nil, err } + // Fill the GuildID, because Discord doesn't do it for us. + c, err := s.Channel(channelID) + if err == nil { + // If it's 0, it's 0 anyway. We don't need a check here. + m.GuildID = c.GuildID + } + return m, s.Store.MessageSet(m) }