discord: Fixed APIString method for emoji

This commit is contained in:
diamondburned (Forefront) 2020-01-25 00:05:14 -08:00
parent ea9f2c2036
commit cea3e47c27
3 changed files with 12 additions and 4 deletions

View File

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

View File

@ -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[:], ":") + ">"
}

View File

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