feat(Stickers): sticker packs, sticker routes, and guild stickers (#145)

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Advaith
2021-07-07 07:07:32 -07:00
committed by GitHub
parent 836e8fb294
commit 4a836293d5
43 changed files with 1282 additions and 252 deletions

View File

@@ -28,12 +28,12 @@ jobs:
run: npx standard-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Deprecate old versions
run: npm deprecate discord-api-types@"~$(jq --raw-output '.version' package.json)-next" "No longer supported. Install the latest @next release" || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Publish new version
run: |
npm version --git-tag-version=false $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s)

View File

@@ -16,6 +16,7 @@ import type {
APIMessageComponentInteraction,
APIRole,
APIStageInstance,
APISticker,
APIUnavailableGuild,
APIUser,
GatewayActivity,
@@ -170,7 +171,7 @@ export enum GatewayIntentBits {
Guilds = 1 << 0,
GuildMembers = 1 << 1,
GuildBans = 1 << 2,
GuildEmojis = 1 << 3,
GuildEmojisAndStickers = 1 << 3,
GuildIntegrations = 1 << 4,
GuildWebhooks = 1 << 5,
GuildInvites = 1 << 6,
@@ -208,6 +209,7 @@ export enum GatewayDispatchEvents {
GuildRoleCreate = 'GUILD_ROLE_CREATE',
GuildRoleDelete = 'GUILD_ROLE_DELETE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildStickersUpdate = 'GUILD_STICKERS_UPDATE',
GuildUpdate = 'GUILD_UPDATE',
IntegrationCreate = 'INTEGRATION_CREATE',
IntegrationDelete = 'INTEGRATION_DELETE',
@@ -266,6 +268,7 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
| GatewayIntegrationUpdateDispatch
@@ -638,6 +641,30 @@ export interface GatewayGuildEmojisUpdateDispatchData {
emojis: APIEmoji[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export type GatewayGuildStickersUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildStickersUpdate,
GatewayGuildStickersUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export interface GatewayGuildStickersUpdateDispatchData {
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* Array of stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/

View File

@@ -16,6 +16,7 @@ import type {
APIMessageComponentInteraction,
APIRole,
APIStageInstance,
APISticker,
APIThreadMember,
APIUnavailableGuild,
APIUser,
@@ -173,7 +174,7 @@ export enum GatewayIntentBits {
Guilds = 1 << 0,
GuildMembers = 1 << 1,
GuildBans = 1 << 2,
GuildEmojis = 1 << 3,
GuildEmojisAndStickers = 1 << 3,
GuildIntegrations = 1 << 4,
GuildWebhooks = 1 << 5,
GuildInvites = 1 << 6,
@@ -211,6 +212,7 @@ export enum GatewayDispatchEvents {
GuildRoleCreate = 'GUILD_ROLE_CREATE',
GuildRoleDelete = 'GUILD_ROLE_DELETE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildStickersUpdate = 'GUILD_STICKERS_UPDATE',
GuildUpdate = 'GUILD_UPDATE',
IntegrationCreate = 'INTEGRATION_CREATE',
IntegrationDelete = 'INTEGRATION_DELETE',
@@ -275,6 +277,7 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
| GatewayIntegrationUpdateDispatch
@@ -648,6 +651,30 @@ export interface GatewayGuildEmojisUpdateDispatchData {
emojis: APIEmoji[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export type GatewayGuildStickersUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildStickersUpdate,
GatewayGuildStickersUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export interface GatewayGuildStickersUpdateDispatchData {
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* Array of stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/

View File

@@ -3,7 +3,7 @@
*/
import type { Snowflake } from '../../globals.ts';
import type { APIOverwrite, ChannelType } from './channel.ts';
import type { APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -13,6 +13,7 @@ import type {
IntegrationExpireBehavior,
} from './guild.ts';
import type { APIRole } from './permissions.ts';
import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
@@ -136,10 +137,13 @@ export enum AuditLogEvent {
IntegrationCreate = 80,
IntegrationUpdate,
IntegrationDelete,
StageInstanceCreate = 83,
StageInstanceCreate,
StageInstanceUpdate,
StageInstanceDelete,
StickerCreate = 90,
StickerUpdate,
StickerDelete,
}
/**
@@ -293,15 +297,20 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod
| APIAuditLogChangeKeyUserLimit
| APIAuditLogChangeKeyPrivacyLevel;
| APIAuditLogChangeKeyPrivacyLevel
| APIAuditLogChangeKeyTags
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
/**
* Returned when a guild's name is changed
* Returned when an entity's name is changed
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's description is changed
* Returned when a guild's or sticker's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
@@ -550,7 +559,7 @@ export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', ChannelType | string>;
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', number | string>;
/**
* Returned when an integration's enable_emoticons is changed
@@ -577,6 +586,31 @@ export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', num
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
/**
* Returned when a sticker's related emoji is changed
*/
export type APIAuditLogChangeKeyTags = AuditLogChangeData<'tags', string>;
/**
* Returned when a sticker's format_type is changed
*/
export type APIAuditLogChangeKeyFormatType = AuditLogChangeData<'format_type', StickerFormatType>;
/**
* Empty string
*/
export type APIAuditLogChangeKeyAsset = AuditLogChangeData<'asset', ''>;
/**
* Returned when a sticker's availability is changed
*/
export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', boolean>;
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**

View File

@@ -6,8 +6,9 @@ import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIMessageInteraction } from './interactions.ts';
import { APIApplication } from './oauth2.ts';
import type { APIApplication } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker, APIStickerItem } from './sticker.ts';
import type { APIUser } from './user.ts';
/**
@@ -318,12 +319,6 @@ export interface APIMessage {
* See https://en.wikipedia.org/wiki/Bit_field
*/
flags?: MessageFlags;
/**
* The stickers sent with the message (bots currently can only receive messages with stickers, not send)
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
stickers?: APISticker[];
/**
* The message associated with the `message_reference`
*
@@ -346,6 +341,19 @@ export interface APIMessage {
* Sent if the message contains components like buttons, action rows, or other interactive components
*/
components?: APIActionRowComponent[];
/**
* Sent if the message contains stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
sticker_items?: APIStickerItem[];
/**
* The stickers sent with the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
* @deprecated Use `sticker_items` instead
*/
stickers?: APISticker[];
}
/**
@@ -454,51 +462,6 @@ export enum MessageFlags {
Loading = 1 << 7,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* ID of the pack the sticker is from
*/
pack_id: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string;
/**
* A comma-separated list of tags for the sticker
*/
tags?: string;
/**
* Sticker asset hash
*/
asset: string;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
format_type: StickerFormatType;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
export enum StickerFormatType {
PNG = 1,
APNG,
LOTTIE,
}
/**
* https://discord.com/developers/docs/resources/channel#followed-channel-object
*/

View File

@@ -8,6 +8,7 @@ import type { APIEmoji } from './emoji.ts';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway.ts';
import type { APIRole } from './permissions.ts';
import type { APIStageInstance } from './stageInstance.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { GatewayVoiceState } from './voice.ts';
@@ -318,6 +319,12 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure
*/
stage_instances?: APIStageInstance[];
/**
* Custom guild stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**

View File

@@ -8,6 +8,7 @@ export * from './invite.ts';
export * from './oauth2.ts';
export * from './permissions.ts';
export * from './stageInstance.ts';
export * from './sticker.ts';
export * from './teams.ts';
export * from './template.ts';
export * from './user.ts';

View File

@@ -42,7 +42,7 @@ export const PermissionFlagsBits = {
ManageNicknames: 1n << 27n,
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojis: 1n << 30n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
} as const;

127
deno/payloads/v8/sticker.ts Normal file
View File

@@ -0,0 +1,127 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/sticker
*/
import type { Snowflake } from '../../globals.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* For standard stickers, ID of the pack the sticker is from
*/
pack_id?: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string | null;
/**
* For guild stickers, the Discord name of a unicode emoji representing the sticker's expression. for standard stickers, a comma-separated list of related expressions.
*/
tags: string;
/**
* Previously the sticker asset hash, now an empty string
* @deprecated
*/
asset: '';
/**
* Type of sticker
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
type: StickerType;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
format_type: StickerFormatType;
/**
* Whether this guild sticker can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
/**
* ID of the guild that owns this sticker
*/
guild_id?: Snowflake;
/**
* The user that uploaded the guild sticker
*/
user?: APIUser;
/**
* The standard sticker's sort order within its pack
*/
sort_value?: number;
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
export enum StickerType {
/**
* 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,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
export enum StickerFormatType {
PNG = 1,
APNG,
Lottie,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APIStickerPack {
/**
* ID of the sticker pack
*/
id: Snowflake;
/**
* The stickers in the pack
*/
stickers: APISticker[];
/**
* Name of the sticker pack
*/
name: string;
/**
* ID of the pack's SKU
*/
sku_id: Snowflake;
/**
* ID of a sticker in the pack which is shown as the pack's icon
*/
cover_sticker_id?: Snowflake;
/**
* Description of the sticker pack
*/
description: string;
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
}

View File

@@ -3,7 +3,7 @@
*/
import type { Snowflake } from '../../globals.ts';
import type { APIOverwrite, ChannelType } from './channel.ts';
import type { APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -13,6 +13,7 @@ import type {
IntegrationExpireBehavior,
} from './guild.ts';
import type { APIRole } from './permissions.ts';
import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
@@ -136,10 +137,13 @@ export enum AuditLogEvent {
IntegrationCreate = 80,
IntegrationUpdate,
IntegrationDelete,
StageInstanceCreate = 83,
StageInstanceCreate,
StageInstanceUpdate,
StageInstanceDelete,
StickerCreate = 90,
StickerUpdate,
StickerDelete,
}
/**
@@ -293,15 +297,20 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod
| APIAuditLogChangeKeyUserLimit
| APIAuditLogChangeKeyPrivacyLevel;
| APIAuditLogChangeKeyPrivacyLevel
| APIAuditLogChangeKeyTags
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
/**
* Returned when a guild's name is changed
* Returned when an entity's name is changed
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's description is changed
* Returned when a guild's or sticker's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
@@ -550,7 +559,7 @@ export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', ChannelType | string>;
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', number | string>;
/**
* Returned when an integration's enable_emoticons is changed
@@ -577,6 +586,31 @@ export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', num
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
/**
* Returned when a sticker's related emoji is changed
*/
export type APIAuditLogChangeKeyTags = AuditLogChangeData<'tags', string>;
/**
* Returned when a sticker's format_type is changed
*/
export type APIAuditLogChangeKeyFormatType = AuditLogChangeData<'format_type', StickerFormatType>;
/**
* Empty string
*/
export type APIAuditLogChangeKeyAsset = AuditLogChangeData<'asset', ''>;
/**
* Returned when a sticker's availability is changed
*/
export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', boolean>;
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**

View File

@@ -6,8 +6,9 @@ import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIMessageInteraction } from './interactions.ts';
import { APIApplication } from './oauth2.ts';
import type { APIApplication } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker, APIStickerItem } from './sticker.ts';
import type { APIUser } from './user.ts';
/**
@@ -354,12 +355,6 @@ export interface APIMessage {
* See https://en.wikipedia.org/wiki/Bit_field
*/
flags?: MessageFlags;
/**
* The stickers sent with the message (bots currently can only receive messages with stickers, not send)
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
stickers?: APISticker[];
/**
* The message associated with the `message_reference`
*
@@ -378,14 +373,27 @@ export interface APIMessage {
* Sent if the message is a response to an Interaction
*/
interaction?: APIMessageInteraction;
/**
* Sent if a thread was started from this message
*/
thread?: APIChannel;
/**
* Sent if the message contains components like buttons, action rows, or other interactive components
*/
components?: APIActionRowComponent[];
/**
* Sent if a thread was started from this message
* Sent if the message contains stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
thread?: APIChannel;
sticker_items?: APIStickerItem[];
/**
* The stickers sent with the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
* @deprecated Use `sticker_items` instead
*/
stickers?: APISticker[];
}
/**
@@ -500,51 +508,6 @@ export enum MessageFlags {
Loading = 1 << 7,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* ID of the pack the sticker is from
*/
pack_id: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string;
/**
* A comma-separated list of tags for the sticker
*/
tags?: string;
/**
* Sticker asset hash
*/
asset: string;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
format_type: StickerFormatType;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
export enum StickerFormatType {
PNG = 1,
APNG,
LOTTIE,
}
/**
* https://discord.com/developers/docs/resources/channel#followed-channel-object
*/

View File

@@ -8,6 +8,7 @@ import type { APIEmoji } from './emoji.ts';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway.ts';
import type { APIRole } from './permissions.ts';
import type { APIStageInstance } from './stageInstance.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { GatewayVoiceState } from './voice.ts';
@@ -326,6 +327,12 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure
*/
stage_instances?: APIStageInstance[];
/**
* Custom guild stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**

View File

@@ -8,6 +8,7 @@ export * from './invite.ts';
export * from './oauth2.ts';
export * from './permissions.ts';
export * from './stageInstance.ts';
export * from './sticker.ts';
export * from './teams.ts';
export * from './template.ts';
export * from './user.ts';

View File

@@ -42,7 +42,7 @@ export const PermissionFlagsBits = {
ManageNicknames: 1n << 27n,
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojis: 1n << 30n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageThreads: 1n << 34n,

127
deno/payloads/v9/sticker.ts Normal file
View File

@@ -0,0 +1,127 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/sticker
*/
import type { Snowflake } from '../../globals.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* For standard stickers, ID of the pack the sticker is from
*/
pack_id?: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string | null;
/**
* For guild stickers, the Discord name of a unicode emoji representing the sticker's expression. for standard stickers, a comma-separated list of related expressions.
*/
tags: string;
/**
* Previously the sticker asset hash, now an empty string
* @deprecated
*/
asset: '';
/**
* Type of sticker
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
type: StickerType;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
format_type: StickerFormatType;
/**
* Whether this guild sticker can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
/**
* ID of the guild that owns this sticker
*/
guild_id?: Snowflake;
/**
* The user that uploaded the guild sticker
*/
user?: APIUser;
/**
* The standard sticker's sort order within its pack
*/
sort_value?: number;
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
export enum StickerType {
/**
* 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,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
export enum StickerFormatType {
PNG = 1,
APNG,
Lottie,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APIStickerPack {
/**
* ID of the sticker pack
*/
id: Snowflake;
/**
* The stickers in the pack
*/
stickers: APISticker[];
/**
* Name of the sticker pack
*/
name: string;
/**
* ID of the pack's SKU
*/
sku_id: Snowflake;
/**
* ID of a sticker in the pack which is shown as the pack's icon
*/
cover_sticker_id?: Snowflake;
/**
* Description of the sticker pack
*/
description: string;
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
}

View File

@@ -32,6 +32,8 @@ export enum RESTJSONErrorCodes {
UnknownGuildTemplate = 10057,
UnknownSticker = 10060,
UnknownInteraction = 10062,
UnknownApplicationCommand,
@@ -61,6 +63,8 @@ export enum RESTJSONErrorCodes {
MaximumThreadParticipants = 30033,
MaximumNumberOfStickersReached = 30039,
Unauthorized = 40001,
VerifyYourAccount,
@@ -103,6 +107,9 @@ export enum RESTJSONErrorCodes {
InvalidAPIVersion = 50041,
FileUploadedExceedsMaximumSize = 50045,
InvalidFileUploaded,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
InvalidStickerSent = 50081,
@@ -120,5 +127,9 @@ export enum RESTJSONErrorCodes {
ThreadAlreadyCreatedForMessage = 160004,
ThreadLocked,
MaximumActiveThreads,
MaximumActiveAnnoucementThreads,
MaximumActiveAnnouncementThreads,
InvalidJSONForUploadedLottieFile = 170001,
LottieAnimationMaximumDimensionsExceeded = 170005,
}

View File

@@ -200,6 +200,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
message_reference?: APIMessageReferenceSend;
/**
* IDs of up to 3 stickers in the server to send in the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
sticker_ids?: [Snowflake] | [Snowflake, Snowflake] | [Snowflake, Snowflake, Snowflake];
}
/**

View File

@@ -11,6 +11,7 @@ export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';
export * from './stageInstance.ts';
export * from './sticker.ts';
export * from './template.ts';
export * from './user.ts';
export * from './voice.ts';
@@ -678,6 +679,41 @@ export const Routes = {
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
},
/**
* Route for:
* - GET `/sticker-packs`
*/
nitroStickerPacks() {
return '/sticker-packs' as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers/{sticker.id}`
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
},
};
export const RouteBases = {

51
deno/rest/v8/sticker.ts Normal file
View File

@@ -0,0 +1,51 @@
import type { APISticker, APIStickerPack } from '../../payloads/v8/mod.ts';
export type RESTGetAPIStickerResult = APISticker;
export interface RESTGetNitroStickerPacksResult {
sticker_packs: APIStickerPack[];
}
export type RESTGetAPIGuildStickersResult = APISticker[];
export type RESTGetAPIGuildStickerResult = APISticker;
export interface RESTPostAPIGuildStickerFormDataBody {
/**
* Name of the sticker (2-30 characters)
*/
name: string;
/**
* Description of the sticker (empty or 2-100 characters)
*/
description: string;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags: string;
/**
* The sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 500 KB
*/
file: unknown;
}
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
/**
* Name of the sticker (2-30 characters)
*/
name?: string;
/**
* Description of the sticker (2-100 characters)
*/
description?: string | null;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
export type RESTPatchAPIGuildStickerResult = APISticker;
export type RESTDeleteAPIGuildStickerResult = never;

View File

@@ -228,6 +228,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
message_reference?: APIMessageReferenceSend;
/**
* IDs of up to 3 stickers in the server to send in the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
sticker_ids?: [Snowflake] | [Snowflake, Snowflake] | [Snowflake, Snowflake, Snowflake];
}
/**

View File

@@ -11,6 +11,7 @@ export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';
export * from './stageInstance.ts';
export * from './sticker.ts';
export * from './template.ts';
export * from './user.ts';
export * from './voice.ts';
@@ -736,6 +737,41 @@ export const Routes = {
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
},
/**
* Route for:
* - GET `/sticker-packs`
*/
nitroStickerPacks() {
return '/sticker-packs' as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers/{sticker.id}`
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
},
};
export const RouteBases = {

51
deno/rest/v9/sticker.ts Normal file
View File

@@ -0,0 +1,51 @@
import type { APISticker, APIStickerPack } from '../../payloads/v9/mod.ts';
export type RESTGetAPIStickerResult = APISticker;
export interface RESTGetNitroStickerPacksResult {
sticker_packs: APIStickerPack[];
}
export type RESTGetAPIGuildStickersResult = APISticker[];
export type RESTGetAPIGuildStickerResult = APISticker;
export interface RESTPostAPIGuildStickerFormDataBody {
/**
* Name of the sticker (2-30 characters)
*/
name: string;
/**
* Description of the sticker (empty or 2-100 characters)
*/
description: string;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags: string;
/**
* The sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 500 KB
*/
file: unknown;
}
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
/**
* Name of the sticker (2-30 characters)
*/
name?: string;
/**
* Description of the sticker (2-100 characters)
*/
description?: string | null;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
export type RESTPatchAPIGuildStickerResult = APISticker;
export type RESTDeleteAPIGuildStickerResult = never;

View File

@@ -16,6 +16,7 @@ import type {
APIMessageComponentInteraction,
APIRole,
APIStageInstance,
APISticker,
APIUnavailableGuild,
APIUser,
GatewayActivity,
@@ -170,7 +171,7 @@ export const enum GatewayIntentBits {
Guilds = 1 << 0,
GuildMembers = 1 << 1,
GuildBans = 1 << 2,
GuildEmojis = 1 << 3,
GuildEmojisAndStickers = 1 << 3,
GuildIntegrations = 1 << 4,
GuildWebhooks = 1 << 5,
GuildInvites = 1 << 6,
@@ -208,6 +209,7 @@ export const enum GatewayDispatchEvents {
GuildRoleCreate = 'GUILD_ROLE_CREATE',
GuildRoleDelete = 'GUILD_ROLE_DELETE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildStickersUpdate = 'GUILD_STICKERS_UPDATE',
GuildUpdate = 'GUILD_UPDATE',
IntegrationCreate = 'INTEGRATION_CREATE',
IntegrationDelete = 'INTEGRATION_DELETE',
@@ -266,6 +268,7 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
| GatewayIntegrationUpdateDispatch
@@ -638,6 +641,30 @@ export interface GatewayGuildEmojisUpdateDispatchData {
emojis: APIEmoji[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export type GatewayGuildStickersUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildStickersUpdate,
GatewayGuildStickersUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export interface GatewayGuildStickersUpdateDispatchData {
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* Array of stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/

View File

@@ -16,6 +16,7 @@ import type {
APIMessageComponentInteraction,
APIRole,
APIStageInstance,
APISticker,
APIThreadMember,
APIUnavailableGuild,
APIUser,
@@ -173,7 +174,7 @@ export const enum GatewayIntentBits {
Guilds = 1 << 0,
GuildMembers = 1 << 1,
GuildBans = 1 << 2,
GuildEmojis = 1 << 3,
GuildEmojisAndStickers = 1 << 3,
GuildIntegrations = 1 << 4,
GuildWebhooks = 1 << 5,
GuildInvites = 1 << 6,
@@ -211,6 +212,7 @@ export const enum GatewayDispatchEvents {
GuildRoleCreate = 'GUILD_ROLE_CREATE',
GuildRoleDelete = 'GUILD_ROLE_DELETE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildStickersUpdate = 'GUILD_STICKERS_UPDATE',
GuildUpdate = 'GUILD_UPDATE',
IntegrationCreate = 'INTEGRATION_CREATE',
IntegrationDelete = 'INTEGRATION_DELETE',
@@ -275,6 +277,7 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
| GatewayIntegrationUpdateDispatch
@@ -648,6 +651,30 @@ export interface GatewayGuildEmojisUpdateDispatchData {
emojis: APIEmoji[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export type GatewayGuildStickersUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildStickersUpdate,
GatewayGuildStickersUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-stickers-update
*/
export interface GatewayGuildStickersUpdateDispatchData {
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* Array of stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/

View File

@@ -3,7 +3,7 @@
*/
import type { Snowflake } from '../../globals';
import type { APIOverwrite, ChannelType } from './channel';
import type { APIOverwrite } from './channel';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -13,6 +13,7 @@ import type {
IntegrationExpireBehavior,
} from './guild';
import type { APIRole } from './permissions';
import type { StickerFormatType } from './sticker';
import type { APIUser } from './user';
import type { APIWebhook } from './webhook';
import type { StageInstancePrivacyLevel } from './stageInstance';
@@ -136,10 +137,13 @@ export const enum AuditLogEvent {
IntegrationCreate = 80,
IntegrationUpdate,
IntegrationDelete,
StageInstanceCreate = 83,
StageInstanceCreate,
StageInstanceUpdate,
StageInstanceDelete,
StickerCreate = 90,
StickerUpdate,
StickerDelete,
}
/**
@@ -293,15 +297,20 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod
| APIAuditLogChangeKeyUserLimit
| APIAuditLogChangeKeyPrivacyLevel;
| APIAuditLogChangeKeyPrivacyLevel
| APIAuditLogChangeKeyTags
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
/**
* Returned when a guild's name is changed
* Returned when an entity's name is changed
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's description is changed
* Returned when a guild's or sticker's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
@@ -550,7 +559,7 @@ export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', ChannelType | string>;
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', number | string>;
/**
* Returned when an integration's enable_emoticons is changed
@@ -577,6 +586,31 @@ export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', num
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
/**
* Returned when a sticker's related emoji is changed
*/
export type APIAuditLogChangeKeyTags = AuditLogChangeData<'tags', string>;
/**
* Returned when a sticker's format_type is changed
*/
export type APIAuditLogChangeKeyFormatType = AuditLogChangeData<'format_type', StickerFormatType>;
/**
* Empty string
*/
export type APIAuditLogChangeKeyAsset = AuditLogChangeData<'asset', ''>;
/**
* Returned when a sticker's availability is changed
*/
export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', boolean>;
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**

View File

@@ -6,8 +6,9 @@ import type { Permissions, Snowflake } from '../../globals';
import type { APIPartialEmoji } from './emoji';
import type { APIGuildMember } from './guild';
import type { APIMessageInteraction } from './interactions';
import { APIApplication } from './oauth2';
import type { APIApplication } from './oauth2';
import type { APIRole } from './permissions';
import type { APISticker, APIStickerItem } from './sticker';
import type { APIUser } from './user';
/**
@@ -318,12 +319,6 @@ export interface APIMessage {
* See https://en.wikipedia.org/wiki/Bit_field
*/
flags?: MessageFlags;
/**
* The stickers sent with the message (bots currently can only receive messages with stickers, not send)
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
stickers?: APISticker[];
/**
* The message associated with the `message_reference`
*
@@ -346,6 +341,19 @@ export interface APIMessage {
* Sent if the message contains components like buttons, action rows, or other interactive components
*/
components?: APIActionRowComponent[];
/**
* Sent if the message contains stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
sticker_items?: APIStickerItem[];
/**
* The stickers sent with the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
* @deprecated Use `sticker_items` instead
*/
stickers?: APISticker[];
}
/**
@@ -454,51 +462,6 @@ export const enum MessageFlags {
Loading = 1 << 7,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* ID of the pack the sticker is from
*/
pack_id: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string;
/**
* A comma-separated list of tags for the sticker
*/
tags?: string;
/**
* Sticker asset hash
*/
asset: string;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
format_type: StickerFormatType;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
export const enum StickerFormatType {
PNG = 1,
APNG,
LOTTIE,
}
/**
* https://discord.com/developers/docs/resources/channel#followed-channel-object
*/

View File

@@ -8,6 +8,7 @@ import type { APIEmoji } from './emoji';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway';
import type { APIRole } from './permissions';
import type { APIStageInstance } from './stageInstance';
import type { APISticker } from './sticker';
import type { APIUser } from './user';
import type { GatewayVoiceState } from './voice';
@@ -318,6 +319,12 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure
*/
stage_instances?: APIStageInstance[];
/**
* Custom guild stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**

View File

@@ -8,6 +8,7 @@ export * from './invite';
export * from './oauth2';
export * from './permissions';
export * from './stageInstance';
export * from './sticker';
export * from './teams';
export * from './template';
export * from './user';

View File

@@ -42,7 +42,7 @@ export const PermissionFlagsBits = {
ManageNicknames: 1n << 27n,
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojis: 1n << 30n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
} as const;

127
payloads/v8/sticker.ts Normal file
View File

@@ -0,0 +1,127 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/sticker
*/
import type { Snowflake } from '../../globals';
import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* For standard stickers, ID of the pack the sticker is from
*/
pack_id?: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string | null;
/**
* For guild stickers, the Discord name of a unicode emoji representing the sticker's expression. for standard stickers, a comma-separated list of related expressions.
*/
tags: string;
/**
* Previously the sticker asset hash, now an empty string
* @deprecated
*/
asset: '';
/**
* Type of sticker
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
type: StickerType;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
format_type: StickerFormatType;
/**
* Whether this guild sticker can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
/**
* ID of the guild that owns this sticker
*/
guild_id?: Snowflake;
/**
* The user that uploaded the guild sticker
*/
user?: APIUser;
/**
* The standard sticker's sort order within its pack
*/
sort_value?: number;
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
export const enum StickerType {
/**
* 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,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
export const enum StickerFormatType {
PNG = 1,
APNG,
Lottie,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APIStickerPack {
/**
* ID of the sticker pack
*/
id: Snowflake;
/**
* The stickers in the pack
*/
stickers: APISticker[];
/**
* Name of the sticker pack
*/
name: string;
/**
* ID of the pack's SKU
*/
sku_id: Snowflake;
/**
* ID of a sticker in the pack which is shown as the pack's icon
*/
cover_sticker_id?: Snowflake;
/**
* Description of the sticker pack
*/
description: string;
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
}

View File

@@ -3,7 +3,7 @@
*/
import type { Snowflake } from '../../globals';
import type { APIOverwrite, ChannelType } from './channel';
import type { APIOverwrite } from './channel';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -13,6 +13,7 @@ import type {
IntegrationExpireBehavior,
} from './guild';
import type { APIRole } from './permissions';
import type { StickerFormatType } from './sticker';
import type { APIUser } from './user';
import type { APIWebhook } from './webhook';
import type { StageInstancePrivacyLevel } from './stageInstance';
@@ -136,10 +137,13 @@ export const enum AuditLogEvent {
IntegrationCreate = 80,
IntegrationUpdate,
IntegrationDelete,
StageInstanceCreate = 83,
StageInstanceCreate,
StageInstanceUpdate,
StageInstanceDelete,
StickerCreate = 90,
StickerUpdate,
StickerDelete,
}
/**
@@ -293,15 +297,20 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod
| APIAuditLogChangeKeyUserLimit
| APIAuditLogChangeKeyPrivacyLevel;
| APIAuditLogChangeKeyPrivacyLevel
| APIAuditLogChangeKeyTags
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
/**
* Returned when a guild's name is changed
* Returned when an entity's name is changed
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's description is changed
* Returned when a guild's or sticker's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
@@ -550,7 +559,7 @@ export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', ChannelType | string>;
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', number | string>;
/**
* Returned when an integration's enable_emoticons is changed
@@ -577,6 +586,31 @@ export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', num
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
/**
* Returned when a sticker's related emoji is changed
*/
export type APIAuditLogChangeKeyTags = AuditLogChangeData<'tags', string>;
/**
* Returned when a sticker's format_type is changed
*/
export type APIAuditLogChangeKeyFormatType = AuditLogChangeData<'format_type', StickerFormatType>;
/**
* Empty string
*/
export type APIAuditLogChangeKeyAsset = AuditLogChangeData<'asset', ''>;
/**
* Returned when a sticker's availability is changed
*/
export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', boolean>;
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**

View File

@@ -6,8 +6,9 @@ import type { Permissions, Snowflake } from '../../globals';
import type { APIPartialEmoji } from './emoji';
import type { APIGuildMember } from './guild';
import type { APIMessageInteraction } from './interactions';
import { APIApplication } from './oauth2';
import type { APIApplication } from './oauth2';
import type { APIRole } from './permissions';
import type { APISticker, APIStickerItem } from './sticker';
import type { APIUser } from './user';
/**
@@ -354,12 +355,6 @@ export interface APIMessage {
* See https://en.wikipedia.org/wiki/Bit_field
*/
flags?: MessageFlags;
/**
* The stickers sent with the message (bots currently can only receive messages with stickers, not send)
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
stickers?: APISticker[];
/**
* The message associated with the `message_reference`
*
@@ -378,14 +373,27 @@ export interface APIMessage {
* Sent if the message is a response to an Interaction
*/
interaction?: APIMessageInteraction;
/**
* Sent if a thread was started from this message
*/
thread?: APIChannel;
/**
* Sent if the message contains components like buttons, action rows, or other interactive components
*/
components?: APIActionRowComponent[];
/**
* Sent if a thread was started from this message
* Sent if the message contains stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
thread?: APIChannel;
sticker_items?: APIStickerItem[];
/**
* The stickers sent with the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
* @deprecated Use `sticker_items` instead
*/
stickers?: APISticker[];
}
/**
@@ -500,51 +508,6 @@ export const enum MessageFlags {
Loading = 1 << 7,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* ID of the pack the sticker is from
*/
pack_id: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string;
/**
* A comma-separated list of tags for the sticker
*/
tags?: string;
/**
* Sticker asset hash
*/
asset: string;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
format_type: StickerFormatType;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
export const enum StickerFormatType {
PNG = 1,
APNG,
LOTTIE,
}
/**
* https://discord.com/developers/docs/resources/channel#followed-channel-object
*/

View File

@@ -8,6 +8,7 @@ import type { APIEmoji } from './emoji';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway';
import type { APIRole } from './permissions';
import type { APIStageInstance } from './stageInstance';
import type { APISticker } from './sticker';
import type { APIUser } from './user';
import type { GatewayVoiceState } from './voice';
@@ -326,6 +327,12 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure
*/
stage_instances?: APIStageInstance[];
/**
* Custom guild stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**

View File

@@ -8,6 +8,7 @@ export * from './invite';
export * from './oauth2';
export * from './permissions';
export * from './stageInstance';
export * from './sticker';
export * from './teams';
export * from './template';
export * from './user';

View File

@@ -42,7 +42,7 @@ export const PermissionFlagsBits = {
ManageNicknames: 1n << 27n,
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojis: 1n << 30n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageThreads: 1n << 34n,

127
payloads/v9/sticker.ts Normal file
View File

@@ -0,0 +1,127 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/sticker
*/
import type { Snowflake } from '../../globals';
import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* For standard stickers, ID of the pack the sticker is from
*/
pack_id?: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string | null;
/**
* For guild stickers, the Discord name of a unicode emoji representing the sticker's expression. for standard stickers, a comma-separated list of related expressions.
*/
tags: string;
/**
* Previously the sticker asset hash, now an empty string
* @deprecated
*/
asset: '';
/**
* Type of sticker
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
type: StickerType;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
format_type: StickerFormatType;
/**
* Whether this guild sticker can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
/**
* ID of the guild that owns this sticker
*/
guild_id?: Snowflake;
/**
* The user that uploaded the guild sticker
*/
user?: APIUser;
/**
* The standard sticker's sort order within its pack
*/
sort_value?: number;
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
export const enum StickerType {
/**
* 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,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
export const enum StickerFormatType {
PNG = 1,
APNG,
Lottie,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APIStickerPack {
/**
* ID of the sticker pack
*/
id: Snowflake;
/**
* The stickers in the pack
*/
stickers: APISticker[];
/**
* Name of the sticker pack
*/
name: string;
/**
* ID of the pack's SKU
*/
sku_id: Snowflake;
/**
* ID of a sticker in the pack which is shown as the pack's icon
*/
cover_sticker_id?: Snowflake;
/**
* Description of the sticker pack
*/
description: string;
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
}

View File

@@ -32,6 +32,8 @@ export const enum RESTJSONErrorCodes {
UnknownGuildTemplate = 10057,
UnknownSticker = 10060,
UnknownInteraction = 10062,
UnknownApplicationCommand,
@@ -61,6 +63,8 @@ export const enum RESTJSONErrorCodes {
MaximumThreadParticipants = 30033,
MaximumNumberOfStickersReached = 30039,
Unauthorized = 40001,
VerifyYourAccount,
@@ -103,6 +107,9 @@ export const enum RESTJSONErrorCodes {
InvalidAPIVersion = 50041,
FileUploadedExceedsMaximumSize = 50045,
InvalidFileUploaded,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
InvalidStickerSent = 50081,
@@ -120,5 +127,9 @@ export const enum RESTJSONErrorCodes {
ThreadAlreadyCreatedForMessage = 160004,
ThreadLocked,
MaximumActiveThreads,
MaximumActiveAnnoucementThreads,
MaximumActiveAnnouncementThreads,
InvalidJSONForUploadedLottieFile = 170001,
LottieAnimationMaximumDimensionsExceeded = 170005,
}

View File

@@ -200,6 +200,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
message_reference?: APIMessageReferenceSend;
/**
* IDs of up to 3 stickers in the server to send in the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
sticker_ids?: [Snowflake] | [Snowflake, Snowflake] | [Snowflake, Snowflake, Snowflake];
}
/**

View File

@@ -11,6 +11,7 @@ export * from './interactions';
export * from './invite';
export * from './oauth2';
export * from './stageInstance';
export * from './sticker';
export * from './template';
export * from './user';
export * from './voice';
@@ -678,6 +679,41 @@ export const Routes = {
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
},
/**
* Route for:
* - GET `/sticker-packs`
*/
nitroStickerPacks() {
return '/sticker-packs' as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers/{sticker.id}`
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
},
};
export const RouteBases = {

51
rest/v8/sticker.ts Normal file
View File

@@ -0,0 +1,51 @@
import type { APISticker, APIStickerPack } from '../../payloads/v8/index';
export type RESTGetAPIStickerResult = APISticker;
export interface RESTGetNitroStickerPacksResult {
sticker_packs: APIStickerPack[];
}
export type RESTGetAPIGuildStickersResult = APISticker[];
export type RESTGetAPIGuildStickerResult = APISticker;
export interface RESTPostAPIGuildStickerFormDataBody {
/**
* Name of the sticker (2-30 characters)
*/
name: string;
/**
* Description of the sticker (empty or 2-100 characters)
*/
description: string;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags: string;
/**
* The sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 500 KB
*/
file: unknown;
}
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
/**
* Name of the sticker (2-30 characters)
*/
name?: string;
/**
* Description of the sticker (2-100 characters)
*/
description?: string | null;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
export type RESTPatchAPIGuildStickerResult = APISticker;
export type RESTDeleteAPIGuildStickerResult = never;

View File

@@ -228,6 +228,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
message_reference?: APIMessageReferenceSend;
/**
* IDs of up to 3 stickers in the server to send in the message
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
sticker_ids?: [Snowflake] | [Snowflake, Snowflake] | [Snowflake, Snowflake, Snowflake];
}
/**

View File

@@ -11,6 +11,7 @@ export * from './interactions';
export * from './invite';
export * from './oauth2';
export * from './stageInstance';
export * from './sticker';
export * from './template';
export * from './user';
export * from './voice';
@@ -736,6 +737,41 @@ export const Routes = {
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
},
/**
* Route for:
* - GET `/sticker-packs`
*/
nitroStickerPacks() {
return '/sticker-packs' as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers/{sticker.id}`
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
},
};
export const RouteBases = {

51
rest/v9/sticker.ts Normal file
View File

@@ -0,0 +1,51 @@
import type { APISticker, APIStickerPack } from '../../payloads/v9/index';
export type RESTGetAPIStickerResult = APISticker;
export interface RESTGetNitroStickerPacksResult {
sticker_packs: APIStickerPack[];
}
export type RESTGetAPIGuildStickersResult = APISticker[];
export type RESTGetAPIGuildStickerResult = APISticker;
export interface RESTPostAPIGuildStickerFormDataBody {
/**
* Name of the sticker (2-30 characters)
*/
name: string;
/**
* Description of the sticker (empty or 2-100 characters)
*/
description: string;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags: string;
/**
* The sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 500 KB
*/
file: unknown;
}
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
/**
* Name of the sticker (2-30 characters)
*/
name?: string;
/**
* Description of the sticker (2-100 characters)
*/
description?: string | null;
/**
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
export type RESTPatchAPIGuildStickerResult = APISticker;
export type RESTDeleteAPIGuildStickerResult = never;