Skip to content

Commit

Permalink
discord: Fixed APIString method for emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Jan 25, 2020
1 parent ea9f2c2 commit cea3e47
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion api/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions discord/emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -31,13 +31,13 @@ func (e Emoji) String() string {
return e.Name
}

var parts = []string{
var parts = [3]string{
"", e.Name, e.ID.String(),
}

if e.Animated {
parts[0] = "a"
}

return "<" + strings.Join(parts, ":") + ">"
return "<" + strings.Join(parts[:], ":") + ">"
}
7 changes: 7 additions & 0 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit cea3e47

Please sign in to comment.