Skip to content

Commit 29d115c

Browse files
committed
feat: ApplicationCommandOptionChoice
1 parent 157e14e commit 29d115c

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed
Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
1-
// import { DiscordSnowflake } from '@sapphire/snowflake';
2-
// import type { APIApplicationCommandOptionChoice } from 'discord-api-types/v10';
3-
// import { Structure } from '../../Structure.js';
4-
// import { kData } from '../../utils/symbols.js';
5-
// import { isIdSet } from '../../utils/type-guards.js';
6-
// import type { Partialize } from '../../utils/types.js';
1+
import type { APIApplicationCommandOptionChoice } from 'discord-api-types/v10';
2+
import { Structure } from '../../Structure.js';
3+
import { kData } from '../../utils/symbols.js';
4+
import type { Partialize } from '../../utils/types.js';
75

8-
// /**
9-
// * Represents any application command option choice on Discord.
10-
// *
11-
// * @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
12-
// * @remarks has substructure `User` which needs to be instantiated and stored by an extending class using it
13-
// * @remarks intentionally does not export `roles` so that extending classes can resolve `Snowflake[]` to `Role[]`
14-
// */
15-
// export class ApplicationCommandOptionChoice<Omitted extends keyof ApplicationCommandOptionChoice | '' = ''> extends Structure<ApplicationCommandOptionChoice, Omitted> {
16-
// /**
17-
// * The template used for removing data from the raw data stored for each application command option choice
18-
// */
19-
// public static override readonly DataTemplate: Partial<ApplicationCommandOptionChoice> = {};
6+
/**
7+
* Represents any application command option choice on Discord.
8+
*
9+
* @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 `User` which needs to be instantiated and stored by an extending class using it
11+
*/
12+
export class ApplicationCommandOptionChoice<Omitted extends keyof APIApplicationCommandOptionChoice | '' = ''> extends Structure<APIApplicationCommandOptionChoice, Omitted> {
13+
/**
14+
* The template used for removing data from the raw data stored for each application command option choice
15+
*/
16+
public static override readonly DataTemplate: Partial<APIApplicationCommandOptionChoice> = {};
2017

21-
// /**
22-
// * @param data - The raw data received from the API for the application command option choice
23-
// */
24-
// public constructor(data: Partialize<ApplicationCommandOptionChoice, Omitted>) {
25-
// super(data);
26-
// }
18+
/**
19+
* @param data - The raw data received from the API for the application command option choice
20+
*/
21+
public constructor(data: Partialize<APIApplicationCommandOptionChoice, Omitted>) {
22+
super(data);
23+
}
2724

28-
// /**
29-
// * 1-100 character choice name
30-
// */
31-
// public get name() {
32-
// return this[kData].name
33-
// }
34-
// }
35-
console.log();
25+
/**
26+
* 1-100 character choice name
27+
*/
28+
public get name() {
29+
return this[kData].name
30+
}
31+
32+
/**
33+
* Type of value depends on the option type that the choice belongs to
34+
*/
35+
public get value() {
36+
return this[kData].value;
37+
}
38+
}

0 commit comments

Comments
 (0)