From 7dec892218f7b470a5f8e78732a524a53da24d26 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Mon, 2 Jan 2023 15:24:10 +0000 Subject: [PATCH] types: Allow builders to set channel types in discord.js (#8990) types: allow builders to set channel types Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/discord.js/src/structures/ApplicationCommand.js | 7 ++++++- packages/discord.js/typings/index.d.ts | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/discord.js/src/structures/ApplicationCommand.js b/packages/discord.js/src/structures/ApplicationCommand.js index 64374f153..e2337e0d2 100644 --- a/packages/discord.js/src/structures/ApplicationCommand.js +++ b/packages/discord.js/src/structures/ApplicationCommand.js @@ -518,7 +518,7 @@ class ApplicationCommand extends Base { * {@link ApplicationCommandOptionType.Number} option * @property {ApplicationCommandOptionChoice[]} [choices] The choices of the option for the user to pick from * @property {ApplicationCommandOption[]} [options] Additional options if this option is a subcommand (group) - * @property {ChannelType[]} [channelTypes] When the option type is channel, + * @property {ApplicationCommandOptionAllowedChannelTypes[]} [channelTypes] When the option type is channel, * the allowed types of channels that can be selected * @property {number} [minValue] The minimum value for an {@link ApplicationCommandOptionType.Integer} or * {@link ApplicationCommandOptionType.Number} option @@ -599,3 +599,8 @@ module.exports = ApplicationCommand; * @external APIApplicationCommandOption * @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure} */ + +/** + * @external ApplicationCommandOptionAllowedChannelTypes + * @see {@link https://discord.js.org/#/docs/builders/main/typedef/ApplicationCommandOptionAllowedChannelTypes} + */ diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 475d313d2..336d3cdd9 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -35,6 +35,7 @@ import { AnyComponentBuilder, ComponentBuilder, type RestOrArray, + ApplicationCommandOptionAllowedChannelTypes, } from '@discordjs/builders'; import { Awaitable, JSONEncodable } from '@discordjs/util'; import { Collection } from '@discordjs/collection'; @@ -4281,13 +4282,13 @@ export type ApplicationCommandData = export interface ApplicationCommandChannelOptionData extends BaseApplicationCommandOptionsData { type: CommandOptionChannelResolvableType; - channelTypes?: ChannelType[]; - channel_types?: ChannelType[]; + channelTypes?: ApplicationCommandOptionAllowedChannelTypes[]; + channel_types?: ApplicationCommandOptionAllowedChannelTypes[]; } export interface ApplicationCommandChannelOption extends BaseApplicationCommandOptionsData { type: ApplicationCommandOptionType.Channel; - channelTypes?: ChannelType[]; + channelTypes?: ApplicationCommandOptionAllowedChannelTypes[]; } export interface ApplicationCommandRoleOptionData extends BaseApplicationCommandOptionsData {