Comparing version 11.1.7 to 11.1.8
import { Decorator } from "@discordx/internal"; | ||
import type { ApplicationCommandOptionChoiceData } from "discord.js"; | ||
import type { SlashChoiceType } from "../../types/index.js"; | ||
import type { LocalizationMap } from "discord.js"; | ||
import type { ApplicationCommandOptionChoiceDataEx, SlashChoiceType } from "../../types/index.js"; | ||
/** | ||
@@ -9,10 +9,13 @@ * @category Decorator | ||
private _name; | ||
private _nameLocalizations; | ||
private _value; | ||
get name(): string; | ||
set name(value: string); | ||
get nameLocalizations(): LocalizationMap | null; | ||
set nameLocalizations(value: LocalizationMap | null); | ||
get value(): string | number; | ||
set value(value: string | number); | ||
protected constructor(name: string, value: string | number); | ||
protected constructor(data: SlashChoiceType); | ||
static create(data: SlashChoiceType): DApplicationCommandOptionChoice; | ||
toJSON(): ApplicationCommandOptionChoiceData; | ||
toJSON(): ApplicationCommandOptionChoiceDataEx; | ||
} |
@@ -10,2 +10,3 @@ "use strict"; | ||
_name; | ||
_nameLocalizations; | ||
_value; | ||
@@ -18,2 +19,8 @@ get name() { | ||
} | ||
get nameLocalizations() { | ||
return this._nameLocalizations; | ||
} | ||
set nameLocalizations(value) { | ||
this._nameLocalizations = value; | ||
} | ||
get value() { | ||
@@ -25,9 +32,10 @@ return this._value; | ||
} | ||
constructor(name, value) { | ||
constructor(data) { | ||
super(); | ||
this._name = name; | ||
this._value = value; | ||
this._name = data.name; | ||
this._nameLocalizations = data.nameLocalizations ?? null; | ||
this._value = data.value ?? data.name; | ||
} | ||
static create(data) { | ||
return new DApplicationCommandOptionChoice(data.name, data.value ?? data.name); | ||
return new DApplicationCommandOptionChoice(data); | ||
} | ||
@@ -37,2 +45,3 @@ toJSON() { | ||
name: this.name, | ||
nameLocalizations: this.nameLocalizations, | ||
value: this.value, | ||
@@ -39,0 +48,0 @@ }; |
@@ -103,2 +103,3 @@ import type { ClientEvents, LocalizationMap, PermissionResolvable, RestEvents } from "discord.js"; | ||
name: NotEmpty<T>; | ||
nameLocalizations?: LocalizationMap; | ||
value?: X; | ||
@@ -105,0 +106,0 @@ }; |
@@ -61,1 +61,6 @@ import type { ApplicationCommandOptionData, ApplicationCommandOptionType, ApplicationCommandType, AutocompleteInteraction, ChannelType, LocalizationMap, PermissionResolvable } from "discord.js"; | ||
}; | ||
export interface ApplicationCommandOptionChoiceDataEx { | ||
name: string; | ||
nameLocalizations?: LocalizationMap | null; | ||
value: string | number; | ||
} |
import { Decorator } from "@discordx/internal"; | ||
import type { ApplicationCommandOptionChoiceData } from "discord.js"; | ||
import type { SlashChoiceType } from "../../types/index.js"; | ||
import type { LocalizationMap } from "discord.js"; | ||
import type { ApplicationCommandOptionChoiceDataEx, SlashChoiceType } from "../../types/index.js"; | ||
/** | ||
@@ -9,10 +9,13 @@ * @category Decorator | ||
private _name; | ||
private _nameLocalizations; | ||
private _value; | ||
get name(): string; | ||
set name(value: string); | ||
get nameLocalizations(): LocalizationMap | null; | ||
set nameLocalizations(value: LocalizationMap | null); | ||
get value(): string | number; | ||
set value(value: string | number); | ||
protected constructor(name: string, value: string | number); | ||
protected constructor(data: SlashChoiceType); | ||
static create(data: SlashChoiceType): DApplicationCommandOptionChoice; | ||
toJSON(): ApplicationCommandOptionChoiceData; | ||
toJSON(): ApplicationCommandOptionChoiceDataEx; | ||
} |
@@ -7,2 +7,3 @@ import { Decorator } from "@discordx/internal"; | ||
_name; | ||
_nameLocalizations; | ||
_value; | ||
@@ -15,2 +16,8 @@ get name() { | ||
} | ||
get nameLocalizations() { | ||
return this._nameLocalizations; | ||
} | ||
set nameLocalizations(value) { | ||
this._nameLocalizations = value; | ||
} | ||
get value() { | ||
@@ -22,9 +29,10 @@ return this._value; | ||
} | ||
constructor(name, value) { | ||
constructor(data) { | ||
super(); | ||
this._name = name; | ||
this._value = value; | ||
this._name = data.name; | ||
this._nameLocalizations = data.nameLocalizations ?? null; | ||
this._value = data.value ?? data.name; | ||
} | ||
static create(data) { | ||
return new DApplicationCommandOptionChoice(data.name, data.value ?? data.name); | ||
return new DApplicationCommandOptionChoice(data); | ||
} | ||
@@ -34,2 +42,3 @@ toJSON() { | ||
name: this.name, | ||
nameLocalizations: this.nameLocalizations, | ||
value: this.value, | ||
@@ -36,0 +45,0 @@ }; |
@@ -103,2 +103,3 @@ import type { ClientEvents, LocalizationMap, PermissionResolvable, RestEvents } from "discord.js"; | ||
name: NotEmpty<T>; | ||
nameLocalizations?: LocalizationMap; | ||
value?: X; | ||
@@ -105,0 +106,0 @@ }; |
@@ -61,1 +61,6 @@ import type { ApplicationCommandOptionData, ApplicationCommandOptionType, ApplicationCommandType, AutocompleteInteraction, ChannelType, LocalizationMap, PermissionResolvable } from "discord.js"; | ||
}; | ||
export interface ApplicationCommandOptionChoiceDataEx { | ||
name: string; | ||
nameLocalizations?: LocalizationMap | null; | ||
value: string | number; | ||
} |
{ | ||
"name": "discordx", | ||
"version": "11.1.7", | ||
"version": "11.1.8", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Create a discord bot with TypeScript and Decorators!", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
597825
9927