From 8b190f7bed1992e0c9d9c57adc39036f47fab7b7 Mon Sep 17 00:00:00 2001 From: Snazzah Date: Fri, 6 Sep 2024 17:27:34 -0500 Subject: [PATCH] feat(Message): support sticker items --- src/constants.ts | 8 ++++++++ src/structures/message.ts | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index 8610f681..cae6edfe 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -133,6 +133,14 @@ export enum ChannelType { GUILD_FORUM = 15 } +/** The formats that stickers can be in. */ +export enum StickerFormat { + PNG = 1, + APNG = 2, + LOTTIE = 3, + GIF = 4 +} + /** * An partial application command in Discord. * @private diff --git a/src/structures/message.ts b/src/structures/message.ts index f639fe44..cd8f0a7b 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -1,4 +1,4 @@ -import { AnyComponent, ApplicationIntegrationType, InteractionType, UserObject } from '../constants'; +import { AnyComponent, ApplicationIntegrationType, InteractionType, StickerFormat, UserObject } from '../constants'; import { EditMessageOptions } from './interfaces/messageInteraction'; import { BaseSlashCreator } from '../creator'; import { MessageInteractionContext } from './interfaces/messageInteraction'; @@ -22,6 +22,8 @@ export class Message { readonly author: User; /** The message's attachments */ readonly attachments: MessageAttachment[]; + /** The message's stickers */ + readonly stickerItems?: MessageStickerItem[]; /** The message's embeds */ readonly embeds: MessageEmbed[]; /** The message's user mentions */ @@ -77,6 +79,7 @@ export class Message { this.pinned = data.pinned; this.call = data.call; this.timestamp = Date.parse(data.timestamp); + if (data.sticker_items) this.stickerItems = data.sticker_items; if (data.edited_timestamp) this.editedTimestamp = Date.parse(data.edited_timestamp); this.flags = data.flags; if (data.message_reference) @@ -297,6 +300,12 @@ export interface EmbedVideo { width?: number; } +export interface MessageStickerItem { + format_type: StickerFormat; + id: string; + name: string; +} + /** @hidden */ export interface MessageData { id: string; @@ -316,6 +325,7 @@ export interface MessageData { timestamp: string; edited_timestamp: string | null; flags: number; + sticker_items?: MessageStickerItem[]; interaction?: { id: string; type: InteractionType;