fix(types)!: Split and fix discordeno.ts (#4301)

* fix(types)!: Split and fix discordeno.ts

* fix some mistakes

* remove now not needed @ts-expect-error

* Apply code review suggestions

* Fix test type errors

* Revert "Apply code review suggestions"

This reverts commit 7a0cea84b3.

* Restore some of the changes from the revert

---------

Co-authored-by: Link <lts20050703@gmail.com>
This commit is contained in:
Fleny
2025-08-14 18:37:52 +02:00
committed by GitHub
parent d50d47ec99
commit 65cbe5d1e6
30 changed files with 2168 additions and 1950 deletions

View File

@@ -12,8 +12,12 @@ export function transformCreateApplicationCommandToDiscordCreateApplicationComma
description: '',
description_localizations: {},
type: payload.type,
default_member_permissions: payload.defaultMemberPermissions ? calculateBits(payload.defaultMemberPermissions) : null,
dm_permission: payload.dmPermission,
default_member_permissions: payload.defaultMemberPermissions
? typeof payload.defaultMemberPermissions === 'string'
? payload.defaultMemberPermissions
: calculateBits(payload.defaultMemberPermissions)
: null,
dm_permission: payload.dmPermission ?? undefined,
}
}
@@ -24,7 +28,11 @@ export function transformCreateApplicationCommandToDiscordCreateApplicationComma
description_localizations: payload.descriptionLocalizations,
type: payload.type,
options: payload.options?.map((option) => bot.transformers.reverse.applicationCommandOption(bot, option as unknown as ApplicationCommandOption)),
default_member_permissions: payload.defaultMemberPermissions ? calculateBits(payload.defaultMemberPermissions) : null,
dm_permission: payload.dmPermission,
default_member_permissions: payload.defaultMemberPermissions
? typeof payload.defaultMemberPermissions === 'string'
? payload.defaultMemberPermissions
: calculateBits(payload.defaultMemberPermissions)
: null,
dm_permission: payload.dmPermission ?? undefined,
}
}

View File

@@ -1806,6 +1806,7 @@ export interface RestManager {
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command}
*/
getGlobalApplicationCommand: (commandId: BigString) => Promise<Camelize<DiscordApplicationCommand>>
// TODO: Add with_localizations query param
/**
* Gets the list of your bot's global application commands.
*
@@ -1847,6 +1848,7 @@ export interface RestManager {
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command}
*/
getGuildApplicationCommand: (commandId: BigString, guildId: BigString) => Promise<Camelize<DiscordApplicationCommand>>
// TODO: Add the with_localizations query param
/**
* Gets the list of application commands registered by your bot in a guild.
*

View File

@@ -77,6 +77,7 @@ describe('Manage reactions', async () => {
const emoji = await rest.createEmoji(e2eCache.guild.id, {
name: 'discordeno',
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
roles: [],
})
after(async () => {
@@ -106,6 +107,7 @@ describe('Manage reactions', async () => {
const emoji = await rest.createEmoji(e2eCache.guild.id, {
name: 'discordeno',
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
roles: [],
})
after(async () => {
@@ -132,6 +134,7 @@ describe('Manage reactions', async () => {
const emoji = await rest.createEmoji(e2eCache.guild.id, {
name: 'discordeno',
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
roles: [],
})
after(async () => {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
/** Types for: https://discord.com/developers/docs/resources/application */
import type {
ApplicationFlags,
DiscordApplicationEventWebhookStatus,
DiscordApplicationIntegrationType,
DiscordInstallParams,
} from '../discord/application.js'
import type { DiscordWebhookEventType } from '../discord/webhookEvents.js'
// TODO: Do we want to move the "All parameters to this endpoint are optional" of this to the rest manager itself?
/** https://discord.com/developers/docs/resources/application#edit-current-application-json-params */
export interface EditApplication {
/** Default custom authorization URL for the app, if enabled */
customInstallUrl?: string
/** Description of the app */
description?: string
/** Role connection verification URL for the app */
roleConnectionsVerificationUrl?: string
/** Settings for the app's default in-app authorization link, if enabled */
installParams?: DiscordInstallParams
/** Default scopes and permissions for each supported installation context. */
integrationTypesConfig?: DiscordApplicationIntegrationType
/**
* App's public flags
*
* @remarks
* Only limited intent flags (`GATEWAY_PRESENCE_LIMITED`, `GATEWAY_GUILD_MEMBERS_LIMITED`, and `GATEWAY_MESSAGE_CONTENT_LIMITED`) can be updated via the API.
*/
flags?: ApplicationFlags
/** Icon for the app */
icon?: string | null
/** Default rich presence invite cover image for the app */
coverImage?: string | null
/**
* Interactions endpoint URL for the app
*
* @remarks
* To update an Interactions endpoint URL via the API, the URL must be valid
*/
interactionEndpointUrl?: string
/**
* List of tags describing the content and functionality of the app (max of 20 characters per tag)
*
* @remarks
* There can only be a max of 5 tags
*/
tags?: string[]
/** Event webhook URL for the app to receive webhook events */
eventWebhooksUrl?: string
/** If webhook events are enabled for the app. 1 to disable, and 2 to enable. */
eventWebhooksStatus: DiscordApplicationEventWebhookStatus
/** List of Webhook event types the app subscribes to */
eventWebhooksTypes?: DiscordWebhookEventType[]
}

View File

@@ -0,0 +1,18 @@
/** Types for: https://discord.com/developers/docs/resources/audit-log */
import type { AuditLogEvents } from '../discord/auditLog.js'
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-params */
export interface GetGuildAuditLog {
/** Entries from a specific user ID */
userId?: BigString
/** Entries for a specific audit log event */
actionType?: AuditLogEvents
/** Entries with ID less than a specific audit log entry ID. */
before?: BigString
/** Entries with ID greater than a specific audit log entry ID. */
after?: BigString
/** Maximum number of entries (between 1-100) to return, defaults to 50 */
limit?: number
}

View File

@@ -0,0 +1,88 @@
/** Types for: https://discord.com/developers/docs/resources/auto-moderation */
import type {
AutoModerationActionType,
AutoModerationEventTypes,
AutoModerationTriggerTypes,
DiscordAutoModerationRuleTriggerMetadata,
} from '../discord/autoModeration.js'
import type { BigString, Camelize } from '../shared.js'
// This needs the prefix Discordeno to avoid conflicts with the @discordeno/bot types.
/** https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure */
export interface DiscordenoAutoModerationAction {
/** The type of action to take when a rule is triggered */
type: AutoModerationActionType
/** additional metadata needed during execution for this specific action type */
metadata?: DiscordenoAutoModerationActionMetadata
}
// This needs the prefix Discordeno to avoid conflicts with the @discordeno/bot types.
/** https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata */
export interface DiscordenoAutoModerationActionMetadata {
/**
* The id of channel to which user content should be logged.
*
* @remarks
* Only for actions of type {@link AutoModerationActionType.SendAlertMessage}.
*/
channelId?: BigString
/**
* Timeout duration in seconds.
*
* @remarks
* Only for actions of type {@link AutoModerationActionType.Timeout}.
*
* Maximum of 2419200 seconds (4 weeks).
*/
durationSeconds?: number
/**
* Additional explanation that will be shown to members whenever their message is blocked.
*
* This may set to undefined if no custom message is provided.
*
* @remarks
* Only for actions of type {@link AutoModerationActionType.BlockMessage}.
*
* Maximum of 150 characters.
*/
customMessage?: string
}
/** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule-json-params */
export interface CreateAutoModerationRuleOptions {
/** The name of the rule. */
name: string
/** The type of event to trigger the rule on. */
eventType: AutoModerationEventTypes
/** The type of trigger to use for the rule. */
triggerType: AutoModerationTriggerTypes
/** The metadata to use for the trigger. */
triggerMetadata: Camelize<DiscordAutoModerationRuleTriggerMetadata>
/** The actions that will trigger for this rule */
actions: DiscordenoAutoModerationAction[]
/** Whether the rule should be enabled, true by default. */
enabled?: boolean
/** The role ids that should not be effected by the rule */
exemptRoles?: BigString[]
/** The channel ids that should not be effected by the rule. */
exemptChannels?: BigString[]
}
/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule-json-params */
export interface EditAutoModerationRuleOptions {
/** The name of the rule. */
name?: string
/** The type of event to trigger the rule on. */
eventType?: AutoModerationEventTypes
/** The metadata to use for the trigger. */
triggerMetadata?: Camelize<DiscordAutoModerationRuleTriggerMetadata>
/** The actions that will trigger for this rule */
actions?: DiscordenoAutoModerationAction[]
/** Whether the rule should be enabled. */
enabled?: boolean
/** The role ids that should not be effected by the rule */
exemptRoles?: BigString[]
/** The channel ids that should not be effected by the rule. */
exemptChannels?: BigString[]
}

View File

@@ -0,0 +1,398 @@
/** Types for: https://discord.com/developers/docs/resources/channel */
import type { ChannelTypes, ForumLayout, OverwriteTypes, SortOrderTypes, VideoQualityModes } from '../discord/channel.js'
import type { TargetTypes } from '../discord/invite.js'
import type { DiscordAttachment, DiscordEmbed, MessageFlags } from '../discord/message.js'
import type { PermissionStrings } from '../discord/permissions.js'
import type { BigString, Camelize } from '../shared.js'
import type { MessageComponents } from './components.js'
import type { AllowedMentions } from './message.js'
import type { FileContent } from './reference.js'
/** https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure */
export interface Overwrite {
/** Role or user id */
id: BigString
/** Either 0 (role) or 1 (member) */
type: OverwriteTypes
// We allow PermissionStrings[] because in the rest manager we convert these value to the actual string discord wants
/** Permission bit set */
allow?: PermissionStrings[] | string
/** Permission bit set */
deny?: PermissionStrings[] | string
}
// This needs the prefix Discordeno to avoid conflicts with the @discordeno/bot types.
/** https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure */
export interface DiscordenoDefaultReactionEmoji {
/** The id of a guild's custom emoji */
emoji_id: BigString | null
/** The unicode character of the emoji */
emoji_name: string | null
}
// This needs the prefix Discordeno to avoid conflicts with the @discordeno/bot types.
/** https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure */
export interface DiscordenoForumTag {
/** The id of the tag */
id: string
/** The name of the tag (0-20 characters) */
name: string
/** Whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission */
moderated: boolean
/** The id of a guild's custom emoji. At most one of emoji_id and emoji_name may be set. */
emoji_id: BigString | null
/** The unicode character of the emoji. At most one of emoji_id and emoji_name may be set. */
emoji_name: string | null
}
/** https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure */
export interface OverwriteReadable extends Overwrite {}
// Since this is a merge of 3 types, the properties appear in order of their first appearance in the 3 types
/**
* - https://discord.com/developers/docs/resources/channel#modify-channel-json-params-group-dm
* - https://discord.com/developers/docs/resources/channel#modify-channel-json-params-guild-channel
* - https://discord.com/developers/docs/resources/channel#modify-channel-json-params-thread
*/
export interface ModifyChannel {
// Group DM
/**
* 1-100 character channel name
*
* @remarks
* This is valid only when editing group dms, any guild channel type, or a thread
*/
name?: string
/**
* Base64 encoded icon
*
* @remarks
* This is valid only when editing group dms
*/
icon?: string
// Guild Channel
/**
* The type of channel
*
* @remarks
* You can only convert between {@link ChannelTypes.GuildText} channels and {@link ChannelTypes.GuildAnnouncement} channels when the guild has the `NEWS` feature
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildText} or {@link ChannelTypes.GuildAnnouncement}.
*/
type?: ChannelTypes
/**
* The position of the channel in the left-hand listing (channels with the same position are sorted by id)
*
* @remarks
* This is only valid when editing a guild channel of any type
*/
position?: number | null
/**
* Channel topic
*
* @remarks
* 0-1024 character channel topic, or for {@link ChannelTypes.GuildForum} and {@link ChannelTypes.GuildMedia} 0-4096
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildText}, {@link ChannelTypes.GuildAnnouncement}, {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
topic?: string | null
/**
* Whether the channel is nsfw
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildText}, {@link ChannelTypes.GuildVoice}, {@link ChannelTypes.GuildAnnouncement}, {@link ChannelTypes.GuildStageVoice} {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
nsfw?: boolean | null
/**
* Amount of seconds a user has to wait before sending another message in seconds (0-21600)
*
* @remarks
* Bots and users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNEL`, are unaffected
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildText}, {@link ChannelTypes.GuildVoice}, {@link ChannelTypes.GuildStageVoice} {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}, or a thread.
*/
rateLimitPerUser?: number | null
/**
* The bitrate (in bits) of the voice or stage channel
*
* @remarks
* Minimum of 8000 bits
*
* For voice channels:
* - normal servers can set bitrate up to 96000
* - servers with Boost level 1 can set up to 128000
* - servers with Boost level 2 can set up to 256000
* - servers with Boost level 3 or the `VIP_REGIONS` guild feature can set up to 384000.
*
* For stage channels, bitrate can be set up to 64000.
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildVoice}, {@link ChannelTypes.GuildStageVoice}.
*/
bitrate?: number | null
/**
* The user limit of the voice or stage channel (0 refers to no limit)
*
* @remarks
* - For voice channels, the max is set to 99
* - For stage channels, the max is set to 10,000
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildVoice}, {@link ChannelTypes.GuildStageVoice}.
*/
userLimit?: number | null
/**
* Channel or category-specific permissions
*
* @remarks
* This is only valid when editing a guild channel of any type
*/
permissionOverwrites?: OverwriteReadable[] | null
/**
* Id of the new parent category for a channel
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildText}, {@link ChannelTypes.GuildVoice}, {@link ChannelTypes.GuildAnnouncement}, {@link ChannelTypes.GuildStageVoice} {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
parentId?: BigString | null
/**
* Voice region id for the voice channel, automatic when set to null
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildVoice}, {@link ChannelTypes.GuildStageVoice}.
*/
rtcRegion?: string | null
/**
* The camera video quality mode of the voice channel
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildVoice}, {@link ChannelTypes.GuildStageVoice}.
*/
videoQualityMode?: VideoQualityModes | null
/**
* The default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildText}, {@link ChannelTypes.GuildAnnouncement}, {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
defaultAutoArchiveDuration?: 60 | 1440 | 4320 | 10080 | null
/**
* Channel flags combined as a bitfield.
*
* @remarks
* - `REQUIRE_TAG` is supported only by {@link ChannelTypes.GuildForum} and {@link ChannelTypes.GuildMedia} channels.
* - `HIDE_MEDIA_DOWNLOAD_OPTIONS` is supported only by {@link ChannelTypes.GuildMedia} channels
* - `PINNED` can only be set for threads in {@link ChannelTypes.GuildForum} and {@link ChannelTypes.GuildMedia} channels
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}, or a thread.
*/
flags?: number
/**
* The set of tags that can be used in a {@link ChannelTypes.GuildForum} or a {@link ChannelTypes.GuildMedia} channel
*
* @remarks
* Limited to 20 tags
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
availableTags?: DiscordenoForumTag[]
/**
* The emoji to show in the add reaction button on a thread in a {@link ChannelTypes.GuildForum} or a {@link ChannelTypes.GuildMedia} channel
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
defaultReactionEmoji?: DiscordenoDefaultReactionEmoji | null
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
*
* @remarks
* This field is copied to the thread at creation time and does not live update.
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildText}, {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
defaultThreadRateLimitPerUser?: number
/**
* The default sort order type used to order posts in {@link ChannelTypes.GuildForum} and {@link ChannelTypes.GuildMedia} channels
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}.
*/
defaultSortOrder?: SortOrderTypes | null
/**
* The default forum layout type used to display posts in {@link ChannelTypes.GuildForum} channels
*
* @remarks
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildForum}.
*/
defaultForumLayout?: ForumLayout
// Thread
/**
* Whether the thread is archived
*
* @remarks
* This is only valid when editing a thread
*/
archived?: boolean
/**
* The thread will stop showing in the channel list after `auto_archive_duration` minutes of inactivity
*
* @remarks
* This is only valid when editing a thread
*/
autoArchiveDuration?: 60 | 1440 | 4320 | 10080
/**
* Whether the thread is locked. When a thread is locked, only users with `MANAGE_THREADS` can unarchive it
*
* @remarks
* This is only valid when editing a thread
*/
locked?: boolean
/**
* Whether non-moderators can add other non-moderators to a thread
*
* @remarks
* Only available on private threads
*
* This is only valid when editing a thread
*/
invitable?: boolean
/**
* The IDs of the set of tags that have been applied to a thread in a {@link ChannelTypes.GuildForum} or a {@link ChannelTypes.GuildMedia} channel
*
* @remarks
* Limited to 5
*
* This is only valid when editing a thread
*/
appliedTags?: BigString[]
}
/** https://discord.com/developers/docs/resources/channel#edit-channel-permissions-json-params */
export interface EditChannelPermissionOverridesOptions {
// This is included in here however it is a route parameter
/** Role or user id */
id: BigString
/** Either 0 (role) or 1 (member) */
type: OverwriteTypes
// We allow PermissionStrings[] because in the rest manager we convert these value to the actual string discord wants
/** The bitwise value of all allowed permissions */
allow?: PermissionStrings[] | string | null
/** The bitwise value of all disallowed permissions */
deny?: PermissionStrings[] | string | null
}
/** https://discord.com/developers/docs/resources/channel#create-channel-invite-json-params */
export interface CreateChannelInvite {
/** Duration of invite in seconds before expiry, or 0 for never. Between 0 and 604800 (7 days). Default: 86400 (24 hours) */
maxAge?: number
/** Max number of users or 0 for unlimited. Between 0 and 100. Default: 0 */
maxUses?: number
/** Whether this invite only grants temporary membership. Default: false */
temporary?: boolean
/** If true, don't try to reuse similar invite (useful for creating many unique one time use invites). Default: false */
unique?: boolean
/** The type of target for this voice channel invite */
targetType?: TargetTypes
/** The id of the user whose stream to display for this invite, required if `target_type` is 1, the user must be streaming in the channel */
targetUserId?: BigString
/** The id of the embedded application to open for this invite, required if `target_type` is 2, the application must have the `EMBEDDED` flag */
targetApplicationId?: BigString
}
/** https://discord.com/developers/docs/resources/channel#group-dm-add-recipient-json-params */
export interface AddDmRecipientOptions {
/** access token of a user that has granted your app the `gdm.join` scope */
accessToken: string
/** nickname of the user being added */
nick: string
}
/** https://discord.com/developers/docs/resources/channel#start-thread-from-message-json-params */
export interface StartThreadWithMessage {
/** 1-100 character thread name */
name: string
/** Duration in minutes to automatically archive the thread after recent activity */
autoArchiveDuration?: 60 | 1440 | 4320 | 10080
/** Amount of seconds a user has to wait before sending another message (0-21600) */
rateLimitPerUser?: number | null
}
/** https://discord.com/developers/docs/resources/channel#start-thread-without-message-json-params */
export interface StartThreadWithoutMessage {
/** 1-100 character thread name */
name: string
/** Duration in minutes to automatically archive the thread after recent activity */
autoArchiveDuration?: 60 | 1440 | 4320 | 10080
/** The type of thread to create. Defaults to PrivateThread */
type?: ChannelTypes.AnnouncementThread | ChannelTypes.PublicThread | ChannelTypes.PrivateThread
/** Whether non-moderators can add other non-moderators to a thread; only available when creating a private thread */
invitable?: boolean
/** Amount of seconds a user has to wait before sending another message (0-21600) */
rateLimitPerUser?: number | null
}
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel-jsonform-params*/
export interface CreateForumPostWithMessage {
/** 1-100 character thread name */
name: string
/** Duration in minutes to automatically archive the thread after recent activity */
autoArchiveDuration?: 60 | 1440 | 4320 | 10080
/** Amount of seconds a user has to wait before sending another message (0-21600) */
rateLimitPerUser?: number | null
/** contents of the first message in the forum/media thread */
message: ForumAndMediaThreadMessage
/** The IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel */
appliedTags?: BigString[]
/** The contents of the files being sent */
files?: FileContent[]
}
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object */
export interface ForumAndMediaThreadMessage {
/** The message contents (up to 2000 characters) */
content?: string
/** Embedded `rich` content (up to 6000 characters) */
embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */
allowedMentions?: AllowedMentions
/** The components you would like to have sent in this message */
components?: MessageComponents
/** IDs of up to 3 stickers in the server to send in the message */
stickerIds?: BigString[]
/** Attachment objects with `filename` and `description` */
attachments?: Pick<DiscordAttachment, 'filename' | 'description' | 'id'>[]
/** Message flags combined as a bitfield, only SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS and IS_COMPONENTS_V2 can be set */
flags?: MessageFlags
}
/** https://discord.com/developers/docs/resources/channel#get-thread-member-query-string-params */
export interface GetThreadMember {
/** Whether to include a guild member object for the thread member */
withMember?: boolean
}
/** https://discord.com/developers/docs/resources/channel#list-thread-members-query-string-params */
export interface ListThreadMembers {
/** Whether to include a guild member object for the thread member */
withMember?: boolean
/** Get thread members after this user ID */
after?: BigString
/** Max number of thread members to return (1-100). Defaults to 100. */
limit?: BigString
}
/**
* - https://discord.com/developers/docs/resources/channel#list-public-archived-threads-query-string-params
* - https://discord.com/developers/docs/resources/channel#list-private-archived-threads-query-string-params
* - https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads-query-string-params
*/
export interface ListArchivedThreads {
/** Returns threads before this timestamp */
before?: number
/** Optional maximum number of threads to return */
limit?: number
}

View File

@@ -0,0 +1,323 @@
/** Types for: https://discord.com/developers/docs/components/reference */
import type { ChannelTypes } from '../discord/channel.js'
import type {
ButtonStyles,
DiscordMediaGalleryItem,
DiscordUnfurledMediaItem,
MessageComponentTypes,
SeparatorSpacingSize,
TextStyles,
} from '../discord/components.js'
import type { BigString } from '../shared.js'
export type MessageComponents = MessageComponent[]
export type MessageComponent =
| ActionRow
| ButtonComponent
| TextInputComponent
| StringSelectComponent
| ChannelSelectComponent
| RoleSelectComponent
| UserSelectComponent
| MentionableSelectComponent
| SectionComponent
| TextDisplayComponent
| ThumbnailComponent
| MediaGalleryComponent
| SeparatorComponent
| ContainerComponent
| FileComponent
/** https://discord.com/developers/docs/components/reference#anatomy-of-a-component */
export interface BaseComponent {
/** The type of the component */
type: MessageComponentTypes
/** 32 bit integer used as an optional identifier for component */
id?: number
}
/** https://discord.com/developers/docs/components/reference#action-row-action-row-structure */
export interface ActionRow extends BaseComponent {
type: MessageComponentTypes.ActionRow
/**
* The components in this row
*
* @remarks
* Up to 5 button components, a single select component or a single text input component
*/
components: (
| ButtonComponent
| StringSelectComponent
| UserSelectComponent
| RoleSelectComponent
| MentionableSelectComponent
| ChannelSelectComponent
| TextInputComponent
)[]
}
/** https://discord.com/developers/docs/components/reference#button-button-structure */
export interface ButtonComponent extends BaseComponent {
type: MessageComponentTypes.Button
/** For different styles/colors of the buttons */
style: ButtonStyles
/** for what the button says (max 80 characters) */
label?: string
/** Emoji object that includes fields of name, id, and animated supporting unicode and custom emojis. */
emoji?: {
/** Emoji id */
id?: BigString
/** Emoji name */
name?: string
/** Whether this emoji is animated */
animated?: boolean
}
/** a dev-defined unique string sent on click (max 100 characters). type 5 Link buttons can not have a custom_id */
customId?: string
/** Identifier for a purchasable SKU, only available when using premium-style buttons */
skuId?: BigString
/**
* optional url for link-style buttons that can navigate a user to the web.
*
* @remarks
* Only {@link ButtonStyles.Link | Link} buttons can have a url.
*
* Maximum 512 characters.
*/
url?: string
/** Whether or not this button is disabled */
disabled?: boolean
}
/** https://discord.com/developers/docs/components/reference#string-select-string-select-structure */
export interface StringSelectComponent extends BaseComponent {
type: MessageComponentTypes.StringSelect
/** A custom identifier for this component. Maximum 100 characters. */
customId: string
/** The choices! Maximum of 25 items. */
options: SelectOption[]
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
placeholder?: string
/** The minimum number of items that must be selected. Default 1. Between 1-25. */
minValues?: number
/** The maximum number of items that can be selected. Default 1. Between 1-25. */
maxValues?: number
/** Whether or not this select is disabled */
disabled?: boolean
}
/** https://discord.com/developers/docs/components/reference#string-select-select-option-structure */
export interface SelectOption {
/** The user-facing name of the option. Maximum 25 characters. */
label: string
/** The dev-defined value of the option. Maximum 100 characters. */
value: string
/** An additional description of the option. Maximum 50 characters. */
description?: string
// TODO: Make an alias for this type since it is used a few times
/** The id, name, and animated properties of an emoji. */
emoji?: {
/** Emoji id */
id?: BigString
/** Emoji name */
name?: string
/** Whether this emoji is animated */
animated?: boolean
}
/** Will render this option as already-selected by default. */
default?: boolean
}
/** https://discord.com/developers/docs/components/reference#text-input-text-input-structure */
export interface TextInputComponent extends BaseComponent {
type: MessageComponentTypes.TextInput
/** The customId of the InputText */
customId: string
/** The style of the InputText */
style: TextStyles
/** The label of the InputText. Maximum 45 characters */
label: string
/** The minimum length of the text the user has to provide */
minLength?: number
/** The maximum length of the text the user has to provide */
maxLength?: number
/** Whether or not this input is required. */
required?: boolean
/** Pre-filled value for input text. */
value?: string
/** The placeholder of the InputText */
placeholder?: string
}
/** https://discord.com/developers/docs/components/reference#user-select-user-select-structure */
export interface UserSelectComponent extends BaseComponent {
type: MessageComponentTypes.UserSelect
/** A custom identifier for this component. Maximum 100 characters. */
customId: string
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
placeholder?: string
/**
* List of default values for auto-populated select menu components
* The number of default values must be in the range defined by minValues and maxValues
*/
defaultValues?: SelectMenuDefaultValue[]
/** The minimum number of items that must be selected. Default 1. Between 1-25. */
minValues?: number
/** The maximum number of items that can be selected. Default 1. Between 1-25. */
maxValues?: number
/** Whether or not this select is disabled */
disabled?: boolean
}
/** https://discord.com/developers/docs/components/reference#user-select-select-default-value-structure */
export interface SelectMenuDefaultValue {
/** ID of a user, role, or channel */
id: BigString
/** Type of value that id represents. */
type: 'user' | 'role' | 'channel'
}
/** https://discord.com/developers/docs/components/reference#role-select-role-select-structure */
export interface RoleSelectComponent extends BaseComponent {
type: MessageComponentTypes.RoleSelect
/** A custom identifier for this component. Maximum 100 characters. */
customId: string
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
placeholder?: string
/**
* List of default values for auto-populated select menu components
* The number of default values must be in the range defined by minValues and maxValues
*/
defaultValues?: SelectMenuDefaultValue[]
/** The minimum number of items that must be selected. Default 1. Between 1-25. */
minValues?: number
/** The maximum number of items that can be selected. Default 1. Between 1-25. */
maxValues?: number
/** Whether or not this select is disabled */
disabled?: boolean
}
/** https://discord.com/developers/docs/components/reference#mentionable-select-mentionable-select-structure */
export interface MentionableSelectComponent extends BaseComponent {
type: MessageComponentTypes.MentionableSelect
/** A custom identifier for this component. Maximum 100 characters. */
customId: string
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
placeholder?: string
/**
* List of default values for auto-populated select menu components
* The number of default values must be in the range defined by minValues and maxValues
*/
defaultValues?: SelectMenuDefaultValue[]
/** The minimum number of items that must be selected. Default 1. Between 1-25. */
minValues?: number
/** The maximum number of items that can be selected. Default 1. Between 1-25. */
maxValues?: number
/** Whether or not this select is disabled */
disabled?: boolean
}
/** https://discord.com/developers/docs/components/reference#channel-select-channel-select-structure */
export interface ChannelSelectComponent extends BaseComponent {
type: MessageComponentTypes.ChannelSelect
/** A custom identifier for this component. Maximum 100 characters. */
customId: string
/** List of channel types to include in the options list */
channelTypes?: ChannelTypes[]
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
placeholder?: string
/**
* List of default values for auto-populated select menu components
* The number of default values must be in the range defined by minValues and maxValues
*/
defaultValues?: SelectMenuDefaultValue[]
/** The minimum number of items that must be selected. Default 1. Between 1-25. */
minValues?: number
/** The maximum number of items that can be selected. Default 1. Between 1-25. */
maxValues?: number
/** Whether or not this select is disabled */
disabled?: boolean
}
/** https://discord.com/developers/docs/components/reference#section-section-structure */
export interface SectionComponent extends BaseComponent {
type: MessageComponentTypes.Section
/** One to three text components */
components: TextDisplayComponent[]
/** A thumbnail or a button component, with a future possibility of adding more compatible components */
accessory: ButtonComponent | ThumbnailComponent
}
/** https://discord.com/developers/docs/components/reference#text-display */
export interface TextDisplayComponent extends BaseComponent {
type: MessageComponentTypes.TextDisplay
/** Text that will be displayed similar to a message */
content: string
}
/** https://discord.com/developers/docs/components/reference#thumbnail */
export interface ThumbnailComponent extends BaseComponent {
type: MessageComponentTypes.Thumbnail
/** A url or attachment */
media: DiscordUnfurledMediaItem
/** Alt text for the media */
description?: string
/** Whether the thumbnail should be a spoiler (or blurred out). Defaults to `false` */
spoiler?: boolean
}
/** https://discord.com/developers/docs/components/reference#media-gallery */
export interface MediaGalleryComponent extends BaseComponent {
type: MessageComponentTypes.MediaGallery
/** 1 to 10 media gallery items */
items: DiscordMediaGalleryItem[]
}
/** https://discord.com/developers/docs/components/reference#file */
export interface FileComponent extends BaseComponent {
type: MessageComponentTypes.File
/** This unfurled media item is unique in that it only supports attachment references using the attachment://<filename> syntax */
file: DiscordUnfurledMediaItem
/** Whether the media should be a spoiler (or blurred out). Defaults to `false` */
spoiler?: boolean
/** The name of the file. This field is ignored and provided by the API as part of the response */
name: string
/** The size of the file in bytes. This field is ignored and provided by the API as part of the response */
size: number
}
/** https://discord.com/developers/docs/components/reference#separator */
export interface SeparatorComponent extends BaseComponent {
type: MessageComponentTypes.Separator
/** Whether a visual divider should be displayed in the component. Defaults to `true` */
divider?: boolean
/** Size of separator padding — `1` for small padding, `2` for large padding. Defaults to `1` */
spacing?: SeparatorSpacingSize
}
/** https://discord.com/developers/docs/components/reference#container */
export interface ContainerComponent extends BaseComponent {
type: MessageComponentTypes.Container
/** Components of the type action row, text display, section, media gallery, separator, or file */
components: Array<ActionRow | TextDisplayComponent | SectionComponent | MediaGalleryComponent | SeparatorComponent | FileComponent>
/** Color for the accent on the container as RGB from 0x000000 to 0xFFFFFF */
accentColor?: number | null
/** Whether the container should be a spoiler (or blurred out). Defaults to `false` */
spoiler?: boolean
}

View File

@@ -0,0 +1,35 @@
/** Types for: https://discord.com/developers/docs/resources/emoji */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
export interface CreateGuildEmoji {
/** Name of the emoji */
name: string
/** The 128x128 emoji image. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */
image: string
/** Roles allowed to use this emoji */
roles: BigString[]
}
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
export interface ModifyGuildEmoji {
/** Name of the emoji */
name?: string
/** Roles allowed to use this emoji */
roles?: BigString[] | null
}
/** https://discord.com/developers/docs/resources/emoji#create-application-emoji */
export interface CreateApplicationEmoji {
/** Name of the emoji */
name: string
/** The 128x128 emoji image. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */
image: string
}
/** https://discord.com/developers/docs/resources/emoji#modify-application-emoji */
export interface ModifyApplicationEmoji {
/** Name of the emoji */
name?: string
}

View File

@@ -0,0 +1,42 @@
/** Types for: https://discord.com/developers/docs/resources/entitlement */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/entitlement#list-entitlements-query-string-params */
export interface GetEntitlements {
/** User ID to look up entitlements for */
userId?: BigString
/** Optional list of SKU IDs to check entitlements for */
skuIds?: BigString[]
/** Retrieve entitlements before this entitlement ID */
before?: BigString
/** Retrieve entitlements after this entitlement ID */
after?: BigString
/** Number of entitlements to return, 1-100, default 100 */
limit?: number
/** Guild ID to look up entitlements for */
guildId?: BigString
/** Whether or not ended entitlements should be omitted. Defaults to false, ended entitlements are included by default. */
excludeEnded?: boolean
/** Whether or not deleted entitlements should be omitted. Defaults to true, deleted entitlements are not included by default. */
excludeDeleted?: boolean
}
// TODO: This should provably get renamed to CreateTestEntitlement
/** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement-json-params */
export interface CreateEntitlement {
/** ID of the SKU to grant the entitlement to */
skuId: BigString
/** ID of the guild or user to grant the entitlement to */
ownerId: BigString
/** The type of entitlement, guild subscription or user subscription */
ownerType: CreateEntitlementOwnerType
}
/** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement-json-params - Description of ownerType */
export enum CreateEntitlementOwnerType {
/** Guild subscription */
GuildSubscription = 1,
/** User subscription */
UserSubscription = 2,
}

View File

@@ -0,0 +1,23 @@
/**
* Types for:
* - https://discord.com/developers/docs/events/gateway
* - https://discord.com/developers/docs/events/gateway-events
*/
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/events/gateway-events#request-guild-members */
export interface RequestGuildMembers {
/** id of the guild to get members for */
guildId: BigString
/** String that username starts with, or an empty string to return all members */
query?: string
/** Maximum number of members to send matching the query; a limit of 0 can be used with an empty string query to return all members */
limit: number
/** Used to specify if we want the presences of the matched members */
presences?: boolean
/** Used to specify which users you wish to fetch */
userIds?: BigString[]
/** Nonce to identify the Guild Members Chunk response */
nonce?: string
}

View File

@@ -0,0 +1,317 @@
/** Types for: https://discord.com/developers/docs/resources/guild */
import type { ChannelTypes, ForumLayout, SortOrderTypes, VideoQualityModes } from '../discord/channel.js'
import type {
DefaultMessageNotificationLevels,
DiscordGuildOnboardingMode,
DiscordGuildOnboardingPrompt,
ExplicitContentFilterLevels,
GuildFeatures,
SystemChannelFlags,
VerificationLevels,
} from '../discord/guild.js'
import type { PermissionStrings } from '../discord/permissions.js'
import type { BigString, Camelize } from '../shared.js'
import type { DiscordenoDefaultReactionEmoji, DiscordenoForumTag, Overwrite } from './channel.js'
import type { GuildRoleColors } from './permissions.js'
/** https://discord.com/developers/docs/resources/guild#modify-guild-json-params */
export interface ModifyGuild {
/** Guild name */
name?: string
/** Verification level */
verificationLevel?: VerificationLevels | null
/** Default message notification filter level */
defaultMessageNotifications?: DefaultMessageNotificationLevels | null
/** Explicit content filter level */
explicitContentFilter?: ExplicitContentFilterLevels | null
/** Id for afk channel */
afkChannelId?: BigString | null
/** Afk timeout in seconds */
afkTimeout?: number
/** Base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the `ANIMATED_ICON` feature) */
icon?: string | null
/** Base64 16:9 png/jpeg image for the guild splash (when the server has `INVITE_SPLASH` feature) */
splash?: string | null
/** Base64 16:9 png/jpeg image for the guild discovery spash (when the server has the `DISCOVERABLE` feature) */
discoverySplash?: string | null
/** Base64 16:9 png/jpeg image for the guild banner (when the server has BANNER feature) */
banner?: string | null
/** The id of the channel where guild notices such as welcome messages and boost events are posted */
systemChannelId?: BigString | null
/** System channel flags */
systemChannelFlags?: SystemChannelFlags
/** The id of the channel where Community guilds display rules and/or guidelines */
rulesChannelId?: BigString | null
/** The id of the channel where admins and moderators of Community guilds receive notices from Discord */
publicUpdatesChannelId?: BigString | null
/** The preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US" */
preferredLocale?: string | null
/** Enabled guild features */
features?: GuildFeatures[]
/** The description for the guild */
description?: string | null
/** Whether the guild's boost progress bar should be enabled */
premiumProgressBarEnabled?: boolean
/** The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord */
safetyAlertsChannelId?: BigString | null
}
/** https://discord.com/developers/docs/resources/guild#create-guild-channel-json-params */
export interface CreateGuildChannel {
/** Channel name (1-100 characters) */
name: string
/** The type of channel */
type?: ChannelTypes
/** Channel topic (0-1024 characters) */
topic?: string
/** The bitrate (in bits) of the voice channel (voice only) */
bitrate?: number
/** The user limit of the voice channel (voice only) */
userLimit?: 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_channel`, are unaffected */
rateLimitPerUser?: number
/** Sorting position of the channel (channels with the same position are sorted by id) */
position?: number
/** The channel's permission overwrites */
permissionOverwrites?: Partial<Overwrite>[]
/** Id of the parent category for a channel */
parentId?: BigString
/** Whether the channel is nsfw */
nsfw?: boolean
/** Channel voice region id of the voice or stage channel, automatic when set to null */
rtcRegion?: string
/** The camera video quality mode of the voice channel */
videoQualityMode?: VideoQualityModes
/** Default duration (in minutes) that clients (not the API) use for newly created threads in this channel, to determine when to automatically archive the thread after the last activity */
defaultAutoArchiveDuration?: number
/** Emoji to show in the add reaction button on a thread in a forum channel */
defaultReactionEmoji?: DiscordenoDefaultReactionEmoji
/** Set of tags that can be used in a forum channel */
availableTags?: DiscordenoForumTag[]
/** The default sort order type used to order posts in forum channels */
defaultSortOrder?: SortOrderTypes | null
/** the default forum layout view used to display posts in GUILD_FORUM channels */
defaultForumLayout?: ForumLayout
/** The initial ratelimit to set on newly created threads in a channel. */
defaultThreadRateLimitPerUser?: number
}
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions-json-params */
export interface ModifyGuildChannelPositions {
/** Channel id */
id: BigString
/** Sorting position of the channel (channels with the same position are sorted by id) */
position?: number | null
/** Syncs the permission overwrites with the new parent, if moving to a new category */
lockPositions?: boolean | null
/** The new parent ID for the channel that is moved */
parentId?: BigString | null
}
/** https://discord.com/developers/docs/resources/guild#list-guild-members-query-string-params */
export interface ListGuildMembers {
/** Max number of members to return (1-1000). Default: 1 */
limit?: number
/** The highest user id in the previous page. Default: 0 */
after?: string
}
/** https://discord.com/developers/docs/resources/guild#search-guild-members-query-string-params */
export interface SearchMembers {
/** Query string to match username(s) and nickname(s) against */
query: string
/** Max number of members to return (1-1000). Default: 1 */
limit?: number
}
/** https://discord.com/developers/docs/resources/guild#add-guild-member-json-params */
export interface AddGuildMemberOptions {
/** access token of a user that has granted your app the `guilds.join` scope */
accessToken: string
/** Value to set user's nickname to. Requires MANAGE_NICKNAMES permission on the bot */
nick?: string
/** Array of role ids the member is assigned. Requires MANAGE_ROLES permission on the bot */
roles?: BigString[]
/** Whether the user is muted in voice channels. Requires MUTE_MEMBERS permission on the bot */
mute?: boolean
/** Whether the user is deafened in voice channels. Requires DEAFEN_MEMBERS permission on the bot */
deaf?: boolean
}
/** https://discord.com/developers/docs/resources/guild#modify-guild-member-json-params */
export interface ModifyGuildMember {
/** Value to set users nickname to. Requires the `MANAGE_NICKNAMES` permission */
nick?: string | null
/** Array of role ids the member is assigned. Requires the `MANAGE_ROLES` permission */
roles?: BigString[] | null
/** Whether the user is muted in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MUTE_MEMBERS` permission */
mute?: boolean | null
/** Whether the user is deafened in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MOVE_MEMBERS` permission */
deaf?: boolean | null
/** Id of channel to move user to (if they are connected to voice). Requires the `MOVE_MEMBERS` permission */
channelId?: BigString | null
/** When the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future), set to null to remove timeout. Requires the `MODERATE_MEMBERS` permission. The date must be given in a ISO string form. */
communicationDisabledUntil?: string | null
/** Set the flags for the guild member. Requires the `MANAGE_GUILD` or `MANAGE_ROLES` or the combination of `MODERATE_MEMBERS` and `KICK_MEMBERS` and `BAN_MEMBERS` */
flags?: number
}
/** https://discord.com/developers/docs/resources/guild#modify-current-member-json-params */
export interface EditBotMemberOptions {
nick?: string | null
}
/** https://discord.com/developers/docs/resources/guild#get-guild-bans-query-string-params */
export interface GetBans {
/** Number of users to return (up to maximum 1000). Default: 1000 */
limit?: number
/** Consider only users before given user id */
before?: BigString
/** Consider only users after given user id */
after?: BigString
}
/** https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params */
export interface CreateGuildBan {
/**
* Number of seconds to delete messages for, between 0 and 604800 (7 days)
*
* @default 0
*/
deleteMessageSeconds?: number
}
/** https://discord.com/developers/docs/resources/guild#bulk-guild-ban-json-params */
export interface CreateGuildBulkBan {
/** list of user ids to ban (max 200) */
userIds: BigString[]
/**
* Number of seconds to delete messages for, between 0 and 604800 (7 days)
*
* @default 0
*/
deleteMessageSeconds?: number
}
/** https://discord.com/developers/docs/resources/guild#create-guild-role-json-params */
export interface CreateGuildRole {
/** Name of the role, max 100 characters, default: "new role" */
name?: string
/** Bitwise value of the enabled/disabled permissions, default: everyone permissions in guild */
permissions?: PermissionStrings[] | string
/**
* RGB color value, default: 0
* @deprecated the {@link colors} field is recommended for use instead of this field
*/
color?: number
/** The role's color */
colors?: GuildRoleColors
/** Whether the role should be displayed separately in the sidebar, default: false */
hoist?: boolean
/** the role's icon image (if the guild has the `ROLE_ICONS` feature) */
icon?: string | null
/** The role's unicode emoji (if the guild has the `ROLE_ICONS` feature) */
unicodeEmoji?: string | null
/** Whether the role should be mentionable, default: false */
mentionable?: boolean
}
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions-json-params */
export interface ModifyRolePositions {
/** The role id */
id: BigString
/** The sorting position for the role. (roles with the same position are sorted by id) */
position?: number | null
}
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-json-params */
export interface EditGuildRole {
/** Name of the role, max 100 characters, default: "new role" */
name?: string | null
/** Bitwise value of the enabled/disabled permissions, default: everyone permissions in guild */
permissions?: PermissionStrings[] | string | null
/**
* RGB color value, default: 0
* @deprecated the {@link colors} field is recommended for use instead of this field
*/
color?: number | null
/** The role's color */
colors?: GuildRoleColors | null
/** Whether the role should be displayed separately in the sidebar, default: false */
hoist?: boolean | null
/** the role's icon image (if the guild has the `ROLE_ICONS` feature) */
icon?: string | null
/** The role's unicode emoji (if the guild has the `ROLE_ICONS` feature) */
unicodeEmoji?: string | null
/** Whether the role should be mentionable, default: false */
mentionable?: boolean | null
}
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
export interface GetGuildPruneCountQuery {
/** Number of days to count prune for (1 or more), default: 7 */
days?: number
/** Role(s) to include, default: none */
includeRoles?: string | string[]
}
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
export interface BeginGuildPrune {
/** Number of days to prune (1 or more), default: 7 */
days?: number
/** Whether 'pruned' is returned, discouraged for large guilds, default: true */
computePruneCount?: boolean
/** Role(s) ro include, default: none */
includeRoles?: string[]
}
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-query-string-params */
export interface GetGuildWidgetImageQuery {
/**
* Style of the widget returned, default: shield
*
* Shield: Widget with Discord icon and guild members online count.
* Banner1: Large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget
* Banner2: Smaller widget style with guild icon, name and online count. Split on the right with Discord logo
* Banner3: Large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right
* Banner4: Large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottom
*/
style?: 'shield' | 'banner1' | 'banner2' | 'banner3' | 'banner4'
}
/** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding-json-params */
export interface EditGuildOnboarding {
/** Prompts shown during onboarding and in customize community */
prompts?: Camelize<DiscordGuildOnboardingPrompt>[]
/** Channel IDs that members get opted into automatically */
defaultChannelIds?: BigString[]
/** Whether onboarding is enabled in the guild */
enabled?: boolean
/** Current mode of onboarding */
mode?: DiscordGuildOnboardingMode
}
/** https://discord.com/developers/docs/resources/guild#modify-guild-incident-actions-json-params */
export interface ModifyGuildIncidentActions {
/**
* When invites will be enabled again
*
* @remarks
* The value should either be an ISO8601 string or null
*
* Can be enabled for a maximal timespan of 24 hours in the future.
* Supplying null disables the action
*/
invitesDisabledUntil?: string | null
/**
* When direct messages will be enabled again
*
* @remarks
* The value should either be an ISO8601 string or null
*
* Can be enabled for a maximal timespan of 24 hours in the future.
* Supplying null disables the action
*/
dmsDisabledUntil?: string | null
}

View File

@@ -0,0 +1,74 @@
/** Types for: https://discord.com/developers/docs/resources/guild-scheduled-event */
import type {
DiscordScheduledEventEntityMetadata,
DiscordScheduledEventRecurrenceRule,
ScheduledEventEntityType,
ScheduledEventPrivacyLevel,
ScheduledEventStatus,
} from '../discord/guildScheduledEvent.js'
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild-query-string-params */
export interface GetScheduledEvents {
/** include number of users subscribed to each event */
withUserCount?: boolean
}
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event-json-params */
export interface CreateScheduledEvent {
/** the channel id of the scheduled event. */
channelId?: BigString
entityMetadata?: DiscordScheduledEventEntityMetadata
/** the name of the scheduled event */
name: string
/** the privacy level of the scheduled event */
privacyLevel?: ScheduledEventPrivacyLevel
/** the time the scheduled event will start */
scheduledStartTime: string
/** the time the scheduled event will end if it does end. Required for events with `entityType: ScheduledEventEntityType.External` */
scheduledEndTime?: string
/** the description of the scheduled event */
description: string
/** the type of hosting entity associated with a scheduled event */
entityType: ScheduledEventEntityType
/** the cover image of the scheduled event */
image?: string
/** the definition for how often this event should recur */
recurrenceRule?: DiscordScheduledEventRecurrenceRule
}
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event-json-params */
export interface EditScheduledEvent {
/** the channel id of the scheduled event. null if switching to external event. */
channelId: BigString | null
/** the name of the scheduled event */
name: string
/** the privacy level of the scheduled event */
privacyLevel: ScheduledEventPrivacyLevel
/** the time the scheduled event will start */
scheduledStartTime: string
/** the time the scheduled event will end if it does end. */
scheduledEndTime?: string
/** the description of the scheduled event */
description?: string
/** the type of hosting entity associated with a scheduled event */
entityType: ScheduledEventEntityType
/** the status of the scheduled event */
status: ScheduledEventStatus
/** the cover image of the scheduled event */
image?: string
/** the definition for how often this event should recur */
recurrenceRule?: DiscordScheduledEventRecurrenceRule | null
}
export interface GetScheduledEventUsers {
/** number of users to return (up to maximum 100), defaults to 100 */
limit?: number
/** whether to also have member objects provided, defaults to false */
withMember?: boolean
/** consider only users before given user id */
before?: BigString
/** consider only users after given user id. If both before and after are provided, only before is respected. Fetching users in-between before and after is not supported. */
after?: BigString
}

View File

@@ -0,0 +1,17 @@
/** Types for: https://discord.com/developers/docs/resources/guild-template */
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template-json-params */
export interface CreateTemplate {
/** Name which the template should have */
name: string
/** Description of the template */
description?: string
}
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template-json-params */
export interface ModifyGuildTemplate {
/** Name of the template (1-100 characters) */
name?: string
/** Description of the template (0-120 characters) */
description?: string | null
}

View File

@@ -0,0 +1,190 @@
/**
* Types for:
* - https://discord.com/developers/docs/interactions/receiving-and-responding
* - https://discord.com/developers/docs/interactions/application-commands
*/
import type { DiscordApplicationIntegrationType } from '../discord/application.js'
import type {
ApplicationCommandTypes,
DiscordApplicationCommandOption,
DiscordApplicationCommandOptionChoice,
DiscordInteractionContextType,
DiscordInteractionEntryPointCommandHandlerType,
InteractionResponseTypes,
} from '../discord/interactions.js'
import type { DiscordAttachment, DiscordEmbed } from '../discord/message.js'
import type { PermissionStrings } from '../discord/permissions.js'
import type { Localization } from '../discord/reference.js'
import type { BigString, Camelize } from '../shared.js'
import type { MessageComponents } from './components.js'
import type { AllowedMentions } from './message.js'
import type { CreatePoll } from './poll.js'
import type { FileContent } from './reference.js'
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-response-structure */
export interface InteractionResponse {
/** The type of response */
type: InteractionResponseTypes
/** An optional response message */
data?: InteractionCallbackData
}
// Since this is a merge of 3 types, the properties appear in order of their first appearance in the 3 types
/**
* - https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-messages
* - https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-autocomplete
* - https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
*/
export interface InteractionCallbackData {
// Messages
/** True if this is a TTS message */
tts?: boolean
/** The message contents (up to 2000 characters) */
content?: string
/** Embedded `rich` content (up to 6000 characters) */
embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */
allowedMentions?: AllowedMentions
/** Message flags combined as a bit field (only `SUPPRESS_EMBEDS`, `EPHEMERAL`, `IS_COMPONENTS_V2`, `IS_VOICE_MESSAGE` and `SUPPRESS_NOTIFICATIONS` can be set) */
flags?: number
/** The components you would like to have sent in this message */
components?: MessageComponents
/** Attachment objects with filename and description */
attachments?: Pick<DiscordAttachment, 'filename' | 'description' | 'id'>[]
/** The contents of the files being sent */
files?: FileContent[]
/** Details about the poll */
poll?: CreatePoll
// Autocomplete
/** Autocomplete choices (max of 25 choices) */
choices?: Camelize<DiscordApplicationCommandOptionChoice>[]
// Modal
/** The customId you want to use for this modal response. */
customId?: string
/** The title you want to use for this modal response. */
title?: string
}
/**
* - https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response-query-string-params
* - https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command-json-params
*/
export interface InteractionCallbackOptions {
withResponse?: boolean
}
/**
* - https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response-query-string-params
* - https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command-json-params
*/
export type CreateApplicationCommand = CreateSlashApplicationCommand | CreateContextApplicationCommand
/**
* - https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response-query-string-params
* - https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command-json-params
*/
export interface CreateSlashApplicationCommand {
/**
* Name of command, 1-32 characters.
* `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_ʼ\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set.
* If there is a lowercase variant of any letters used, you must use those.
* Characters with no lowercase variants and/or uncased letters are still allowed.
* ApplicationCommandTypes.User` and `ApplicationCommandTypes.Message` commands may be mixed case and can include spaces.
*/
name: string
/** Localization object for the `name` field. Values follow the same restrictions as `name` */
nameLocalizations?: Localization | null
/** 1-100 character description */
description?: string
/** Localization object for the `description` field. Values follow the same restrictions as `description` */
descriptionLocalizations?: Localization | null
/**
* Parameters for the command
*
* @remarks
* This is only valid in commands of type {@link ApplicationCommandTypes.ChatInput | ChatInput}
*/
options?: Camelize<DiscordApplicationCommandOption[]>
/** Set of permissions represented as a bit set */
defaultMemberPermissions?: PermissionStrings[] | string | null
/**
* Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
*
* @deprecated use {@link contexts} instead
*/
dmPermission?: boolean | null
/**
* Replaced by default_member_permissions and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild.
*
* @default true
*/
defaultPermission?: boolean
/**
* Integration types where the command is available
*
* @remarks
* This value is available only for globally-scoped commands
* Defaults to the application configured contexts
*/
integrationTypes?: DiscordApplicationIntegrationType[]
/**
* Interaction context types where the command is available.
*
* @remarks
* This value is available only for globally-scoped commands.
*/
contexts?: DiscordInteractionContextType[]
/** Type of command, defaults `ApplicationCommandTypes.ChatInput` if not set */
type?: ApplicationCommandTypes
/** Indicates whether the command is age-restricted, defaults to `false` */
nsfw?: boolean
// Discord seems to have forgot to add this to the docs, however it is in the examples for this feature...
/**
* Determines whether the interaction is handled by the app's interactions handler or by Discord
*
* @remarks
* This can only be set for application commands of type `PRIMARY_ENTRY_POINT` for applications with the `EMBEDDED` flag (i.e. applications that have an Activity).
*/
handler?: DiscordInteractionEntryPointCommandHandlerType
}
// TODO: Aside from one single note on `description` i can't find anywhere that says something about context commands having a special need, so, should we remove this?
/**
* - https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response-query-string-params
* - https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command-json-params
*/
export interface CreateContextApplicationCommand extends Omit<CreateSlashApplicationCommand, 'options' | 'description' | 'descriptionLocalizations'> {
/** The type of the command */
type: ApplicationCommandTypes.Message | ApplicationCommandTypes.User
}
export interface CreateGlobalApplicationCommandOptions {
/** The bearer token of the developer of the application */
bearerToken: string
}
export interface CreateGuildApplicationCommandOptions {
/** The bearer token of the developer of the application */
bearerToken: string
}
export interface UpsertGlobalApplicationCommandOptions {
/** The bearer token of the developer of the application */
bearerToken: string
}
export interface UpsertGuildApplicationCommandOptions {
/** The bearer token of the developer of the application */
bearerToken: string
}
/** Additional properties for https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions and https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
export interface GetApplicationCommandPermissionOptions {
/** Access token of the user. Requires the `applications.commands.permissions.update` scope */
accessToken: string
/** Id of the application */
applicationId: BigString
}

View File

@@ -0,0 +1,11 @@
/** Types for: https://discord.com/developers/docs/resources/invite */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/invite#get-invite */
export interface GetInvite {
/** Whether the invite should contain approximate member counts */
withCounts?: boolean
/** the guild scheduled event to include with the invite */
scheduledEventId?: BigString
}

View File

@@ -0,0 +1,47 @@
/** Types for: https://discord.com/developers/docs/resources/lobby */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/lobby#create-lobby */
export interface CreateLobby {
/** Optional dictionary of string key/value pairs. The max total length is 1000. */
metadata?: Record<string, string> | null
/** Optional array of up to 25 users to be added to the lobby */
members?: CreateLobbyMember[]
/** Seconds to wait before shutting down a lobby after it becomes idle. Value can be between 5 and 604800 (7 days). */
idleTimeoutSeconds?: number
}
/** https://discord.com/developers/docs/resources/lobby#create-lobby */
export interface CreateLobbyMember {
/** Discord user id of the user to add to the lobby */
id: BigString
/** Optional dictionary of string key/value pairs. The max total length is 1000. */
metadata?: Record<string, string> | null
/** Lobby member flags combined as a bitfield */
flags?: number
}
/** https://discord.com/developers/docs/resources/lobby#add-a-member-to-a-lobby */
export interface ModifyLobby {
/** Optional dictionary of string key/value pairs. The max total length is 1000. Overwrites any existing metadata. */
metadata?: Record<string, string> | null
/** Optional array of up to 25 users to replace the lobby members with. If provided, lobby members not in this list will be removed from the lobby. */
members?: CreateLobbyMember[]
/** Seconds to wait before shutting down a lobby after it becomes idle. Value can be between 5 and 604800 (7 days). */
idleTimeoutSeconds?: number
}
/** https://discord.com/developers/docs/resources/lobby#add-a-member-to-a-lobby */
export interface AddLobbyMember {
/** Optional dictionary of string key/value pairs. The max total length is 1000. */
metadata?: Record<string, string> | null
/** Lobby member flags combined as a bitfield */
flags?: number
}
/** https://discord.com/developers/docs/resources/lobby#link-channel-to-lobby */
export interface LinkChannelToLobby {
/** The id of the channel to link to the lobby. If not provided, will unlink any currently linked channels from the lobby. */
channelId?: BigString
}

View File

@@ -0,0 +1,137 @@
/** Types for: https://discord.com/developers/docs/resources/message */
import type {
AllowedMentionsTypes,
DiscordAttachment,
DiscordEmbed,
DiscordMessageReferenceType,
DiscordReactionType,
MessageFlags,
} from '../discord/message.js'
import type { BigString, Camelize } from '../shared.js'
import type { MessageComponents } from './components.js'
import type { CreatePoll } from './poll.js'
import type { FileContent } from './reference.js'
/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object */
export interface AllowedMentions {
/** An array of allowed mention types to parse from the content. */
parse?: AllowedMentionsTypes[]
/** For replies, whether to mention the author of the message being replied to (default false) */
repliedUser?: boolean
/** Array of role_ids to mention (Max size of 100) */
roles?: bigint[]
/** Array of user_ids to mention (Max size of 100) */
users?: bigint[]
}
// This needs the prefix Discordeno to avoid conflicts with the @discordeno/bot types.
/** https://discord.com/developers/docs/resources/message#message-reference-structure */
export interface DiscordenoMessageReference {
/** Type of reference */
type?: DiscordMessageReferenceType
/** id of the originating message */
messageId?: BigString
/**
* id of the originating message's channel
* Note: `channel_id` is optional when creating a reply, but will always be present when receiving an event/response that includes this data model.
*/
channelId?: BigString
/** id of the originating message's guild */
guildId?: BigString
/** When sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true */
failIfNotExists?: boolean
}
/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */
export interface GetMessagesLimit {
/** Max number of messages to return (1-100) default 50 */
limit?: number
}
/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */
export interface GetMessagesAround extends GetMessagesLimit {
/** Get messages around this message id */
around?: BigString
}
/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */
export interface GetMessagesBefore extends GetMessagesLimit {
/** Get messages before this message id */
before?: BigString
}
/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */
export interface GetMessagesAfter extends GetMessagesLimit {
/** Get messages after this message id */
after?: BigString
}
/** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */
export type GetMessagesOptions = GetMessagesAfter | GetMessagesBefore | GetMessagesAround | GetMessagesLimit
/** https://discord.com/developers/docs/resources/message#create-message-jsonform-params */
export interface CreateMessageOptions {
/** The message contents (up to 2000 characters) */
content?: string
/** Can be used to verify a message was sent (up to 25 characters). Value will appear in the Message Create event. */
nonce?: string | number
/** true if this is a TTS message */
tts?: boolean
/** Embedded `rich` content (up to 6000 characters) */
embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */
allowedMentions?: AllowedMentions
/** Include to make your message a reply or a forward */
messageReference?: DiscordenoMessageReference
/** The components you would like to have sent in this message */
components?: MessageComponents
/** IDs of up to 3 stickers in the server to send in the message */
stickerIds?: [BigString] | [BigString, BigString] | [BigString, BigString, BigString]
/** The contents of the files being sent */
files?: FileContent[]
/** Attachment objects with filename and description */
attachments?: Pick<DiscordAttachment, 'filename' | 'description' | 'id'>[]
/** Message flags combined as a bitfield, only SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS, IS_VOICE_MESSAGE, and IS_COMPONENTS_V2 can be set */
flags?: MessageFlags
/** If true and nonce is present, it will be checked for uniqueness in the past few minutes. If another message was created by the same author with the same nonce, that message will be returned and no new message will be created. */
enforceNonce?: boolean
/** A poll object */
poll?: CreatePoll
}
/** https://discord.com/developers/docs/resources/message#get-reactions-query-string-params */
export interface GetReactions {
/** The type of reaction */
type: DiscordReactionType
/** Get users after this user Id */
after?: string
/** Max number of users to return (1-100) */
limit?: number
}
/** https://discord.com/developers/docs/resources/channel#edit-message-json-params */
export interface EditMessage {
/** The new message contents (up to 2000 characters) */
content?: string | null
/** Embedded `rich` content (up to 6000 characters) */
embeds?: Camelize<DiscordEmbed>[] | null
/** Edit the flags of the message (only `SUPPRESS_EMBEDS` can currently be set/unset) */
flags?: MessageFlags | null
/** Allowed mentions for the message */
allowedMentions?: AllowedMentions | null
/** The components you would like to have sent in this message */
components?: MessageComponents
/** The contents of the files being sent/edited */
files?: FileContent[]
/** When specified (adding new attachments), attachments which are not provided in this list will be removed. */
attachments?: Pick<DiscordAttachment, 'filename' | 'description' | 'id'>[]
}
/** https://discord.com/developers/docs/resources/message#get-channel-pins-query-string-params */
export interface GetChannelPinsOptions {
/** Get messages pinned before this timestamp */
before?: string
/** Max number of pins to return (1-50), defaults to 50 */
limit?: number
}

View File

@@ -0,0 +1,11 @@
/** Types for: https://discord.com/developers/docs/topics/permissions */
/** https://discord.com/developers/docs/topics/permissions#role-object-role-colors-object */
export interface GuildRoleColors {
/** The primary color for the role */
primaryColor: number
/** The secondary color for the role, this will make the role a gradient between the other provided colors */
secondaryColor?: number
/** The tertiary color for the role, this will turn the gradient into a holographic style */
tertiaryColor?: number
}

View File

@@ -0,0 +1,41 @@
/** Types for: https://discord.com/developers/docs/resources/poll */
import type { DiscordPollAnswer, DiscordPollLayoutType, DiscordPollMedia } from '../discord/poll.js'
import type { BigString, Camelize } from '../shared.js'
/** https://discord.com/developers/docs/resources/poll#poll-create-request-object */
export interface CreatePoll {
/** The question of the poll. Only `text` is supported. */
question: Pick<Camelize<DiscordPollMedia>, 'text'>
/** Each of the answers available in the poll, up to 10 */
answers: Omit<Camelize<DiscordPollAnswer>, 'answerId'>[]
/**
* Number of hours the poll should be open for
*
* @remarks
* up to 32 days
*
* @default 24
*/
duration: number
/**
* Whether a user can select multiple answers
*
* @default false
*/
allowMultiselect: boolean
/** The layout type of the poll */
layoutType?: DiscordPollLayoutType
}
/** https://discord.com/developers/docs/resources/poll#get-answer-voters-query-string-params */
export interface GetPollAnswerVotes {
/** Get users after this user ID */
after?: BigString
/**
* Max number of users to return (1-100)
*
* @default 25
*/
limit?: number
}

View File

@@ -0,0 +1,8 @@
/** Types for: https://discord.com/developers/docs/reference */
export interface FileContent {
/** The file blob */
blob: Blob
/** The name of the file */
name: string
}

View File

@@ -0,0 +1,37 @@
/** Types for: https://discord.com/developers/docs/resources/soundboard */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound-json-params */
export interface SendSoundboardSound {
/** The id of the soundboard sound to play */
soundId: BigString
/** The id of the guild the soundboard sound is from, required to play sounds from different servers */
sourceGuildId?: BigString
}
/** https://discord.com/developers/docs/resources/soundboard#create-guild-soundboard-sound-json-params */
export interface CreateGuildSoundboardSound {
/** Name of the soundboard sound (2-32 characters) */
name: string
/** The mp3 or ogg sound data, base64 encoded, similar to image data */
sound: string
/** The volume of the soundboard sound, from 0 to 1, defaults to 1 */
volume?: number | null
/** The id of the custom emoji for the soundboard sound */
emojiId?: BigString | null
/** The unicode character of a standard emoji for the soundboard sound */
emojiName?: string | null
}
/** https://discord.com/developers/docs/resources/soundboard#modify-guild-soundboard-sound-json-params */
export interface ModifyGuildSoundboardSound {
/** Name of the soundboard sound (2-32 characters) */
name?: string
/** The volume of the soundboard sound, from 0 to 1, defaults to 1 */
volume?: number | null
/** The id of the custom emoji for the soundboard sound */
emojiId?: BigString | null
/** The unicode character of a standard emoji for the soundboard sound */
emojiName?: string | null
}

View File

@@ -0,0 +1,26 @@
/** Types for: https://discord.com/developers/docs/resources/stage-instance */
import type { DiscordStageInstancePrivacyLevel } from '../discord/stageInstance.js'
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/stage-instance#create-stage-instance-json-params */
export interface CreateStageInstance {
/** The id of the Stage channel */
channelId: BigString
/** The topic of the Stage instance (1-120 characters) */
topic: string
/** The privacy level of the Stage instance */
privacyLevel?: DiscordStageInstancePrivacyLevel
/** Notify \@everyone that the stage instance has started. Requires the MENTION_EVERYONE permission. */
sendStartNotification?: boolean
/** The guild scheduled event associated with this Stage instance */
guildScheduledEventId?: BigString
}
/** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance-json-params */
export interface EditStageInstanceOptions {
/** The topic of the Stage instance (1-120 characters) */
topic: string
/** The privacy level of the Stage instance */
privacyLevel?: DiscordStageInstancePrivacyLevel
}

View File

@@ -0,0 +1,25 @@
/** Types for: https://discord.com/developers/docs/resources/sticker */
import type { FileContent } from './reference.js'
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker-form-params */
export interface CreateGuildStickerOptions {
/** Name of the sticker (2-30 characters) */
name: string
/** Description of the sticker (empty or 2-100 characters) */
description: string
/** Autocomplete/suggestion tags for the sticker (max 200 characters) */
tags: string
/** The sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 512 KB */
file: FileContent
}
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker-json-params */
export interface EditGuildStickerOptions {
/** Name of the sticker (2-30 characters) */
name?: string
/** Description of the sticker (empty or 2-100 characters) */
description?: string | null
/** Autocomplete/suggestion tags for the sticker (max 200 characters) */
tags?: string
}

View File

@@ -0,0 +1,15 @@
/** Types for: https://discord.com/developers/docs/resources/subscription */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/subscription#query-string-params */
export interface ListSkuSubscriptionsOptions {
/** List subscriptions before this ID */
before?: BigString
/** List subscriptions after this ID */
after?: BigString
/** Number of results to return (1-100) */
limit?: number
/** User ID for which to return subscriptions. Required except for OAuth queries. */
userId?: BigString
}

View File

@@ -0,0 +1,23 @@
/** Types for: https://discord.com/developers/docs/resources/user */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/user#get-current-user-guilds-query-string-params */
export interface GetUserGuilds {
/** Get guilds before this guild ID */
before?: BigString
/** Get guilds after this guild ID */
after?: BigString
/** Maximum number of entries (between 1-200) to return, defaults to 200 */
limit?: number
/** Include approximate member and presence counts in response, defaults to false */
withCounts?: boolean
}
/** https://discord.com/developers/docs/resources/user#create-group-dm-json-params */
export interface GetGroupDmOptions {
/** Access tokens of users that have granted your app the `gdm.join` scope */
accessTokens: string[]
/** A mapping of user ids to their respective nicknames */
nicks: Record<string, string>
}

View File

@@ -0,0 +1,23 @@
/** Types for: https://discord.com/developers/docs/resources/voice */
import type { BigString } from '../shared.js'
/** https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state-json-params */
export interface EditOwnVoiceState {
/** The id of the channel the user is currently in */
channelId?: BigString
/** Toggles the user's suppress state */
suppress?: boolean
/** Sets the user's request to speak */
requestToSpeakTimestamp?: number | null
}
/** https://discord.com/developers/docs/resources/voice#modify-user-voice-state-json-params */
export interface EditUserVoiceState {
/** The id of the channel the user is currently in */
channelId?: BigString
/** Toggles the user's suppress state */
suppress?: boolean
/** The user id to target */
userId: BigString
}

View File

@@ -0,0 +1,142 @@
/** Types for: https://discord.com/developers/docs/resources/webhook */
import type { DiscordAttachment, DiscordEmbed } from '../discord/message.js'
import type { BigString, Camelize } from '../shared.js'
import type { MessageComponents } from './components.js'
import type { AllowedMentions } from './message.js'
import type { CreatePoll } from './poll.js'
import type { FileContent } from './reference.js'
/** https://discord.com/developers/docs/resources/webhook#create-webhook-json-params */
export interface CreateWebhook {
/** Name of the webhook (1-80 characters) */
name: string
/** Image url for the default webhook avatar */
avatar?: string | null
}
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-json-params */
export interface ModifyWebhook {
/** The default name of the webhook */
name?: string
/** Image for the default webhook avatar */
avatar?: BigString | null
/** The new channel id this webhook should be moved to */
channelId?: BigString
}
/** https://discord.com/developers/docs/resources/webhook#execute-webhook */
export interface ExecuteWebhook {
// Query Parameters
/** Waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error) */
wait?: boolean
/** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */
threadId?: BigString
/**
* Whether to respect the `components` field of the request.
* When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components.
*
* @default false
*/
withComponents?: boolean
// JSON Parameters
/** The message contents (up to 2000 characters) */
content?: string
/** Override the default username of the webhook */
username?: string
/** Override the default avatar of the webhook */
avatarUrl?: string
/** True if this is a TTS message */
tts?: boolean
/** Embedded `rich` content */
embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */
allowedMentions?: AllowedMentions
/**
* The components to include with the message
*
* @remarks
* Application-owned webhooks can always send components.
* Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param.
*/
components?: MessageComponents
/** The contents of the files being sent */
files?: FileContent[]
/** Attachment objects with filename and description */
attachments?: Pick<DiscordAttachment, 'filename' | 'description' | 'id'>[]
/**
* Message flags combined in a bitfield
*
* @see {@link MessageFlags}
*/
flags?: number
/** Name of the thread to create (target channel has to be type of forum channel) */
threadName?: string
/** Array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel) */
appliedTags?: BigString[]
/** A poll object */
poll?: CreatePoll
}
/** https://discord.com/developers/docs/resources/webhook#get-webhook-message-query-string-params */
export interface GetWebhookMessageOptions {
/** id of the thread the message is in */
threadId: BigString
}
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message */
export interface EditWebhookMessageOptions {
// Query parameters
/** Id of the thread the message is in */
threadId?: BigString
/**
* Whether to respect the `components` field of the request.
* When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components.
*
* @default false
*/
withComponents?: boolean
// JSON parameters
/** The message contents (up to 2000 characters) */
content?: string
/** Embedded `rich` content */
embeds?: Camelize<DiscordEmbed>[]
/**
* Message flags combined in a bitfield
*
* @see {@link MessageFlags}
*/
flags?: number
/** Allowed mentions for the message */
allowedMentions?: AllowedMentions
/**
* The components to include with the message
*
* @remarks
* Application-owned webhooks can always send components.
* Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param.
*/
components?: MessageComponents
/** The contents of the files being sent */
files?: FileContent[]
/** Attached files to keep and possible descriptions for new files */
attachments?: Pick<DiscordAttachment, 'filename' | 'description' | 'id'>[]
/**
* A poll!
*
* @remarks
* Polls can only be added when editing a deferred interaction response.
*/
poll?: CreatePoll
}
/** https://discord.com/developers/docs/resources/webhook#delete-webhook-message-query-string-params */
export interface DeleteWebhookMessageOptions {
/** id of the thread the message is in */
threadId: BigString
}

View File

@@ -29,5 +29,29 @@ export * from './discord/user.js'
export * from './discord/voice.js'
export * from './discord/webhook.js'
export * from './discord/webhookEvents.js'
export * from './discordeno.js'
export * from './discordeno/application.js'
export * from './discordeno/auditLog.js'
export * from './discordeno/autoModeration.js'
export * from './discordeno/channel.js'
export * from './discordeno/components.js'
export * from './discordeno/emoji.js'
export * from './discordeno/entitlement.js'
export * from './discordeno/gateway.js'
export * from './discordeno/guild.js'
export * from './discordeno/guildScheduledEvent.js'
export * from './discordeno/guildTemplate.js'
export * from './discordeno/interactions.js'
export * from './discordeno/invite.js'
export * from './discordeno/lobby.js'
export * from './discordeno/message.js'
export * from './discordeno/permissions.js'
export * from './discordeno/poll.js'
export * from './discordeno/reference.js'
export * from './discordeno/soundboard.js'
export * from './discordeno/stageInstance.js'
export * from './discordeno/sticker.js'
export * from './discordeno/subscription.js'
export * from './discordeno/user.js'
export * from './discordeno/voice.js'
export * from './discordeno/webhook.js'
export * from './shared.js'