fix(builders): update allowed channel types to include DM and GroupDM

This commit is contained in:
almeidx
2026-09-07 15:25:12 +01:00
parent 5f6cbf111e
commit c5a50741e3
2 changed files with 10 additions and 0 deletions
@@ -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]>
>;
@@ -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<