Skip to content

Commit

Permalink
feat(Message): support sticker items
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Sep 6, 2024
1 parent 68185dc commit 8b190f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion src/structures/message.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -316,6 +325,7 @@ export interface MessageData {
timestamp: string;
edited_timestamp: string | null;
flags: number;
sticker_items?: MessageStickerItem[];
interaction?: {
id: string;
type: InteractionType;
Expand Down

0 comments on commit 8b190f7

Please sign in to comment.