From 6e1d0fdced77ef7e8871b6e1960698a358a90249 Mon Sep 17 00:00:00 2001 From: lts20050703 <87189679+lts20050703@users.noreply.github.com> Date: Wed, 22 Dec 2021 08:55:12 +0700 Subject: [PATCH 1/2] #1851, move to /src/types/stickers, add StickerTypes enum and stickerPack enum, rename interfaces and file names, and update jsdoc comments Moved stickers types/enums from /src/types/messages to /src/types/stickers update jsdoc comments (particularly discord docs links) for stickerItem.ts, stickerFormatTypes.ts, and sticker.ts Add StickerTypes enum and stickerPack interface Rename messageSticker*.ts to sticker*.ts --- src/types/messages/messageSticker.ts | 26 ----------------- .../messages/messageStickerFormatTypes.ts | 6 ---- src/types/messages/messageStickerItem.ts | 10 ------- src/types/stickers/sickerItem.ts | 11 +++++++ src/types/stickers/sticker.ts | 29 +++++++++++++++++++ src/types/stickers/stickerFormatTypes.ts | 6 ++++ src/types/stickers/stickerPack.ts | 19 ++++++++++++ src/types/stickers/stickerTypes.ts | 7 +++++ 8 files changed, 72 insertions(+), 42 deletions(-) delete mode 100644 src/types/messages/messageSticker.ts delete mode 100644 src/types/messages/messageStickerFormatTypes.ts delete mode 100644 src/types/messages/messageStickerItem.ts create mode 100644 src/types/stickers/sickerItem.ts create mode 100644 src/types/stickers/sticker.ts create mode 100644 src/types/stickers/stickerFormatTypes.ts create mode 100644 src/types/stickers/stickerPack.ts create mode 100644 src/types/stickers/stickerTypes.ts diff --git a/src/types/messages/messageSticker.ts b/src/types/messages/messageSticker.ts deleted file mode 100644 index aec976292..000000000 --- a/src/types/messages/messageSticker.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { MessageStickerFormatTypes } from "./messageStickerFormatTypes.ts"; -import type { User } from "../users/user.ts"; - -/** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure */ -export interface MessageSticker { - /** Id of the sticker */ - id: string; - /** Id of the pack the sticker is from */ - packId?: string; - /** Name of the sticker */ - name: string; - /** Description of the sticker */ - description: string; - /** a unicode emoji representing the sticker's expression */ - tags: string; - /** Type of sticker format */ - formatType: MessageStickerFormatTypes; - /** Whether or not the sticker is available */ - available?: boolean; - /** Id of the guild that owns this sticker */ - guildId?: string; - /** The user that uploaded the sticker */ - user?: User; - /** A sticker's sort order within a pack */ - sortValue?: number; -} diff --git a/src/types/messages/messageStickerFormatTypes.ts b/src/types/messages/messageStickerFormatTypes.ts deleted file mode 100644 index 3da89b3a9..000000000 --- a/src/types/messages/messageStickerFormatTypes.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types */ -export enum MessageStickerFormatTypes { - Png = 1, - Apng, - Lottie, -} diff --git a/src/types/messages/messageStickerItem.ts b/src/types/messages/messageStickerItem.ts deleted file mode 100644 index f61ae1b13..000000000 --- a/src/types/messages/messageStickerItem.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { MessageStickerFormatTypes } from "./messageStickerFormatTypes.ts"; - -export interface MessageStickerItem { - /** Id of the sticker */ - id: string; - /** Name of the sticker */ - name: string; - /** Type of sticker format */ - formatType: MessageStickerFormatTypes; -} diff --git a/src/types/stickers/sickerItem.ts b/src/types/stickers/sickerItem.ts new file mode 100644 index 000000000..6d5618c4d --- /dev/null +++ b/src/types/stickers/sickerItem.ts @@ -0,0 +1,11 @@ +import { StickerFormatTypes } from "./stickerFormatTypes.ts"; + +/** https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure */ +export interface StickerItem { + /** Id of the sticker */ + id: bigint; + /** Name of the sticker */ + name: string; + /** [Type of sticker format](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types) */ + formatType: StickerFormatTypes; +} diff --git a/src/types/stickers/sticker.ts b/src/types/stickers/sticker.ts new file mode 100644 index 000000000..a1a6fe21e --- /dev/null +++ b/src/types/stickers/sticker.ts @@ -0,0 +1,29 @@ +import type { StickerFormatTypes } from "./stickerFormatTypes.ts"; +import type { StickerTypes } from "./stickerTypes.ts"; +import type { User } from "../users/user.ts"; + +/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure */ +export interface Sticker { + /** [Id of the sticker](https://discord.com/developers/docs/reference#image-formatting) */ + id: bigint; + /** Id of the pack the sticker is from */ + packId?: bigint; + /** Name of the sticker */ + name: string; + /** Description of the sticker */ + description: string; + /** a unicode emoji representing the sticker's expression */ + tags: string; + /** [type of sticker](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types) */ + type: StickerTypes; + /** [Type of sticker format](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types) */ + formatType: StickerFormatTypes; + /** Whether or not the sticker is available */ + available?: boolean; + /** Id of the guild that owns this sticker */ + guildId?: bigint; + /** The user that uploaded the sticker */ + user?: User; + /** A sticker's sort order within a pack */ + sortValue?: number; +} diff --git a/src/types/stickers/stickerFormatTypes.ts b/src/types/stickers/stickerFormatTypes.ts new file mode 100644 index 000000000..791342ad9 --- /dev/null +++ b/src/types/stickers/stickerFormatTypes.ts @@ -0,0 +1,6 @@ +/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types */ +export enum StickerFormatTypes { + Png = 1, + Apng, + Lottie, +} diff --git a/src/types/stickers/stickerPack.ts b/src/types/stickers/stickerPack.ts new file mode 100644 index 000000000..2c3e268ae --- /dev/null +++ b/src/types/stickers/stickerPack.ts @@ -0,0 +1,19 @@ +import { Sticker } from "./sticker.ts"; + +/** https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure */ +export interface StickerPack { + /** id of the sticker pack */ + id: bigint; + /** the stickers in the pack */ + stickers: Sticker[]; + /** name of the sticker pack */ + name: string; + /** id of the pack's SKU */ + sku_id: bigint; + /** id of a sticker in the pack which is shown as the pack's icon */ + cover_sticker_id?: bigint; + /** description of the sticker pack */ + description: string; + /** id of the sticker pack's [banner image](https://discord.com/developers/docs/reference#image-formatting) */ + banner_asset_id?: bigint; +} diff --git a/src/types/stickers/stickerTypes.ts b/src/types/stickers/stickerTypes.ts new file mode 100644 index 000000000..ac039c274 --- /dev/null +++ b/src/types/stickers/stickerTypes.ts @@ -0,0 +1,7 @@ +/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types */ +export enum StickerTypes { + /** an official sticker in a pack, part of Nitro or in a removed purchasable pack */ + Standard = 1, + /** a sticker uploaded to a Boosted guild for the guild's members */ + Guild, +} From 131d05c0068c62f872530a55d3be10ff4fc80bab Mon Sep 17 00:00:00 2001 From: lts20050703 <87189679+lts20050703@users.noreply.github.com> Date: Wed, 22 Dec 2021 10:20:09 +0700 Subject: [PATCH 2/2] Revert string to bigint --- src/types/stickers/sticker.ts | 6 +++--- src/types/stickers/{sickerItem.ts => stickerItem.ts} | 2 +- src/types/stickers/stickerPack.ts | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/types/stickers/{sickerItem.ts => stickerItem.ts} (96%) diff --git a/src/types/stickers/sticker.ts b/src/types/stickers/sticker.ts index a1a6fe21e..73c628cb1 100644 --- a/src/types/stickers/sticker.ts +++ b/src/types/stickers/sticker.ts @@ -5,9 +5,9 @@ import type { User } from "../users/user.ts"; /** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure */ export interface Sticker { /** [Id of the sticker](https://discord.com/developers/docs/reference#image-formatting) */ - id: bigint; + id: string; /** Id of the pack the sticker is from */ - packId?: bigint; + packId?: string; /** Name of the sticker */ name: string; /** Description of the sticker */ @@ -21,7 +21,7 @@ export interface Sticker { /** Whether or not the sticker is available */ available?: boolean; /** Id of the guild that owns this sticker */ - guildId?: bigint; + guildId?: string; /** The user that uploaded the sticker */ user?: User; /** A sticker's sort order within a pack */ diff --git a/src/types/stickers/sickerItem.ts b/src/types/stickers/stickerItem.ts similarity index 96% rename from src/types/stickers/sickerItem.ts rename to src/types/stickers/stickerItem.ts index 6d5618c4d..adc396a1f 100644 --- a/src/types/stickers/sickerItem.ts +++ b/src/types/stickers/stickerItem.ts @@ -3,7 +3,7 @@ import { StickerFormatTypes } from "./stickerFormatTypes.ts"; /** https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure */ export interface StickerItem { /** Id of the sticker */ - id: bigint; + id: string; /** Name of the sticker */ name: string; /** [Type of sticker format](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types) */ diff --git a/src/types/stickers/stickerPack.ts b/src/types/stickers/stickerPack.ts index 2c3e268ae..cdf03fa0d 100644 --- a/src/types/stickers/stickerPack.ts +++ b/src/types/stickers/stickerPack.ts @@ -3,17 +3,17 @@ import { Sticker } from "./sticker.ts"; /** https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure */ export interface StickerPack { /** id of the sticker pack */ - id: bigint; + id: string; /** the stickers in the pack */ stickers: Sticker[]; /** name of the sticker pack */ name: string; /** id of the pack's SKU */ - sku_id: bigint; + sku_id: string; /** id of a sticker in the pack which is shown as the pack's icon */ - cover_sticker_id?: bigint; + cover_sticker_id?: string; /** description of the sticker pack */ description: string; /** id of the sticker pack's [banner image](https://discord.com/developers/docs/reference#image-formatting) */ - banner_asset_id?: bigint; + banner_asset_id?: string; }