Skip to main content
Module

x/discord_api_types/payloads/v9/channel.ts

Up to date Discord API Typings, versioned by the API version
Go to Latest
File
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181
/** * Types extracted from https://discord.com/developers/docs/resources/channel */
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 type { APIApplication } from './application.ts';import type { APIRole } from './permissions.ts';import type { APISticker, APIStickerItem } from './sticker.ts';import type { APIUser } from './user.ts';
/** * Not documented, but partial only includes id, name, and type */export interface APIPartialChannel { /** * The id of the channel */ id: Snowflake; /** * The type of the channel * * See https://discord.com/developers/docs/resources/channel#channel-object-channel-types */ type: ChannelType; /** * The name of the channel (2-100 characters) */ name?: string;}
/** * https://discord.com/developers/docs/resources/channel#channel-object-channel-structure */export interface APIChannel extends APIPartialChannel { /** * The id of the guild (may be missing for some channel objects received over gateway guild dispatches) */ guild_id?: Snowflake; /** * Sorting position of the channel */ position?: number; /** * Explicit permission overwrites for members and roles * * See https://discord.com/developers/docs/resources/channel#overwrite-object */ permission_overwrites?: APIOverwrite[]; /** * The channel topic (0-1024 characters) */ topic?: string | null; /** * Whether the channel is nsfw */ nsfw?: boolean; /** * The id of the last message sent in this channel (may not point to an existing or valid message) */ last_message_id?: Snowflake | null; /** * The bitrate (in bits) of the voice channel */ bitrate?: number; /** * The user limit of the voice channel */ user_limit?: number; /** * Amount of seconds a user has to wait before sending another message (0-21600); * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected */ rate_limit_per_user?: number; /** * The recipients of the DM * * See https://discord.com/developers/docs/resources/user#user-object */ recipients?: APIUser[]; /** * Icon hash */ icon?: string | null; /** * ID of the DM creator or thread creator */ owner_id?: Snowflake; /** * Application id of the group DM creator if it is bot-created */ application_id?: Snowflake; /** * ID of the parent category for a channel (each parent category can contain up to 50 channels) * * OR * * ID of the parent channel for a thread */ parent_id?: Snowflake | null; /** * When the last pinned message was pinned. * This may be `null` in events such as `GUILD_CREATE` when a message is not pinned */ last_pin_timestamp?: string | null; /** * Voice region id for the voice or stage channel, automatic when set to `null` * * See https://discord.com/developers/docs/resources/voice#voice-region-object */ rtc_region?: string | null; /** * The camera video quality mode of the voice channel, `1` when not present * * See https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes */ video_quality_mode?: VideoQualityMode; /** * The approximate message count of the thread, does not count above 50 even if there are more messages */ message_count?: number; /** * The approximate member count of the thread, does not count above 50 even if there are more members */ member_count?: number; /** * The metadata for a thread channel not shared by other channels */ thread_metadata?: APIThreadMetadata; /** * The client users member for the thread, only included in select endpoints */ member?: APIThreadMember; /** * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity */ default_auto_archive_duration?: ThreadAutoArchiveDuration;}
/** * https://discord.com/developers/docs/resources/channel#channel-object-channel-types */export enum ChannelType { /** * A text channel within a guild */ GuildText, /** * A direct message between users */ DM, /** * A voice channel within a guild */ GuildVoice, /** * A direct message between multiple users */ GroupDM, /** * An organizational category that contains up to 50 channels * * See https://support.discord.com/hc/en-us/articles/115001580171-Channel-Categories-101 */ GuildCategory, /** * A channel that users can follow and crosspost into their own guild * * See https://support.discord.com/hc/en-us/articles/360032008192 */ GuildNews, /** * A channel in which game developers can sell their game on Discord * * See https://discord.com/developers/docs/game-and-server-management/special-channels */ GuildStore, /** * A thread channel (public) within a Guild News channel */ GuildNewsThread = 10, /** * A public thread channel within a Guild Text channel */ GuildPublicThread, /** * A private thread channel within a Guild Text channel */ GuildPrivateThread, /** * A voice channel for hosting events with an audience * * See https://support.discord.com/hc/en-us/articles/1500005513722 */ GuildStageVoice,}
export enum VideoQualityMode { /** * Discord chooses the quality for optimal performance */ Auto = 1, /** * 720p */ Full,}
/** * https://discord.com/developers/docs/resources/channel#message-object-message-structure */export interface APIMessage { /** * ID of the message */ id: Snowflake; /** * ID of the channel the message was sent in */ channel_id: Snowflake; /** * ID of the guild the message was sent in */ guild_id?: Snowflake; /** * The author of this message (only a valid user in the case where the message is generated by a user or bot user) * * If the message is generated by a webhook, the author object corresponds to the webhook's id, * username, and avatar. You can tell if a message is generated by a webhook by checking for the `webhook_id` property * * See https://discord.com/developers/docs/resources/user#user-object */ author: APIUser; /** * Member properties for this message's author * * The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events * from text-based guild channels * * See https://discord.com/developers/docs/resources/guild#guild-member-object */ member?: APIGuildMember; /** * Contents of the message */ content: string; /** * When this message was sent */ timestamp: string; /** * When this message was edited (or null if never) */ edited_timestamp: string | null; /** * Whether this was a TTS message */ tts: boolean; /** * Whether this message mentions everyone */ mention_everyone: boolean; /** * Users specifically mentioned in the message * * The `member` field is only present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events * from text-based guild channels * * See https://discord.com/developers/docs/resources/user#user-object * See https://discord.com/developers/docs/resources/guild#guild-member-object */ mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[]; /** * Roles specifically mentioned in this message * * See https://discord.com/developers/docs/topics/permissions#role-object */ mention_roles: APIRole['id'][]; /** * Channels specifically mentioned in this message * * Not all channel mentions in a message will appear in `mention_channels`. * - Only textual channels that are visible to everyone in a lurkable guild will ever be included * - Only crossposted messages (via Channel Following) currently include `mention_channels` at all * * If no mentions in the message meet these requirements, this field will not be sent * * See https://discord.com/developers/docs/resources/channel#channel-mention-object */ mention_channels?: APIChannelMention[]; /** * Any attached files * * See https://discord.com/developers/docs/resources/channel#attachment-object */ attachments: APIAttachment[]; /** * Any embedded content * * See https://discord.com/developers/docs/resources/channel#embed-object */ embeds: APIEmbed[]; /** * Reactions to the message * * See https://discord.com/developers/docs/resources/channel#reaction-object */ reactions?: APIReaction[]; /** * A nonce that can be used for optimistic message sending (up to 25 characters) * * **You will not receive this from further fetches. This is received only once from a `MESSAGE_CREATE` * event to ensure it got sent** */ nonce?: string | number; /** * Whether this message is pinned */ pinned: boolean; /** * If the message is generated by a webhook, this is the webhook's id */ webhook_id?: Snowflake; /** * Type of message * * See https://discord.com/developers/docs/resources/channel#message-object-message-types */ type: MessageType; /** * Sent with Rich Presence-related chat embeds * * See https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */ activity?: APIMessageActivity; /** * Sent with Rich Presence-related chat embeds * * See https://discord.com/developers/docs/resources/channel#message-object-message-application-structure */ application?: Partial<APIApplication>; /** * If the message is a response to an Interaction, this is the id of the interaction's application */ application_id?: Snowflake; /** * Reference data sent with crossposted messages, replies, pins, and thread starter messages * * See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure */ message_reference?: APIMessageReference; /** * Message flags combined as a bitfield * * See https://discord.com/developers/docs/resources/channel#message-object-message-flags * * See https://en.wikipedia.org/wiki/Bit_field */ flags?: MessageFlags; /** * The message associated with the `message_reference` * * This field is only returned for messages with a `type` of `19` (REPLY). * * If the message is a reply but the `referenced_message` field is not present, * the backend did not attempt to fetch the message that was being replied to, * so its state is unknown. * * If the field exists but is `null`, the referenced message was deleted * * See https://discord.com/developers/docs/resources/channel#message-object */ referenced_message?: APIMessage | null; /** * 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 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[];}
/** * https://discord.com/developers/docs/resources/channel#message-object-message-types */export enum MessageType { Default, RecipientAdd, RecipientRemove, Call, ChannelNameChange, ChannelIconChange, ChannelPinnedMessage, GuildMemberJoin, UserPremiumGuildSubscription, UserPremiumGuildSubscriptionTier1, UserPremiumGuildSubscriptionTier2, UserPremiumGuildSubscriptionTier3, ChannelFollowAdd, GuildDiscoveryDisqualified = 14, GuildDiscoveryRequalified, GuildDiscoveryGracePeriodInitialWarning, GuildDiscoveryGracePeriodFinalWarning, ThreadCreated, Reply, ApplicationCommand, ThreadStarterMessage, GuildInviteReminder,}
/** * https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */export interface APIMessageActivity { /** * Type of message activity * * See https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */ type: MessageActivityType; /** * `party_id` from a Rich Presence event * * See https://discord.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields */ party_id?: string;}
/** * https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure */export interface APIMessageReference { /** * ID of the originating message */ message_id?: Snowflake; /** * ID of the originating message's channel */ channel_id: Snowflake; /** * ID of the originating message's guild */ guild_id?: Snowflake;}
/** * https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */export enum MessageActivityType { Join = 1, Spectate, Listen, JoinRequest = 5,}
/** * https://discord.com/developers/docs/resources/channel#message-object-message-flags */export enum MessageFlags { /** * This message has been published to subscribed channels (via Channel Following) */ Crossposted = 1 << 0, /** * This message originated from a message in another channel (via Channel Following) */ IsCrosspost = 1 << 1, /** * Do not include any embeds when serializing this message */ SuppressEmbeds = 1 << 2, /** * The source message for this crosspost has been deleted (via Channel Following) */ SourceMessageDeleted = 1 << 3, /** * This message came from the urgent message system */ Urgent = 1 << 4, /** * This message has an associated thread, which shares its id */ HasThread = 1 << 5, /** * This message is only visible to the user who invoked the Interaction */ Ephemeral = 1 << 6, /** * This message is an Interaction Response and the bot is "thinking" */ Loading = 1 << 7,}
/** * https://discord.com/developers/docs/resources/channel#followed-channel-object */export interface APIFollowedChannel { /** * Source channel id */ channel_id: Snowflake; /** * Created target webhook id */ webhook_id: Snowflake;}
/** * https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure */export interface APIReaction { /** * Times this emoji has been used to react */ count: number; /** * Whether the current user reacted using this emoji */ me: boolean; /** * Emoji information * * See https://discord.com/developers/docs/resources/emoji#emoji-object */ emoji: APIPartialEmoji;}
/** * https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure */export interface APIOverwrite { /** * Role or user id */ id: Snowflake; /** * Either 0 (role) or 1 (member) * * {@link OverwriteType} */ type: OverwriteType; /** * Permission bit set * * See https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags * * See https://en.wikipedia.org/wiki/Bit_field */ allow: Permissions; /** * Permission bit set * * See https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags * * See https://en.wikipedia.org/wiki/Bit_field */ deny: Permissions;}
export enum OverwriteType { Role, Member,}
/** * https://discord.com/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure */export interface APIThreadMetadata { /** * Whether the thread is archived */ archived: boolean; /** * Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */ auto_archive_duration: ThreadAutoArchiveDuration; /** * An ISO8601 timestamp when the thread's archive status was last changed, used for calculating recent activity */ archive_timestamp: string; /** * Whether the thread is locked; when a thread is locked, only users with `MANAGE_THREADS` can unarchive it */ locked?: boolean;}
export enum ThreadAutoArchiveDuration { OneHour = 60, OneDay = 1440, ThreeDays = 4320, OneWeek = 10080,}
/** * https://discord.com/developers/docs/resources/channel#thread-member-object-thread-member-structure */export interface APIThreadMember { /** * The id of the thread * * **This field is omitted on the member sent within each thread in the `GUILD_CREATE` event** */ id?: Snowflake; /** * The id of the member * * **This field is omitted on the member sent within each thread in the `GUILD_CREATE` event** */ user_id?: Snowflake; /** * An ISO8601 timestamp for when the member last joined */ join_timestamp: string; /** * Member flags combined as a bitfield * * See https://en.wikipedia.org/wiki/Bit_field */ flags: ThreadMemberFlags;}
export enum ThreadMemberFlags {}
export interface APIThreadList { /** * The threads that were fetched */ threads: APIChannel[]; /** * The members for the client user in each of the fetched threads */ members: APIThreadMember[]; /** * Whether there are potentially additional threads */ has_more?: boolean;}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-structure * * Length limit: 6000 characters */export interface APIEmbed { /** * Title of embed * * Length limit: 256 characters */ title?: string; /** * Type of embed (always "rich" for webhook embeds) * * @deprecated *Embed types should be considered deprecated and might be removed in a future API version* * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-types */ type?: EmbedType; /** * Description of embed * * Length limit: 4096 characters */ description?: string; /** * URL of embed */ url?: string; /** * Timestamp of embed content */ timestamp?: string; /** * Color code of the embed */ color?: number; /** * Footer information * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */ footer?: APIEmbedFooter; /** * Image information * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */ image?: APIEmbedImage; /** * Thumbnail information * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */ thumbnail?: APIEmbedThumbnail; /** * Video information * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */ video?: APIEmbedVideo; /** * Provider information * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */ provider?: APIEmbedProvider; /** * Author information * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */ author?: APIEmbedAuthor; /** * Fields information * * Length limit: 25 field objects * * See https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */ fields?: APIEmbedField[];}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-types * @deprecated *Embed types should be considered deprecated and might be removed in a future API version* */export enum EmbedType { /** * Generic embed rendered from embed attributes */ Rich = 'rich', /** * Image embed */ Image = 'image', /** * Video embed */ Video = 'video', /** * Animated gif image embed rendered as a video embed */ GIFV = 'gifv', /** * Article embed */ Article = 'article', /** * Link embed */ Link = 'link',}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */export interface APIEmbedThumbnail { /** * Source url of thumbnail (only supports http(s) and attachments) */ url?: string; /** * A proxied url of the thumbnail */ proxy_url?: string; /** * Height of thumbnail */ height?: number; /** * Width of thumbnail */ width?: number;}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */export interface APIEmbedVideo { /** * Source url of video */ url?: string; /** * Height of video */ height?: number; /** * Width of video */ width?: number;}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */export interface APIEmbedImage { /** * Source url of image (only supports http(s) and attachments) */ url?: string; /** * A proxied url of the image */ proxy_url?: string; /** * Height of image */ height?: number; /** * Width of image */ width?: number;}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */export interface APIEmbedProvider { /** * Name of provider */ name?: string; /** * URL of provider */ url?: string;}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */export interface APIEmbedAuthor { /** * Name of author * * Length limit: 256 characters */ name?: string; /** * URL of author */ url?: string; /** * URL of author icon (only supports http(s) and attachments) */ icon_url?: string; /** * A proxied url of author icon */ proxy_icon_url?: string;}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */export interface APIEmbedFooter { /** * Footer text * * Length limit: 2048 characters */ text: string; /** * URL of footer icon (only supports http(s) and attachments) */ icon_url?: string; /** * A proxied url of footer icon */ proxy_icon_url?: string;}
/** * https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */export interface APIEmbedField { /** * Name of the field * * Length limit: 256 characters */ name: string; /** * Value of the field * * Length limit: 1024 characters */ value: string; /** * Whether or not this field should display inline */ inline?: boolean;}
/** * https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure */export interface APIAttachment { /** * Attachment id */ id: Snowflake; /** * Name of file attached */ filename: string; /** * The attachment's media type * * See https://en.wikipedia.org/wiki/Media_type */ content_type?: string; /** * Size of file in bytes */ size: number; /** * Source url of file */ url: string; /** * A proxied url of file */ proxy_url: string; /** * Height of file (if image) */ height?: number | null; /** * Width of file (if image) */ width?: number | null;}
/** * https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure */export interface APIChannelMention { /** * ID of the channel */ id: Snowflake; /** * ID of the guild containing the channel */ guild_id: Snowflake; /** * The type of channel * * See https://discord.com/developers/docs/resources/channel#channel-object-channel-types */ type: ChannelType; /** * The name of the channel */ name: string;}
/** * https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */export enum AllowedMentionsTypes { /** * Controls @everyone and @here mentions */ Everyone = 'everyone', /** * Controls role mentions */ Role = 'roles', /** * Controls user mentions */ User = 'users',}
/** * https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure */export interface APIAllowedMentions { /** * An array of allowed mention types to parse from the content * * See https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */ parse?: AllowedMentionsTypes[]; /** * Array of role_ids to mention (Max size of 100) */ roles?: Snowflake[]; /** * Array of user_ids to mention (Max size of 100) */ users?: Snowflake[]; /** * For replies, whether to mention the author of the message being replied to (default false) * * @default false */ replied_user?: boolean;}
/** * https://discord.com/developers/docs/interactions/message-components#component-object */export interface APIBaseMessageComponent<T extends ComponentType> { /** * The type of the component */ type: T;}
/** * https://discord.com/developers/docs/interactions/message-components#component-types */export enum ComponentType { /** * Action Row component */ ActionRow = 1, /** * Button component */ Button, /** * Select Menu component */ SelectMenu,}
/** * https://discord.com/developers/docs/interactions/message-components#action-rows */export interface APIActionRowComponent extends APIBaseMessageComponent<ComponentType.ActionRow> { /** * The components in the ActionRow */ components: Exclude<APIMessageComponent, APIActionRowComponent>[];}
/** * https://discord.com/developers/docs/interactions/message-components#buttons */interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessageComponent<ComponentType.Button> { /** * The label to be displayed on the button */ label?: string; /** * The style of the button */ style: Style; /** * The emoji to display to the left of the text */ emoji?: APIPartialEmoji; /** * The status of the button */ disabled?: boolean;}
export interface APIButtonComponentWithCustomId extends APIButtonComponentBase< ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger > { /** * The custom_id to be sent in the interaction when clicked */ custom_id: string;}
export interface APIButtonComponentWithURL extends APIButtonComponentBase<ButtonStyle.Link> { /** * The URL to direct users to when clicked for Link buttons */ url: string;}
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
/** * https://discord.com/developers/docs/interactions/message-components#button-object-button-styles */export enum ButtonStyle { Primary = 1, Secondary, Success, Danger, Link,}
/** * https://discord.com/developers/docs/interactions/message-components#select-menus */export interface APISelectMenuComponent extends APIBaseMessageComponent<ComponentType.SelectMenu> { /** * A developer-defined identifier for the select menu, max 100 characters */ custom_id: string; /** * The choices in the select, max 25 */ options: APISelectMenuOption[]; /** * Custom placeholder text if nothing is selected, max 100 characters */ placeholder?: string; /** * The minimum number of items that must be chosen; min 0, max 25 * * @default 1 */ min_values?: number; /** * The maximum number of items that can be chosen; max 25 * * @default 1 */ max_values?: number; /** * Disable the select * * @default false */ disabled?: boolean;}
/** * https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */export interface APISelectMenuOption { /** * The user-facing name of the option (max 25 chars) */ label: string; /** * The dev-defined value of the option (max 100 chars) */ value: string; /** * An additional description of the option (max 50 chars) */ description?: string; /** * The emoji to display to the left of the option */ emoji?: APIPartialEmoji; /** * Whether this option should be already-selected by default */ default?: boolean;}
/** * https://discord.com/developers/docs/interactions/message-components#message-components */export type APIMessageComponent = APIActionRowComponent | APIButtonComponent | APISelectMenuComponent;