mirror of
https://github.com/discordjs/discord.js.git
synced 2026-09-17 08:47:27 +00:00
fix(builders): update allowed channel types to include DM and GroupDM
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import type { ApplicationCommandOptionAllowedChannelType } from 'discord-api-types/v10';
|
||||
import { expectTypeOf } from 'vitest';
|
||||
import {
|
||||
type ApplicationCommandOptionAllowedChannelTypes,
|
||||
ChatInputCommandBuilder,
|
||||
ChatInputCommandStringOption,
|
||||
ChatInputCommandSubcommandBuilder,
|
||||
} from '../src/index.js';
|
||||
|
||||
type AssertNever<Type extends never> = Type;
|
||||
|
||||
const getBuilder = () => new ChatInputCommandBuilder();
|
||||
const getStringOption = () => new ChatInputCommandStringOption().setName('owo').setDescription('Testing 123');
|
||||
const getSubcommand = () => new ChatInputCommandSubcommandBuilder().setName('owo').setDescription('Testing 123');
|
||||
@@ -19,3 +23,7 @@ type BuilderPropsOnly<Type = ChatInputCommandBuilder> = Pick<
|
||||
expectTypeOf(getBuilder().addStringOptions(getStringOption())).toMatchTypeOf<BuilderPropsOnly>();
|
||||
|
||||
expectTypeOf(getBuilder().addSubcommands(getSubcommand())).toMatchTypeOf<BuilderPropsOnly>();
|
||||
|
||||
export type CheckExhaustiveAllowedChannelTypes = AssertNever<
|
||||
Exclude<ApplicationCommandOptionAllowedChannelType, (typeof ApplicationCommandOptionAllowedChannelTypes)[number]>
|
||||
>;
|
||||
|
||||
+2
@@ -16,6 +16,8 @@ export const ApplicationCommandOptionAllowedChannelTypes = [
|
||||
ChannelType.GuildStageVoice,
|
||||
ChannelType.GuildForum,
|
||||
ChannelType.GuildMedia,
|
||||
ChannelType.DM,
|
||||
ChannelType.GroupDM,
|
||||
] as const satisfies readonly ApplicationCommandOptionAllowedChannelType[];
|
||||
|
||||
export interface ApplicationCommandOptionChannelTypesData extends Pick<
|
||||
|
||||
Reference in New Issue
Block a user