mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
api-types rewrite (#117)
* feat: application commands types * message components * feat: interactions * feat: application * feat: user * fix
This commit is contained in:
parent
c4e50badc1
commit
a60d39f0cc
@ -1,2 +1,3 @@
|
||||
arrowParens: 'avoid'
|
||||
singleQuote: true
|
||||
printWidth: 120
|
@ -1,27 +1,3 @@
|
||||
/** https://discord.com/developers/docs/resources/user#user-object-premium-types */
|
||||
export enum PremiumTypes {
|
||||
None,
|
||||
NitroClassic,
|
||||
Nitro,
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/user#user-object-user-flags */
|
||||
export enum UserFlags {
|
||||
DiscordEmployee = 1 << 0,
|
||||
PartneredServerOwner = 1 << 1,
|
||||
HypeSquadEventsMember = 1 << 2,
|
||||
BugHunterLevel1 = 1 << 3,
|
||||
HouseBravery = 1 << 6,
|
||||
HouseBrilliance = 1 << 7,
|
||||
HouseBalance = 1 << 8,
|
||||
EarlySupporter = 1 << 9,
|
||||
TeamUser = 1 << 10,
|
||||
BugHunterLevel2 = 1 << 14,
|
||||
VerifiedBot = 1 << 16,
|
||||
EarlyVerifiedBotDeveloper = 1 << 17,
|
||||
DiscordCertifiedModerator = 1 << 18,
|
||||
BotHttpInteractions = 1 << 19,
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#channels-resource */
|
||||
export enum ChannelFlags {
|
||||
@ -49,38 +25,6 @@ export enum TeamMembershipStates {
|
||||
Accepted,
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/oauth2#application-application-flags */
|
||||
export enum ApplicationFlags {
|
||||
/** Intent required for bots in **100 or more servers** to receive [`presence_update` events](#DOCS_TOPICS_GATEWAY/presence-update) */
|
||||
GatewayPresence = 1 << 12,
|
||||
/** Intent required for bots in under 100 servers to receive [`presence_update` events](#DOCS_TOPICS_GATEWAY/presence-update), found in Bot Settings */
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
/** Intent required for bots in **100 or more servers** to receive member-related events like `guild_member_add`. See list of member-related events [under `GUILD_MEMBERS`](#DOCS_TOPICS_GATEWAY/list-of-intents) */
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
/** Intent required for bots in under 100 servers to receive member-related events like `guild_member_add`, found in Bot Settings. See list of member-related events [under `GUILD_MEMBERS`](#DOCS_TOPICS_GATEWAY/list-of-intents) */
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
/** Indicates unusual growth of an app that prevents verification */
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
/** Indicates if an app is embedded within the Discord client (currently unavailable publicly) */
|
||||
Embedded = 1 << 17,
|
||||
/** Intent required for bots in **100 or more servers** to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055) */
|
||||
GatewayMessageCount = 1 << 18,
|
||||
/** Intent required for bots in under 100 servers to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055), found in Bot Settings */
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/interactions/message-components#component-types */
|
||||
export enum MessageComponentTypes {
|
||||
/** A container for other components */
|
||||
ActionRow = 1,
|
||||
/** A button object */
|
||||
Button = 2,
|
||||
/** A select menu for picking from choices */
|
||||
SelectMenu = 3,
|
||||
/** A text input object */
|
||||
InputText = 4,
|
||||
}
|
||||
|
||||
export enum TextStyles {
|
||||
/** Intended for short single-line text */
|
||||
Short = 1,
|
||||
@ -1050,24 +994,6 @@ export const Intents = GatewayIntents;
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export type Intents = GatewayIntents;
|
||||
|
||||
/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionresponsetype */
|
||||
export enum InteractionResponseTypes {
|
||||
/** ACK a `Ping` */
|
||||
Pong = 1,
|
||||
/** Respond to an interaction with a message */
|
||||
ChannelMessageWithSource = 4,
|
||||
/** ACK an interaction and edit a response later, the user sees a loading state */
|
||||
DeferredChannelMessageWithSource = 5,
|
||||
/** For components, ACK an interaction and edit the original message later; the user does not see a loading state */
|
||||
DeferredUpdateMessage = 6,
|
||||
/** For components, edit the message the component was attached to */
|
||||
UpdateMessage = 7,
|
||||
/** For Application Command Options, send an autocomplete result */
|
||||
ApplicationCommandAutocompleteResult = 8,
|
||||
/** For Command or Component interactions, send a Modal response */
|
||||
Modal = 9,
|
||||
}
|
||||
|
||||
export enum Errors {
|
||||
// Bot Role errors
|
||||
BOTS_HIGHEST_ROLE_TOO_LOW = 'BOTS_HIGHEST_ROLE_TOO_LOW',
|
||||
@ -1276,12 +1202,6 @@ export type Camelize<T> = {
|
||||
: never;
|
||||
};
|
||||
|
||||
export type PickPartial<T, K extends keyof T> = {
|
||||
[P in keyof T]?: T[P] | undefined;
|
||||
} & { [P in K]: T[P] };
|
||||
|
||||
export type OmitFirstFnArg<F> = F extends (x: any, ...args: infer P) => infer R
|
||||
? (...args: P) => R
|
||||
: never;
|
||||
|
||||
export type Snowflake = string;
|
||||
|
149
packages/api-types/src/v10/application-command.ts
Normal file
149
packages/api-types/src/v10/application-command.ts
Normal file
@ -0,0 +1,149 @@
|
||||
import type { ChannelTypes } from './channel';
|
||||
import type { Snowflake, Localizations, DiscordBase } from './common';
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure */
|
||||
export interface ApplicationCommand extends ApplicationCommandLocalizations, DiscordBase {
|
||||
/** Type of command, defaults to 1 */
|
||||
type?: ApplicationCommandTypes;
|
||||
/** ID of the parent application */
|
||||
applicationId: Snowflake;
|
||||
/** Guild id of the command, if not global */
|
||||
guild_id?: Snowflake;
|
||||
/** Name of command, 1-32 characters */
|
||||
name: string;
|
||||
/**
|
||||
* Description for CHAT_INPUT commands, 1-100 characters.
|
||||
* Empty string for USER and MESSAGE commands
|
||||
*/
|
||||
description: string;
|
||||
/** Set of permissions represented as a bit set */
|
||||
default_member_permissions?: string;
|
||||
/**
|
||||
* Indicates whether the command is available in DMs with the app,
|
||||
* only for globally-scoped commands. By default, commands are visible.
|
||||
*/
|
||||
dm_permission?: boolean;
|
||||
/** Indicates whether the command is enabled by default when the app is added to a guild, defaults to true
|
||||
* @deprecated
|
||||
*/
|
||||
default_permission?: boolean;
|
||||
/** Autoincrementing version identifier updated during substantial record changes */
|
||||
readonly version: number;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandLocalizations {
|
||||
/**
|
||||
* Localization dictionary for name field.
|
||||
* Values follow the same restrictions as name
|
||||
*/
|
||||
name_localizations?: Localizations;
|
||||
/**
|
||||
* Localization dictionary for description field.
|
||||
* Values follow the same restrictions as description
|
||||
*/
|
||||
description_localizations?: Localizations;
|
||||
}
|
||||
|
||||
export interface ApplicationChatInputCommand<T extends ApplicationCommandOption> extends ApplicationCommand {
|
||||
options?: T[];
|
||||
}
|
||||
|
||||
export interface ApplicationUserCommand extends ApplicationCommand {}
|
||||
|
||||
export interface ApplicationMessageCommand extends ApplicationCommand {}
|
||||
|
||||
export type DiscordApplicationCommand = ApplicationMessageCommand | ApplicationUserCommand | ApplicationChatInputCommand<ApplicationCommandOptions>;
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */
|
||||
export interface ApplicationCommandOption extends ApplicationCommandLocalizations {
|
||||
/** Type of option */
|
||||
type: ApplicationCommandOptionTypes;
|
||||
/** 1-32 character name */
|
||||
name: string;
|
||||
/** 1-100 character description */
|
||||
description: string;
|
||||
/** If the parameter is required or optional, by default false */
|
||||
required?: boolean;
|
||||
/** If autocomplete interactions are enabled */
|
||||
autocomplete?: boolean;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandWithOptions<T extends ApplicationCommandOption>
|
||||
extends Omit<ApplicationCommandOption, 'autocomplete'> {
|
||||
options: T[];
|
||||
}
|
||||
|
||||
export type ApplicationCommandSubCommandOption = ApplicationCommandWithOptions<ApplicationCommandOptions>;
|
||||
|
||||
export type ApplicationCommandSubGroupOption = ApplicationCommandWithOptions<ApplicationCommandSubCommandOption>;
|
||||
|
||||
export interface ApplicationCommandStringOption extends ApplicationCommandOption {
|
||||
type: ApplicationCommandOptionTypes.String;
|
||||
/** The minimum allowed length (minimum of 0) */
|
||||
min_length?: number;
|
||||
/** The maximum allowed length (maximum of 6000) */
|
||||
max_length?: number;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandIntegerOrNumberOption extends ApplicationCommandOption {
|
||||
type: ApplicationCommandOptionTypes.Integer | ApplicationCommandOptionTypes.Number;
|
||||
/** The minimum value permitted */
|
||||
min_value?: number;
|
||||
/** The maximum value permitted */
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandChannelOption extends ApplicationCommandOption {
|
||||
type: ApplicationCommandOptionTypes.Channel;
|
||||
/** If the option is a channel type, the channels shown will be restricted to these types */
|
||||
channel_types: ChannelTypes[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */
|
||||
export interface ApplicationCommandOptionChoice
|
||||
extends Omit<ApplicationCommandLocalizations, 'description_localizations'> {
|
||||
/** 1-100 character choice name */
|
||||
name: string;
|
||||
/** Value for the choice, up to 100 characters if string */
|
||||
value: string | number;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandWithChoices extends Omit<ApplicationCommandOption, 'autocomplete'> {
|
||||
choices: ApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
export type ApplicationCommandOptions =
|
||||
| ApplicationCommandChannelOption
|
||||
| ApplicationCommandWithChoices
|
||||
| ApplicationCommandIntegerOrNumberOption
|
||||
| ApplicationCommandStringOption;
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types */
|
||||
export enum ApplicationCommandTypes {
|
||||
/** A text-based command that shows up when a user types `/` */
|
||||
ChatInput = 1,
|
||||
/** A UI-based command that shows up when you right click or tap on a user */
|
||||
User,
|
||||
/** A UI-based command that shows up when you right click or tap on a message */
|
||||
Message,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype */
|
||||
export enum ApplicationCommandOptionTypes {
|
||||
SubCommand = 1,
|
||||
SubCommandGroup,
|
||||
String,
|
||||
/** Any integer between -2^53 and 2^53 */
|
||||
Integer,
|
||||
Boolean,
|
||||
User,
|
||||
/** Includes all channel types + categories */
|
||||
Channel,
|
||||
Role,
|
||||
/** Includes users and roles */
|
||||
Mentionable,
|
||||
/** Any double between -2^53 and 2^53 */
|
||||
Number,
|
||||
/** attachment object */
|
||||
Attachment,
|
||||
}
|
74
packages/api-types/src/v10/application.ts
Normal file
74
packages/api-types/src/v10/application.ts
Normal file
@ -0,0 +1,74 @@
|
||||
import type { Snowflake, DiscordBase } from './common';
|
||||
import type { DiscordUser } from './user';
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/application#application-object-application-structure */
|
||||
export interface DiscordApplication extends DiscordBase {
|
||||
/** the name of the app */
|
||||
name: string;
|
||||
/** the icon hash of the app */
|
||||
icon: string | null;
|
||||
/** the description of the app */
|
||||
description: string;
|
||||
/** an array of rpc origin urls, if rpc is enabled */
|
||||
rpc_origins?: string[];
|
||||
/** when false only app owner can join the app's bot to guilds */
|
||||
bot_public: boolean;
|
||||
/** when true the app's bot will only join upon completion of the full oauth2 code grant flow */
|
||||
bot_require_code_grant: boolean;
|
||||
/** the url of the app's terms of service */
|
||||
terms_of_service_url?: string;
|
||||
/** the url of the app's privacy policy */
|
||||
privacy_police_url?: string;
|
||||
/** partial user object containing info on the owner of the application */
|
||||
owner: Partial<DiscordUser>;
|
||||
/** @deprecated and will be removed in v11. An empty string. */
|
||||
summary: string;
|
||||
/** the hex encoded key for verification in interactions and the GameSDK's */
|
||||
veify_key: string;
|
||||
/** if the application belongs to a team, this will be a list of the members of that team */
|
||||
team: any | null;
|
||||
/** if this application is a game sold on Discord, this field will be the guild to which it has been linked */
|
||||
guild_id?: Snowflake;
|
||||
/** if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */
|
||||
primary_sku_id?: Snowflake;
|
||||
/** if this application is a game sold on Discord, this field will be the URL slug that links to the store page */
|
||||
slug?: string;
|
||||
/** the application's default rich presence invite cover image hash */
|
||||
cover_image?: string;
|
||||
/** the application's public flags */
|
||||
flags?: DiscordApplicationFlags;
|
||||
/** up to 5 tags describing the content and functionality of the application */
|
||||
tags?: string[];
|
||||
/** settings for the application's default in-app authorization link, if enabled */
|
||||
install_params?: DiscordApplicationInstallParams;
|
||||
/** the application's default custom authorization link, if enabled */
|
||||
custom_install_url?: string;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/application#application-object-application-flags */
|
||||
export enum DiscordApplicationFlags {
|
||||
/** Intent required for bots in **100 or more servers** to receive [`presence_update` events](#DOCS_TOPICS_GATEWAY/presence-update) */
|
||||
GatewayPresence = 1 << 12,
|
||||
/** Intent required for bots in under 100 servers to receive [`presence_update` events](#DOCS_TOPICS_GATEWAY/presence-update), found in Bot Settings */
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
/** Intent required for bots in **100 or more servers** to receive member-related events like `guild_member_add`. See list of member-related events [under `GUILD_MEMBERS`](#DOCS_TOPICS_GATEWAY/list-of-intents) */
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
/** Intent required for bots in under 100 servers to receive member-related events like `guild_member_add`, found in Bot Settings. See list of member-related events [under `GUILD_MEMBERS`](#DOCS_TOPICS_GATEWAY/list-of-intents) */
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
/** Indicates unusual growth of an app that prevents verification */
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
/** Indicates if an app is embedded within the Discord client (currently unavailable publicly) */
|
||||
Embedded = 1 << 17,
|
||||
/** Intent required for bots in **100 or more servers** to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055) */
|
||||
GatewayMessageCount = 1 << 18,
|
||||
/** Intent required for bots in under 100 servers to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055), found in Bot Settings */
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/application#install-params-object-install-params-structure */
|
||||
export interface DiscordApplicationInstallParams {
|
||||
/** the scopes to add the application to the server with */
|
||||
scopes: string[];
|
||||
/** the permissions to request for the bot role */
|
||||
permissions: string;
|
||||
}
|
292
packages/api-types/src/v10/audit-log.ts
Normal file
292
packages/api-types/src/v10/audit-log.ts
Normal file
@ -0,0 +1,292 @@
|
||||
// TODO: WAITING OTHER OBJECTS
|
||||
|
||||
import type { DiscordApplicationCommand } from './application-command';
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/audit-log#audit-log-object */
|
||||
export interface DiscordAuditLog {
|
||||
/** List of application commands referenced in the audit log */
|
||||
application_commands: DiscordApplicationCommand[];
|
||||
/** List of audit log entries, sorted from most to least recent */
|
||||
audit_log_entries: DiscordAuditLogEntry[];
|
||||
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
|
||||
export interface DiscordAuditLogEntry {
|
||||
/** ID of the affected entity (webhook, user, role, etc.) */
|
||||
target_id: string | null;
|
||||
/** Changes made to the `target_id` */
|
||||
changes?: DiscordAuditLogChange[];
|
||||
/** User or app that made the changes */
|
||||
user_id: string | null;
|
||||
/** ID of the entry */
|
||||
id: string;
|
||||
/** Type of action that occurred */
|
||||
action_type: AuditLogEvents;
|
||||
/** Additional info for certain event types */
|
||||
options?: DiscordOptionalAuditEntryInfo;
|
||||
/** Reason for the change (1-512 characters) */
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
||||
export type DiscordAuditLogChange =
|
||||
| {
|
||||
new_value: string;
|
||||
old_value: string;
|
||||
key:
|
||||
| 'name'
|
||||
| 'description'
|
||||
| 'discovery_splash_hash'
|
||||
| 'banner_hash'
|
||||
| 'preferred_locale'
|
||||
| 'rules_channel_id'
|
||||
| 'public_updates_channel_id'
|
||||
| 'icon_hash'
|
||||
| 'image_hash'
|
||||
| 'splash_hash'
|
||||
| 'owner_id'
|
||||
| 'region'
|
||||
| 'afk_channel_id'
|
||||
| 'vanity_url_code'
|
||||
| 'widget_channel_id'
|
||||
| 'system_channel_id'
|
||||
| 'topic'
|
||||
| 'application_id'
|
||||
| 'permissions'
|
||||
| 'allow'
|
||||
| 'deny'
|
||||
| 'code'
|
||||
| 'channel_id'
|
||||
| 'inviter_id'
|
||||
| 'nick'
|
||||
| 'avatar_hash'
|
||||
| 'id'
|
||||
| 'location'
|
||||
| 'command_id';
|
||||
}
|
||||
| {
|
||||
new_value: number;
|
||||
old_value: number;
|
||||
key:
|
||||
| 'afk_timeout'
|
||||
| 'mfa_level'
|
||||
| 'verification_level'
|
||||
| 'explicit_content_filter'
|
||||
| 'default_message_notifications'
|
||||
| 'prune_delete_days'
|
||||
| 'position'
|
||||
| 'bitrate'
|
||||
| 'rate_limit_per_user'
|
||||
| 'color'
|
||||
| 'max_uses'
|
||||
| 'uses'
|
||||
| 'max_age'
|
||||
| 'expire_behavior'
|
||||
| 'expire_grace_period'
|
||||
| 'user_limit'
|
||||
| 'privacy_level'
|
||||
| 'auto_archive_duration'
|
||||
| 'default_auto_archive_duration'
|
||||
| 'entity_type'
|
||||
| 'status'
|
||||
| 'communication_disabled_until';
|
||||
}
|
||||
| {
|
||||
new_value: Partial<any>[]; // Role
|
||||
old_value?: Partial<any>[]; // Role
|
||||
key: '$add' | '$remove';
|
||||
}
|
||||
| {
|
||||
new_value: boolean;
|
||||
old_value: boolean;
|
||||
key:
|
||||
| 'widget_enabled'
|
||||
| 'nsfw'
|
||||
| 'hoist'
|
||||
| 'mentionable'
|
||||
| 'temporary'
|
||||
| 'deaf'
|
||||
| 'mute'
|
||||
| 'enable_emoticons'
|
||||
| 'archived'
|
||||
| 'locked'
|
||||
| 'invitable';
|
||||
}
|
||||
| {
|
||||
new_value: any[]; // Overwrite
|
||||
old_value: any[]; // Overwrite
|
||||
key: 'permission_overwrites';
|
||||
}
|
||||
| {
|
||||
new_value: string | number;
|
||||
old_value: string | number;
|
||||
key: 'type';
|
||||
};
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
|
||||
export interface DiscordOptionalAuditEntryInfo {
|
||||
/**
|
||||
* Number of days after which inactive members were kicked.
|
||||
*
|
||||
* Event types: `MEMBER_PRUNE`
|
||||
*/
|
||||
delete_member_days: string;
|
||||
/**
|
||||
* Number of members removed by the prune.
|
||||
*
|
||||
* Event types: `MEMBER_PRUNE`
|
||||
*/
|
||||
members_removed: string;
|
||||
/**
|
||||
* Channel in which the entities were targeted.
|
||||
*
|
||||
* Event types: `MEMBER_MOVE`, `MESSAGE_PIN`, `MESSAGE_UNPIN`, `MESSAGE_DELETE`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`
|
||||
*/
|
||||
channel_id: string;
|
||||
/**
|
||||
* ID of the message that was targeted.
|
||||
*
|
||||
* Event types: `MESSAGE_PIN`, `MESSAGE_UNPIN`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`
|
||||
*/
|
||||
message_id: string;
|
||||
/**
|
||||
* Number of entities that were targeted.
|
||||
*
|
||||
* Event types: `MESSAGE_DELETE`, `MESSAGE_BULK_DELETE`, `MEMBER_DISCONNECT`, `MEMBER_MOVE`
|
||||
*/
|
||||
count: string;
|
||||
/**
|
||||
* ID of the overwritten entity.
|
||||
*
|
||||
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Type of overwritten entity - "0", for "role", or "1" for "member".
|
||||
*
|
||||
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Name of the role if type is "0" (not present if type is "1").
|
||||
*
|
||||
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
|
||||
*/
|
||||
role_name: string;
|
||||
/**
|
||||
* ID of the app whose permissions were targeted.
|
||||
*
|
||||
* Event types: `APPLICATION_COMMAND_PERMISSION_UPDATE`
|
||||
*/
|
||||
application_id: string;
|
||||
}
|
||||
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
|
||||
export enum AuditLogEvents {
|
||||
/** Server settings were updated */
|
||||
GuildUpdate = 1,
|
||||
/** Channel was created */
|
||||
ChannelCreate = 10,
|
||||
/** Channel settings were updated */
|
||||
ChannelUpdate,
|
||||
/** Channel was deleted */
|
||||
ChannelDelete,
|
||||
/** Permission overwrite was added to a channel */
|
||||
ChannelOverwriteCreate,
|
||||
/** Permission overwrite was updated for a channel */
|
||||
ChannelOverwriteUpdate,
|
||||
/** Permission overwrite was deleted from a channel */
|
||||
ChannelOverwriteDelete,
|
||||
/** Member was removed from server */
|
||||
MemberKick = 20,
|
||||
/** Members were pruned from server */
|
||||
MemberPrune,
|
||||
/** Member was banned from server */
|
||||
MemberBanAdd,
|
||||
/** Server ban was lifted for a member */
|
||||
MemberBanRemove,
|
||||
/** Member was updated in server */
|
||||
MemberUpdate,
|
||||
/** Member was added or removed from a role */
|
||||
MemberRoleUpdate,
|
||||
/** Member was moved to a different voice channel */
|
||||
MemberMove,
|
||||
/** Member was disconnected from a voice channel */
|
||||
MemberDisconnect,
|
||||
/** Bot user was added to server */
|
||||
BotAdd,
|
||||
/** Role was created */
|
||||
RoleCreate = 30,
|
||||
/** Role was edited */
|
||||
RoleUpdate,
|
||||
/** Role was deleted */
|
||||
RoleDelete,
|
||||
/** Server invite was created */
|
||||
InviteCreate = 40,
|
||||
/** Server invite was updated */
|
||||
InviteUpdate,
|
||||
/** Server invite was deleted */
|
||||
InviteDelete,
|
||||
/** Webhook was created */
|
||||
WebhookCreate = 50,
|
||||
/** Webhook properties or channel were updated */
|
||||
WebhookUpdate,
|
||||
/** Webhook was deleted */
|
||||
WebhookDelete,
|
||||
/** Emoji was created */
|
||||
EmojiCreate = 60,
|
||||
/** Emoji name was updated */
|
||||
EmojiUpdate,
|
||||
/** Emoji was deleted */
|
||||
EmojiDelete,
|
||||
/** Single message was deleted */
|
||||
MessageDelete = 72,
|
||||
/** Multiple messages were deleted */
|
||||
MessageBulkDelete,
|
||||
/** Messaged was pinned to a channel */
|
||||
MessagePin,
|
||||
/** Message was unpinned from a channel */
|
||||
MessageUnpin,
|
||||
/** App was added to server */
|
||||
IntegrationCreate = 80,
|
||||
/** App was updated (as an example, its scopes were updated) */
|
||||
IntegrationUpdate,
|
||||
/** App was removed from server */
|
||||
IntegrationDelete,
|
||||
/** Stage instance was created (stage channel becomes live) */
|
||||
StageInstanceCreate,
|
||||
/** Stage instace details were updated */
|
||||
StageInstanceUpdate,
|
||||
/** Stage instance was deleted (stage channel no longer live) */
|
||||
StageInstanceDelete,
|
||||
/** Sticker was created */
|
||||
StickerCreate = 90,
|
||||
/** Sticker details were updated */
|
||||
StickerUpdate,
|
||||
/** Sticker was deleted */
|
||||
StickerDelete,
|
||||
/** Event was created */
|
||||
GuildScheduledEventCreate = 100,
|
||||
/** Event was updated */
|
||||
GuildScheduledEventUpdate,
|
||||
/** Event was cancelled */
|
||||
GuildScheduledEventDelete,
|
||||
/** Thread was created in a channel */
|
||||
ThreadCreate = 110,
|
||||
/** Thread was updated */
|
||||
ThreadUpdate,
|
||||
/** Thread was deleted */
|
||||
ThreadDelete,
|
||||
/** Permissions were updated for a command */
|
||||
ApplicationCommandPermissionUpdate = 121,
|
||||
/** Auto moderation rule was created */
|
||||
AutoModerationRuleCreate = 140,
|
||||
/** Auto moderation rule was updated */
|
||||
AutoModerationRuleUpdate,
|
||||
/** Auto moderation rule was deleted */
|
||||
AutoModerationRuleDelete,
|
||||
/** Message was blocked by AutoMod according to a rule. */
|
||||
AutoModerationBlockMessage,
|
||||
}
|
91
packages/api-types/src/v10/auto-moderation.ts
Normal file
91
packages/api-types/src/v10/auto-moderation.ts
Normal file
@ -0,0 +1,91 @@
|
||||
import type { Snowflake, DiscordBase } from './common';
|
||||
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure */
|
||||
export interface DiscordAutoModerationRule extends DiscordBase {
|
||||
/** the id of the guild which this rule belongs to */
|
||||
guild_id: Snowflake;
|
||||
/** the rule name */
|
||||
name: string;
|
||||
/** the user which first created this rule */
|
||||
creator_id: Snowflake;
|
||||
/** the rule event type */
|
||||
event_type: AutoModerationEventTypes;
|
||||
/** the rule trigger type */
|
||||
trigger_type: AutoModerationTriggerTypes;
|
||||
/** the rule trigger metadata */
|
||||
trigger_metadata: AutoModerationTriggerMetadata;
|
||||
/** the actions which will execute when the rule is triggered */
|
||||
actions: AutoModerationAction[];
|
||||
/** whether the rule is enabled */
|
||||
enabled: boolean;
|
||||
/** the role ids that should not be affected by the rule (Maximum of 20) */
|
||||
exempt_roles: Snowflake[];
|
||||
/** the channel ids that should not be affected by the rule (Maximum of 50) */
|
||||
exempt_channels: Snowflake[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure */
|
||||
export interface AutoModerationAction {
|
||||
/** the type of action */
|
||||
type: AutoModerationActionTypes;
|
||||
/** additional metadata needed during execution for this specific action type */
|
||||
metadata?: AutoModerationActionMetadata;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types */
|
||||
export enum AutoModerationActionTypes {
|
||||
/** blocks the content of a message according to the rule */
|
||||
BLOCK_MESSAGE = 1,
|
||||
/** logs user content to a specified channel */
|
||||
SEND_ALERT_MESSAGE,
|
||||
/** timeout user for a specified duration */
|
||||
TIMEOUT,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata */
|
||||
export interface AutoModerationActionMetadata {
|
||||
/** channel to which user content should be logged */
|
||||
channel_id: Snowflake;
|
||||
/** timeout duration in seconds. Maximum of 2419200 seconds (4 weeks) */
|
||||
duration_seconds: number;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata */
|
||||
export interface AutoModerationTriggerMetadata {
|
||||
/** substrings which will be searched for in content */
|
||||
keyword_filter: string[];
|
||||
/** the internally pre-defined wordsets which will be searched for in content */
|
||||
presents: AutoModerationKeywordPresetTypes[];
|
||||
/** substrings which will be exempt from triggering the preset trigger type */
|
||||
allow_list: string[];
|
||||
/** total number of mentions (role & user) allowed per message (Maximum of 50) */
|
||||
mention_total_spam: number;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types */
|
||||
export enum AutoModerationKeywordPresetTypes {
|
||||
/** Words that may be considered forms of swearing or cursin */
|
||||
PROFANITY = 1,
|
||||
/** Words that refer to sexually explicit behavior or activity */
|
||||
SEXUAL_CONTENT,
|
||||
/** Personal insults or words that may be considered hate speech */
|
||||
SLURS,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types */
|
||||
export enum AutoModerationTriggerTypes {
|
||||
/** check if content contains words from a user defined list of keywords */
|
||||
KEYWORD = 1,
|
||||
/** check if content represents generic spam */
|
||||
SPAM = 3,
|
||||
/** check if content contains words from internal pre-defined wordsets*/
|
||||
KEYWORD_PRESET = 4,
|
||||
/** check if content contains more mentions than allowed */
|
||||
MENTION_SPAM = 5
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types */
|
||||
export enum AutoModerationEventTypes {
|
||||
MESSAGE_SEND = 1,
|
||||
}
|
27
packages/api-types/src/v10/channel.ts
Normal file
27
packages/api-types/src/v10/channel.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/** @link https://discord.com/developers/docs/resources/channel#channel-object-channel-types */
|
||||
export enum ChannelTypes {
|
||||
/** A text channel within a server */
|
||||
GuildText,
|
||||
/** A direct message between users */
|
||||
DM,
|
||||
/** A voice channel within a server */
|
||||
GuildVoice,
|
||||
/** A direct message between multiple users */
|
||||
GroupDm,
|
||||
/** An organizational category that contains up to 50 channels */
|
||||
GuildCategory,
|
||||
/** A channel that users can follow and crosspost into their own server */
|
||||
GuildNews,
|
||||
/** A temporary sub-channel within a GUILD_NEWS channel */
|
||||
GuildNewsThread = 10,
|
||||
/** A temporary sub-channel within a GUILD_TEXT channel */
|
||||
GuildPublicThread,
|
||||
/** A temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission */
|
||||
GuildPrivateThread,
|
||||
/** A voice channel for hosting events with an audience */
|
||||
GuildStageVoice,
|
||||
/** A channel in a hub containing the listed servers */
|
||||
GuildDirectory,
|
||||
/** A channel which can only contains threads */
|
||||
GuildForum,
|
||||
}
|
109
packages/api-types/src/v10/common.ts
Normal file
109
packages/api-types/src/v10/common.ts
Normal file
@ -0,0 +1,109 @@
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/emoji#emoji-object */
|
||||
export interface DiscordEmoji {
|
||||
name: string | null;
|
||||
id: Snowflake;
|
||||
// TODO ROLE
|
||||
roles?: Record<string, any>[];
|
||||
// TODO USER
|
||||
user?: Record<string, any>;
|
||||
require_colons?: boolean;
|
||||
managed?: boolean;
|
||||
animated?: boolean;
|
||||
available?: boolean;
|
||||
}
|
||||
|
||||
export type DiscordPartialEmoji = Partial<Pick<DiscordEmoji, 'id' | 'name'| 'animated'>>;
|
||||
|
||||
export type Localizations = Partial<Record<Locales, string>>;
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/slash-commands#interaction-interactiontype */
|
||||
export enum InteractionTypes {
|
||||
Ping = 1,
|
||||
ApplicationCommand = 2,
|
||||
MessageComponent = 3,
|
||||
ApplicationCommandAutocomplete = 4,
|
||||
ModalSubmit = 5,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/user#user-object-premium-types */
|
||||
export enum PremiumTypes {
|
||||
None,
|
||||
NitroClassic,
|
||||
Nitro,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/user#user-object-user-flags */
|
||||
export enum UserFlags {
|
||||
DiscordEmployee = 1 << 0,
|
||||
PartneredServerOwner = 1 << 1,
|
||||
HypeSquadEventsMember = 1 << 2,
|
||||
BugHunterLevel1 = 1 << 3,
|
||||
HouseBravery = 1 << 6,
|
||||
HouseBrilliance = 1 << 7,
|
||||
HouseBalance = 1 << 8,
|
||||
EarlySupporter = 1 << 9,
|
||||
TeamUser = 1 << 10,
|
||||
BugHunterLevel2 = 1 << 14,
|
||||
VerifiedBot = 1 << 16,
|
||||
EarlyVerifiedBotDeveloper = 1 << 17,
|
||||
DiscordCertifiedModerator = 1 << 18,
|
||||
BotHttpInteractions = 1 << 19,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/user#connection-object-visibility-types */
|
||||
export enum VisibilityTypes {
|
||||
/** Invisible to everyone except the user themselves */
|
||||
None,
|
||||
/** Visible to everyone */
|
||||
Everyone,
|
||||
}
|
||||
|
||||
export enum Locales {
|
||||
Danish = 'da',
|
||||
German = 'de',
|
||||
EnglishUk = 'en-GB',
|
||||
EnglishUs = 'en-US',
|
||||
Spanish = 'es-ES',
|
||||
French = 'fr',
|
||||
Croatian = 'hr',
|
||||
Italian = 'it',
|
||||
Lithuanian = 'lt',
|
||||
Hungarian = 'hu',
|
||||
Dutch = 'nl',
|
||||
Norwegian = 'no',
|
||||
Polish = 'pl',
|
||||
PortugueseBrazilian = 'pt-BR',
|
||||
RomanianRomania = 'ro',
|
||||
Finnish = 'fi',
|
||||
Swedish = 'sv-SE',
|
||||
Vietnamese = 'vi',
|
||||
Turkish = 'tr',
|
||||
Czech = 'cs',
|
||||
Greek = 'el',
|
||||
Bulgarian = 'bg',
|
||||
Russian = 'ru',
|
||||
Ukrainian = 'uk',
|
||||
Hindi = 'hi',
|
||||
Thai = 'th',
|
||||
ChineseChina = 'zh-CN',
|
||||
Japanese = 'ja',
|
||||
ChineseTaiwan = 'zh-TW',
|
||||
Korean = 'ko',
|
||||
}
|
||||
|
||||
export interface DiscordBase {
|
||||
/** Unique ID of the object */
|
||||
id: Snowflake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs).
|
||||
* These IDs are guaranteed to be unique across all of Discord,
|
||||
* except in some unique scenarios in which child objects share their parent's ID.
|
||||
*/
|
||||
export type Snowflake = string;
|
||||
|
||||
export type PickPartial<T, K extends keyof T> = {
|
||||
[P in keyof T]?: T[P] | undefined;
|
||||
} & { [P in K]: T[P] };
|
216
packages/api-types/src/v10/interaction.ts
Normal file
216
packages/api-types/src/v10/interaction.ts
Normal file
@ -0,0 +1,216 @@
|
||||
import type {
|
||||
ApplicationCommandTypes,
|
||||
ApplicationCommandOptionTypes,
|
||||
ApplicationCommandOptionChoice,
|
||||
} from './application-command';
|
||||
import type { DiscordBase, Snowflake, InteractionTypes, Locales } from './common';
|
||||
import type {
|
||||
DiscordSelectMenuOption,
|
||||
MessageComponentTypes,
|
||||
DiscordMessageComponents,
|
||||
DiscordActionRowComponent,
|
||||
DiscordTextInput,
|
||||
} from './message-component';
|
||||
import type { DiscordUser } from './user';
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure */
|
||||
export interface DiscordInteraction extends DiscordBase {
|
||||
/** ID of the application this interaction is for */
|
||||
application_id: Snowflake;
|
||||
/** Type of interaction */
|
||||
type: InteractionTypes;
|
||||
/** Guild that the interaction was sent from */
|
||||
guild_id?: Snowflake;
|
||||
/** Channel that the interaction was sent from */
|
||||
channel_id?: Snowflake;
|
||||
/** Continuation token for responding to the interaction */
|
||||
token: string;
|
||||
/** Read-only property, always 1 */
|
||||
readonly version: number;
|
||||
/** Bitwise set of permissions the app or bot has within the channel the interaction was sent from */
|
||||
app_permissions?: string;
|
||||
/** Selected language of the invoking user */
|
||||
locale?: `${Locales}`;
|
||||
/** Guild's preferred locale, if invoked in a guild */
|
||||
guild_locale?: `${Locales}`;
|
||||
}
|
||||
|
||||
export interface DiscordInteractionWithMember extends DiscordInteraction {
|
||||
/** Guild member data for the invoking user, including permissions */
|
||||
member: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface DiscordInteractionWithUser extends DiscordInteraction {
|
||||
/** User object for the invoking user, if invoked in a DM */
|
||||
user: DiscordUser;
|
||||
}
|
||||
|
||||
export interface DiscordApplicationCommandInteraction extends DiscordInteraction {
|
||||
type: InteractionTypes.ApplicationCommand;
|
||||
/** Interaction data payload */
|
||||
data?: DiscordApplicationCommandInteractionData;
|
||||
}
|
||||
|
||||
export interface DiscordComponentInteraction extends DiscordInteraction {
|
||||
type: InteractionTypes.MessageComponent;
|
||||
/** the message they were attached to */
|
||||
message: Record<string, any>;
|
||||
/** Interaction data payload */
|
||||
data?: DiscordMessageComponentInteractionData | DiscordMessageSelectMenuInteractionData;
|
||||
}
|
||||
|
||||
export type DiscordComponentInteractionWithUser = DiscordComponentInteraction & { user: DiscordUser };
|
||||
|
||||
export type DiscordComponentInteractionWithMember = DiscordComponentInteraction & { member: any };
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure */
|
||||
|
||||
export interface DiscordMessageInteraction extends DiscordBase {
|
||||
type: InteractionTypes;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type DiscordMessageInteractionWithUser = DiscordComponentInteraction & { user: DiscordUser };
|
||||
|
||||
export type DiscordMessageInteractionWithMember = DiscordComponentInteraction & { member: any };
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure */
|
||||
export interface DiscordApplicationCommandInteractionData extends DiscordBase {
|
||||
/** the name of the invoked command */
|
||||
name: string;
|
||||
/** the type of the invoked command */
|
||||
type: ApplicationCommandTypes;
|
||||
/** converted users + roles + channels + attachments */
|
||||
resolved?: DiscordInteractionCommandDataResolved;
|
||||
/** the params + values from the user */
|
||||
options?: DiscordApplicationCommandInteractionDataOption[];
|
||||
/** the id of the guild the command is registered to */
|
||||
guild_id?: Snowflake;
|
||||
/** id of the user or message targeted by a user or message command */
|
||||
target_id?: Snowflake;
|
||||
}
|
||||
|
||||
export interface DiscordInteractionCommandAutocompleteData
|
||||
extends Omit<DiscordApplicationCommandInteractionData, 'options'> {
|
||||
options?: Partial<DiscordApplicationCommandInteractionDataOption>[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-interaction-data-option-structure */
|
||||
export interface DiscordApplicationCommandInteractionDataOption {
|
||||
/** Name of the parameter */
|
||||
name: string;
|
||||
/** Value of application command option type */
|
||||
type: ApplicationCommandOptionTypes;
|
||||
/** Value of the option resulting from user input */
|
||||
value?: string | number;
|
||||
/** Present if this option is a group or subcommand */
|
||||
options?: DiscordApplicationCommandInteractionDataOption[];
|
||||
/** true if this option is the currently focused option for autocomplete */
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-message-component-data-structure */
|
||||
export interface DiscordMessageComponentInteractionData {
|
||||
/** the custom_id of the component */
|
||||
custom_id: string;
|
||||
/** the type of the component */
|
||||
component_type: MessageComponentTypes;
|
||||
}
|
||||
|
||||
export interface DiscordMessageSelectMenuInteractionData extends DiscordMessageComponentInteractionData {
|
||||
component_type: MessageComponentTypes.SelectMenu;
|
||||
/** values the user selected in a select menu component */
|
||||
values: DiscordSelectMenuOption[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure */
|
||||
export interface DIscordModalSubmitData {
|
||||
custom_id: string;
|
||||
components: DiscordMessageComponents;
|
||||
}
|
||||
|
||||
// TODO object types
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure */
|
||||
export interface DiscordInteractionCommandDataResolved {
|
||||
/** the ids and User objects */
|
||||
users?: Record<Snowflake, DiscordUser>;
|
||||
/** the ids and partial Member objects */
|
||||
members?: Record<string, any>;
|
||||
/** the ids and Role objects */
|
||||
roles?: Record<string, any>;
|
||||
/** the ids and partial Channel objects */
|
||||
channels?: Record<string, any>;
|
||||
/** the ids and partial Message objects */
|
||||
messages?: Record<string, any>;
|
||||
/** the ids and attachment objects */
|
||||
attachments?: Record<string, any>;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-response-structure */
|
||||
export interface DiscordInteractionResponse {
|
||||
/** the type of response */
|
||||
type: InteractionResponseTypes;
|
||||
}
|
||||
|
||||
export interface DiscordInteractionMessageResponse extends DiscordInteractionResponse {
|
||||
type: InteractionResponseTypes.ChannelMessageWithSource | InteractionResponseTypes.UpdateMessage;
|
||||
/** an optional response message */
|
||||
data: DiscordInteractionMessages;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-autocomplete */
|
||||
export interface DiscordinteractionAutoCompleteResponse extends DiscordInteractionResponse {
|
||||
type: InteractionResponseTypes.ApplicationCommandAutocompleteResult;
|
||||
/** autocomplete choices (max of 25 choices) */
|
||||
choices: ApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal */
|
||||
export interface DiscordInteractionModalResponse extends DiscordInteractionResponse {
|
||||
type: InteractionResponseTypes.Modal;
|
||||
/** a developer-defined identifier for the component, max 100 characters */
|
||||
custom_id: string;
|
||||
/** the title of the popup modal, max 45 characters */
|
||||
title: string;
|
||||
/**
|
||||
* between 1 and 5 (inclusive) components that make up the modal
|
||||
* Support for components in modals is currently limited to type 4 (Text Input).
|
||||
*/
|
||||
components: DiscordTextInput[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-messages */
|
||||
export interface DiscordInteractionMessages {
|
||||
/** is the response TTS */
|
||||
tts?: boolean;
|
||||
/** message content */
|
||||
content?: string;
|
||||
/** supports up to 10 embeds */
|
||||
embeds?: any[];
|
||||
/** allowed mentions object */
|
||||
allowed_mentions: Record<string, any[]>;
|
||||
/** message flags combined as a bitfield */
|
||||
flags?: 64 | 4;
|
||||
/** message components */
|
||||
components?: DiscordActionRowComponent[];
|
||||
/** attachment objects with filename and description */
|
||||
attachments?: Partial<any>[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type */
|
||||
export enum InteractionResponseTypes {
|
||||
/** ACK a `Ping` */
|
||||
Pong = 1,
|
||||
/** Respond to an interaction with a message */
|
||||
ChannelMessageWithSource = 4,
|
||||
/** ACK an interaction and edit a response later, the user sees a loading state */
|
||||
DeferredChannelMessageWithSource = 5,
|
||||
/** For components, ACK an interaction and edit the original message later; the user does not see a loading state */
|
||||
DeferredUpdateMessage = 6,
|
||||
/** For components, edit the message the component was attached to */
|
||||
UpdateMessage = 7,
|
||||
/** For Application Command Options, send an autocomplete result */
|
||||
ApplicationCommandAutocompleteResult = 8,
|
||||
/** For Command or Component interactions, send a Modal response */
|
||||
Modal = 9,
|
||||
}
|
125
packages/api-types/src/v10/message-component.ts
Normal file
125
packages/api-types/src/v10/message-component.ts
Normal file
@ -0,0 +1,125 @@
|
||||
import type { DiscordPartialEmoji } from './common';
|
||||
|
||||
export interface BaseComponent {
|
||||
/** type of the component */
|
||||
type: MessageComponentTypes;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#action-rows */
|
||||
export interface DiscordActionRow<T extends BaseComponent> extends BaseComponent {
|
||||
type: MessageComponentTypes.ActionRow;
|
||||
components: T[];
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#buttons */
|
||||
export interface DiscordButton extends BaseComponent {
|
||||
type: MessageComponentTypes.Button;
|
||||
/** one of button styles */
|
||||
style: ButtonStyles;
|
||||
/** text that appears on the button, max 80 characters */
|
||||
label?: string;
|
||||
/** name, id, and animated */
|
||||
emoji?: DiscordPartialEmoji;
|
||||
/** a developer-defined identifier for the button, max 100 characters */
|
||||
custom_id?: string;
|
||||
/** whether the button is disabled (default false) */
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface DiscordButtonLink extends Omit<DiscordButton, 'custom_id'> {
|
||||
/** a url for link-style buttons */
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#select-menu-object */
|
||||
export interface DiscordSelectMenu extends BaseComponent {
|
||||
type: MessageComponentTypes.SelectMenu;
|
||||
/** a developer-defined identifier for the select menu, max 100 characters */
|
||||
custom_id: string;
|
||||
/** the choices in the select, max 25 */
|
||||
options: DiscordSelectMenuOption[];
|
||||
/** custom placeholder text if nothing is selected, max 150 characters */
|
||||
placeholder?: string;
|
||||
/** the minimum number of items that must be chosen; default 1, min 0*/
|
||||
min_values?: number;
|
||||
/** the maximum number of items that can be chosen; default 1, max 25 */
|
||||
max_values?: number;
|
||||
/** disable the select, default false */
|
||||
disabled?: boolean;
|
||||
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */
|
||||
export interface DiscordSelectMenuOption {
|
||||
/** the user-facing name of the option, max 100 characters */
|
||||
label: string;
|
||||
/** the dev-defined value of the option, max 100 characters */
|
||||
value: string;
|
||||
/** an additional description of the option, max 100 characters */
|
||||
description?: string;
|
||||
/** id, name, and animated */
|
||||
emoji?: DiscordPartialEmoji;
|
||||
/** will render this option as selected by default */
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure */
|
||||
export interface DiscordTextInput extends BaseComponent {
|
||||
type: MessageComponentTypes.TextInput;
|
||||
/** a developer-defined identifier for the input, max 100 characters */
|
||||
custom_id?: string;
|
||||
/** the Text Input Style */
|
||||
style: TextInputStyles;
|
||||
/** the label for this component, max 45 characters */
|
||||
label: string;
|
||||
/** the minimum input length for a text input, min 0, max 4000 */
|
||||
min_length?: number;
|
||||
/** the maximum input length for a text input, min 1, max 4000 */
|
||||
max_length?: number;
|
||||
/** whether this component is required to be filled, default true */
|
||||
required?: boolean;
|
||||
/** a pre-filled value for this component, max 4000 characters */
|
||||
value?: string;
|
||||
/** custom placeholder text if the input is empty, max 100 characters */
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export type DiscordMessageComponentsWithoutRow = DiscordButton | DiscordSelectMenu | DiscordTextInput;
|
||||
|
||||
export type DiscordActionRowComponent = DiscordActionRow<DiscordMessageComponentsWithoutRow>;
|
||||
|
||||
export type DiscordMessageComponents = DiscordActionRowComponent | DiscordButton | DiscordSelectMenu | DiscordTextInput;
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#component-types */
|
||||
export enum MessageComponentTypes {
|
||||
/** A container for other components */
|
||||
ActionRow = 1,
|
||||
/** A button object */
|
||||
Button,
|
||||
/** A select menu for picking from choices */
|
||||
SelectMenu,
|
||||
/** A text input object */
|
||||
TextInput,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#button-object-button-styles */
|
||||
export enum ButtonStyles {
|
||||
/** blurple */
|
||||
Primary = 1,
|
||||
/** grey */
|
||||
Secondary,
|
||||
/** green */
|
||||
Success,
|
||||
/** red */
|
||||
Danger,
|
||||
/** grey, navigates to a URL */
|
||||
Link,
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles */
|
||||
export enum TextInputStyles {
|
||||
/** A single-line input */
|
||||
Short = 1,
|
||||
/** A multi-line input */
|
||||
Paragraph
|
||||
}
|
86
packages/api-types/src/v10/user.ts
Normal file
86
packages/api-types/src/v10/user.ts
Normal file
@ -0,0 +1,86 @@
|
||||
import type { DiscordBase, Locales, PremiumTypes, VisibilityTypes } from './common';
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/user#user-object-user-structure */
|
||||
export interface DiscordUser extends DiscordBase {
|
||||
/** the user's username, not unique across the platform */
|
||||
username: string;
|
||||
/** the user's 4-digit discord-tag */
|
||||
discriminator: string;
|
||||
/** the user's avatar hash */
|
||||
avatar: string | null;
|
||||
/** whether the user belongs to an OAuth2 application */
|
||||
bot?: boolean;
|
||||
/** whether the user is an Official Discord System user (part of the urgent message system) */
|
||||
system?: boolean;
|
||||
/** the user's banner hash */
|
||||
banner?: string | null;
|
||||
/** the user's banner color encoded as an integer representation of hexadecimal color code */
|
||||
accent_color?: number | null;
|
||||
/** the public flags on a user's account */
|
||||
public_flags?: number;
|
||||
}
|
||||
|
||||
export interface DiscordUserOAUTH2 extends DiscordUser {
|
||||
/** whether the user has two factor enabled on their account */
|
||||
mfa_enabled?: boolean;
|
||||
/** the user's chosen language option */
|
||||
locale: `${Locales}`;
|
||||
/** the flags on a user's account */
|
||||
flags?: number;
|
||||
/** the type of Nitro subscription on a user's account */
|
||||
premium_type?: PremiumTypes;
|
||||
}
|
||||
|
||||
export interface DiscordUserWithOAUTH2Email extends DiscordUserOAUTH2 {
|
||||
/** whether the email on this account has been verified */
|
||||
verified?: boolean;
|
||||
/** the user's email */
|
||||
email?: string | null;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/user#connection-object-connection-structure */
|
||||
|
||||
export interface DiscordConnection {
|
||||
/** id of the connection account */
|
||||
id: string;
|
||||
/** the username of the connection account */
|
||||
name: string;
|
||||
/** the service of this connection */
|
||||
type: keyof typeof DiscordServices;
|
||||
/** whether the connection is revoked */
|
||||
revoked?: boolean;
|
||||
/** an array of partial server integrations */
|
||||
integrations?: any[]; // server integrations object
|
||||
/** whether the connection is verified */
|
||||
verified: boolean;
|
||||
/** whether friend sync is enabled for this connection */
|
||||
friend_sync: boolean;
|
||||
/** whether activities related to this connection will be shown in presence updates */
|
||||
show_activity: boolean;
|
||||
/** whether this connection has a corresponding third party OAuth2 token */
|
||||
two_way_link: boolean;
|
||||
/** visibility of this connection */
|
||||
visibility: VisibilityTypes;
|
||||
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/user#connection-object-services */
|
||||
export enum DiscordServices {
|
||||
battlenet = 'Battle.net',
|
||||
ebay = 'eBay',
|
||||
epicgames = 'Epic Games',
|
||||
facebook = 'Facebook',
|
||||
github = 'GitHub',
|
||||
leagueoflegends = 'League of Legends',
|
||||
paypal = 'Paypal',
|
||||
playstation = 'PlayStation Network',
|
||||
reddit = 'Reddit',
|
||||
riotgames = 'Riot Games',
|
||||
spotify = 'Spotify',
|
||||
skype = 'Skype',
|
||||
steam = 'Steam',
|
||||
twitch = 'Twitch',
|
||||
twitter = 'Twitter',
|
||||
xbox = 'Xbox',
|
||||
youtube = 'YouTube'
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
"include": ["src/**/**/*"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user