From 837876646e2c3f1d17a35dd36f972f7eaa3a0962 Mon Sep 17 00:00:00 2001 From: Jordan-Cartwright <12487178+Jordan-Cartwright@users.noreply.github.com> Date: Fri, 3 Dec 2021 19:17:33 -0500 Subject: [PATCH 1/3] added in sticker endpoints --- endpoints.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/endpoints.go b/endpoints.go index e5d7d9de5..fdcbc17dd 100644 --- a/endpoints.go +++ b/endpoints.go @@ -31,6 +31,7 @@ var ( EndpointGateway = EndpointAPI + "gateway" EndpointGatewayBot = EndpointGateway + "/bot" EndpointWebhooks = EndpointAPI + "webhooks/" + EndpointStickers = EndpointAPI + "stickers/" EndpointCDN = "https://cdn.discordapp.com/" EndpointCDNAttachments = EndpointCDN + "attachments/" @@ -102,6 +103,8 @@ var ( EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" } EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID } EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" } + EndpointGuildStickers = func(gID string) string { return EndpointGuilds + gID + "/stickers" } + EndpointGuildSticker = func(gID, sID string) string { return EndpointGuilds + gID + "/stickers/" + sID } EndpointChannel = func(cID string) string { return EndpointChannels + cID } EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" } @@ -119,6 +122,9 @@ var ( EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" } + EndpointSticker = func(sID string) string { return EndpointStickers + sID } + EndpointNitroStickersPacks = EndpointAPI + "/sticker-packs" + EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" } EndpointWebhook = func(wID string) string { return EndpointWebhooks + wID } EndpointWebhookToken = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token } From 021a90bfc124fc7f32ac298e3dce9e1581283f56 Mon Sep 17 00:00:00 2001 From: Jordan-Cartwright <12487178+Jordan-Cartwright@users.noreply.github.com> Date: Fri, 3 Dec 2021 19:18:31 -0500 Subject: [PATCH 2/3] added sticker objects to messages --- message.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/message.go b/message.go index 402ab1f45..f30bd83e7 100644 --- a/message.go +++ b/message.go @@ -129,6 +129,9 @@ type Message struct { // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the flag. Flags MessageFlags `json:"flags"` + + // An array of Sticker objects, if any were sent. + StickerItems []*Sticker `json:"sticker_items"` } // UnmarshalJSON is a helper function to unmarshal the Message. @@ -188,6 +191,50 @@ type File struct { Reader io.Reader } +// StickerFormat is the file format of the Sticker. +type StickerFormat int + +// Defines all known Sticker types. +const ( + StickerFormatTypePNG StickerFormat = 1 + StickerFormatTypeAPNG StickerFormat = 2 + StickerFormatTypeLottie StickerFormat = 3 +) + +// StickerType is the type of sticker. +type StickerType int + +// Defines Sticker types. +const ( + StickerTypeStandard StickerType = 1 + StickerTypeGuild StickerType = 2 +) + +// Sticker represents a sticker object that can be sent in a Message. +type Sticker struct { + ID string `json:"id"` + PackID string `json:"pack_id"` + Name string `json:"name"` + Description string `json:"description"` + Tags string `json:"tags"` + FormatType StickerFormat `json:"format_type"` + Available bool `json:"available"` + GuildID string `json:"guild_id"` + User *User `json:"user"` + SortValue int `json:"sort_value"` +} + +// StickerPack represents a pack of standard stickers. +type StickerPack struct { + ID string `json:"id"` + Stickers []Sticker `json:"stickers"` + Name string `json:"name"` + SKUID string `json:"sku_id"` + CoverStickerID string `json:"cover_sticker_id"` + Description string `json:"description"` + BannerAssetID string `json:"banner_asset_id"` +} + // MessageSend stores all parameters you can send with ChannelMessageSendComplex. type MessageSend struct { Content string `json:"content,omitempty"` From 75b15c84728260e30d223368a5dda8d8459cdd84 Mon Sep 17 00:00:00 2001 From: Jordan-Cartwright <12487178+Jordan-Cartwright@users.noreply.github.com> Date: Tue, 18 Jan 2022 16:58:38 -0500 Subject: [PATCH 3/3] add type to Sticker struct --- message.go | 1 + 1 file changed, 1 insertion(+) diff --git a/message.go b/message.go index f30bd83e7..8cb40e29d 100644 --- a/message.go +++ b/message.go @@ -217,6 +217,7 @@ type Sticker struct { Name string `json:"name"` Description string `json:"description"` Tags string `json:"tags"` + Type StickerType `json:"type"` FormatType StickerFormat `json:"format_type"` Available bool `json:"available"` GuildID string `json:"guild_id"`