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>
This commit is contained in:
Jiralite
2023-01-02 15:24:10 +00:00
committed by GitHub
parent 6d7a143667
commit 7dec892218
2 changed files with 10 additions and 4 deletions

View File

@@ -518,7 +518,7 @@ class ApplicationCommand extends Base {
* {@link ApplicationCommandOptionType.Number} option * {@link ApplicationCommandOptionType.Number} option
* @property {ApplicationCommandOptionChoice[]} [choices] The choices of the option for the user to pick from * @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 {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 * the allowed types of channels that can be selected
* @property {number} [minValue] The minimum value for an {@link ApplicationCommandOptionType.Integer} or * @property {number} [minValue] The minimum value for an {@link ApplicationCommandOptionType.Integer} or
* {@link ApplicationCommandOptionType.Number} option * {@link ApplicationCommandOptionType.Number} option
@@ -599,3 +599,8 @@ module.exports = ApplicationCommand;
* @external APIApplicationCommandOption * @external APIApplicationCommandOption
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure} * @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}
*/

View File

@@ -35,6 +35,7 @@ import {
AnyComponentBuilder, AnyComponentBuilder,
ComponentBuilder, ComponentBuilder,
type RestOrArray, type RestOrArray,
ApplicationCommandOptionAllowedChannelTypes,
} from '@discordjs/builders'; } from '@discordjs/builders';
import { Awaitable, JSONEncodable } from '@discordjs/util'; import { Awaitable, JSONEncodable } from '@discordjs/util';
import { Collection } from '@discordjs/collection'; import { Collection } from '@discordjs/collection';
@@ -4281,13 +4282,13 @@ export type ApplicationCommandData =
export interface ApplicationCommandChannelOptionData extends BaseApplicationCommandOptionsData { export interface ApplicationCommandChannelOptionData extends BaseApplicationCommandOptionsData {
type: CommandOptionChannelResolvableType; type: CommandOptionChannelResolvableType;
channelTypes?: ChannelType[]; channelTypes?: ApplicationCommandOptionAllowedChannelTypes[];
channel_types?: ChannelType[]; channel_types?: ApplicationCommandOptionAllowedChannelTypes[];
} }
export interface ApplicationCommandChannelOption extends BaseApplicationCommandOptionsData { export interface ApplicationCommandChannelOption extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Channel; type: ApplicationCommandOptionType.Channel;
channelTypes?: ChannelType[]; channelTypes?: ApplicationCommandOptionAllowedChannelTypes[];
} }
export interface ApplicationCommandRoleOptionData extends BaseApplicationCommandOptionsData { export interface ApplicationCommandRoleOptionData extends BaseApplicationCommandOptionsData {