1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 17:23:00 +00:00

discord: Add StickerURLWithType

This commit adds the StickerURLWithType methods into Sticker and
StickerItem types. No Lottie support is added yet, because I'm not sure
what the filename format for that is.
This commit is contained in:
diamondburned 2022-05-08 16:03:57 -07:00
parent 4b6bc657dc
commit e09abfdbcb
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -202,6 +202,13 @@ type StickerItem struct {
FormatType StickerFormatType `json:"format_type"` FormatType StickerFormatType `json:"format_type"`
} }
// StickerURLWithType returns the URL to the emoji's image.
//
// Supported ImageTypes: PNG
func (s StickerItem) StickerURLWithType(t ImageType) string {
return "https://cdn.discordapp.com/stickers/" + t.format(s.ID.String())
}
// https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure // https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
type Sticker struct { type Sticker struct {
// ID is the ID of the sticker. // ID is the ID of the sticker.
@ -250,6 +257,13 @@ func (s Sticker) TagList() []string {
return tags return tags
} }
// StickerURLWithType returns the URL to the emoji's image.
//
// Supported ImageTypes: PNG
func (s Sticker) StickerURLWithType(t ImageType) string {
return "https://cdn.discordapp.com/stickers/" + t.format(s.ID.String())
}
type StickerType int type StickerType int
// https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types // https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types