Skip to main content
Module

x/discord_api_types/v8/payloads/channel.ts

Up to date Discord API Typings, versioned by the API version
Go to Latest
File
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
/** * Types extracted from https://discord.com/developers/docs/resources/channel */
import type { Permissions, Snowflake } from '../../common/mod.ts';import type { APIPartialEmoji } from './emoji.ts';import type { APIGuildMember } from './guild.ts';import type { APIMessageInteraction } from './interactions.ts';import type { APIRole } from './permissions.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 */ 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 */ 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) */ 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;}
/** * https://discord.com/developers/docs/resources/channel#channel-object-channel-types */export enum ChannelType { /** * A text channel within a guild */ GUILD_TEXT = 0, /** * A direct message between users */ DM, /** * A voice channel within a guild */ GUILD_VOICE, /** * A direct message between multiple users */ GROUP_DM, /** * An organizational category that contains up to 50 channels * * See https://support.discord.com/hc/en-us/articles/115001580171-Channel-Categories-101 */ GUILD_CATEGORY, /** * A channel that users can follow and crosspost into their own guild * * See https://support.discord.com/hc/en-us/articles/360032008192 */ GUILD_NEWS, /** * A channel in which game developers can sell their game on Discord * * See https://discord.com/developers/docs/game-and-server-management/special-channels */ GUILD_STORE,}
/** * 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[]; /** * Used for validating a message was sent * * **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?: APIMessageApplication; /** * Reference data sent with crossposted messages and replies * * 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 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` * * 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;}
/** * https://discord.com/developers/docs/resources/channel#message-object-message-types */export enum MessageType { DEFAULT, RECIPIENT_ADD, RECIPIENT_REMOVE, CALL, CHANNEL_NAME_CHANGE, CHANNEL_ICON_CHANGE, CHANNEL_PINNED_MESSAGE, GUILD_MEMBER_JOIN, USER_PREMIUM_GUILD_SUBSCRIPTION, USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1, USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2, USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3, CHANNEL_FOLLOW_ADD, GUILD_DISCOVERY_DISQUALIFIED = 14, GUILD_DISCOVERY_REQUALIFIED, GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING, GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING, REPLY = 19, APPLICATION_COMMAND,}
/** * 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-application-structure */export interface APIMessageApplication { /** * ID of the application */ id: Snowflake; /** * ID of the embed's image asset */ cover_image?: string; /** * Application's description */ description: string; /** * ID of the application's icon */ icon: string | null; /** * Name of the application */ name: 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, JOIN_REQUEST = 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) */ IS_CROSSPOST = 1 << 1, /** * Do not include any embeds when serializing this message */ SUPPRESS_EMBEDS = 1 << 2, /** * The source message for this crosspost has been deleted (via Channel Following) */ SOURCE_MESSAGE_DELETED = 1 << 3, /** * This message came from the urgent message system */ URGENT = 1 << 4, EPHEMERAL = 1 << 6,}
/** * 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; /** * Sticker preview asset hash */ preview_asset: string | null; /** * 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 */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#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: 2048 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; /** * 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;}