1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-30 10:43:30 +00:00

discord: Add NewAPIEmoji

This commit is contained in:
diamondburned 2022-06-23 00:11:27 -07:00
parent be9de2c165
commit 384a3dd433
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -94,10 +94,20 @@ func (e Emoji) EmojiURLWithType(t ImageType) string {
// where "123123123" is the emoji ID.
type APIEmoji string
// NewAPIEmoji creates a new APIEmoji string from the given emoji ID and name.
func NewAPIEmoji(id EmojiID, name string) APIEmoji {
if !id.IsValid() {
return APIEmoji(name)
}
return APIEmoji(name + ":" + id.String())
}
// NewCustomEmoji creates a new Emoji using a custom guild emoji as base.
// Unicode emojis should be directly converted.
//
// Deprecated: Use NewAPIEmoji, it does the same exact thing.
func NewCustomEmoji(id EmojiID, name string) APIEmoji {
return APIEmoji(name + ":" + id.String())
return NewAPIEmoji(id, name)
}
// PathString returns the APIEmoji as a path-encoded string.