arikawa/api/emoji.go

35 lines
726 B
Go
Raw Normal View History

2020-01-02 05:39:52 +00:00
package api
import (
"git.sr.ht/~diamondburned/arikawa/discord"
)
// EmojiAPI is a special format that the API wants.
type EmojiAPI = string
func FormatEmojiAPI(id discord.Snowflake, name string) string {
if id == 0 {
return name
}
return id.String() + ":" + name
}
func (c *Client) Emojis(
guildID discord.Snowflake) ([]discord.Emoji, error) {
2020-01-02 05:39:52 +00:00
var emjs []discord.Emoji
return emjs, c.RequestJSON(&emjs, "GET",
EndpointGuilds+guildID.String()+"/emojis")
2020-01-02 05:39:52 +00:00
}
func (c *Client) Emoji(
guildID, emojiID discord.Snowflake) (*discord.Emoji, error) {
2020-01-02 05:39:52 +00:00
var emj *discord.Emoji
return emj, c.RequestJSON(&emj, "GET",
EndpointGuilds+guildID.String()+"/emojis/"+emojiID.String())
2020-01-02 05:39:52 +00:00
}
// func (c *Client) CreateEmoji()