Skip to content

Commit 76fb512

Browse files
committed
feat: ApplicationCommandOptionBase
1 parent 533e09b commit 76fb512

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

packages/structures/src/applicationCommands/ApplicationCommandOptions/ApplicationCommandOptionBase.ts

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { APIApplicationCommandOption, ApplicationCommandOptionType } from 'discord-api-types/v10';
1+
import type { APIApplicationCommandOptionBase, ApplicationCommandOptionType } from 'discord-api-types/v10';
22
import { Structure } from '../../Structure.js';
33
import { kData } from '../../utils/symbols.js';
44
import type { Partialize } from '../../utils/types.js';
@@ -7,27 +7,21 @@ import type { Partialize } from '../../utils/types.js';
77
* Represents any application command option on Discord.
88
*
99
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
10-
* @remarks has substructure `ApplicationCommandOptionChoice` which needs to be instantiated and stored by an extending class using it
11-
* @remarks intentionally does not export `options` so that extending classes can resolve to `ApplicationCommandOption[]`
1210
* @remarks required options must be listed before optional options
1311
*/
14-
export class ApplicationCommandOptionBase<
15-
Omitted extends keyof APIApplicationCommandOption | '' = '',
16-
> extends Structure<APIApplicationCommandOption, Omitted> {
17-
/**
18-
* The template used for removing data from the raw data stored for each application command option
19-
*/
20-
public static override readonly DataTemplate: Partial<APIApplicationCommandOption> = {};
21-
12+
export abstract class ApplicationCommandOptionBase<
13+
CommandOptionType extends ApplicationCommandOptionType,
14+
Omitted extends keyof APIApplicationCommandOptionBase<CommandOptionType> | '' = '',
15+
> extends Structure<APIApplicationCommandOptionBase<CommandOptionType>, Omitted> {
2216
/**
2317
* @param data - The raw data received from the API for the application command option
2418
*/
25-
public constructor(data: Partialize<APIApplicationCommandOption, Omitted>) {
19+
public constructor(data: Partialize<APIApplicationCommandOptionBase<CommandOptionType>, Omitted>) {
2620
super(data);
2721
}
2822

2923
/**
30-
* Type of option
24+
* Type of this option
3125
*
3226
* @remarks Valid option types: ALL
3327
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type}
@@ -87,13 +81,4 @@ export class ApplicationCommandOptionBase<
8781
public get required() {
8882
return this[kData].required;
8983
}
90-
91-
/**
92-
* The channels shown will be restricted to these types
93-
*
94-
* @remarks Valid option types: {@link ApplicationCommandOptionType.Channel}
95-
*/
96-
public get channelTypes() {
97-
return this[kData];
98-
}
9984
}

0 commit comments

Comments
 (0)