discordx
Advanced tools
Comparing version 5.2.3 to 5.2.4
@@ -0,3 +1,7 @@ | ||
import { ChoicesType } from "../.."; | ||
import { ParameterDecoratorEx } from "../../types/public/decorators"; | ||
export declare function SlashChoice(name: string): ParameterDecoratorEx; | ||
export declare function SlashChoice(name: number): ParameterDecoratorEx; | ||
export declare function SlashChoice(name: string, value: number): ParameterDecoratorEx; | ||
export declare function SlashChoice(name: string, value: string): ParameterDecoratorEx; | ||
export declare function SlashChoice(choices: ChoicesType): ParameterDecoratorEx; |
@@ -8,3 +8,14 @@ "use strict"; | ||
__1.MetadataStorage.instance.addModifier(__1.Modifier.create((original) => { | ||
original.choices = [...original.choices, __1.DChoice.create(name, value)]; | ||
if (typeof name === "string" || typeof name === "number") { | ||
original.choices = [ | ||
...original.choices, | ||
__1.DChoice.create(name.toString(), value ? value : name), | ||
]; | ||
} | ||
else { | ||
const allChoices = Object.keys(name).map((key) => { | ||
return __1.DChoice.create(key, name[key]); | ||
}); | ||
original.choices = [...original.choices, ...allChoices]; | ||
} | ||
}, __1.DOption).decorate(target.constructor, key, target[key], target.constructor, index)); | ||
@@ -11,0 +22,0 @@ }; |
import { SlashChoice } from "./decorators/SlashChoice"; | ||
import { SlashChoices } from "./decorators/SlashChoices"; | ||
import { SlashGroup } from "./decorators/SlashGroup"; | ||
@@ -14,5 +13,5 @@ import { SlashOption } from "./decorators/SlashOption"; | ||
/** | ||
* @deprecated Use `SlashChoices` instead. | ||
* @deprecated Use `SlashChoice` instead. | ||
*/ | ||
export declare const Choices: typeof SlashChoices; | ||
export declare const Choices: typeof SlashChoice; | ||
/** | ||
@@ -31,3 +30,2 @@ * @deprecated Use `SlashGroup` instead. | ||
export * from "./decorators/SlashChoice"; | ||
export * from "./decorators/SlashChoices"; | ||
export * from "./decorators/DefaultPermission"; | ||
@@ -34,0 +32,0 @@ export * from "./decorators/Permission"; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const SlashChoice_1 = require("./decorators/SlashChoice"); | ||
const SlashChoices_1 = require("./decorators/SlashChoices"); | ||
const SlashGroup_1 = require("./decorators/SlashGroup"); | ||
@@ -19,5 +18,5 @@ const SlashOption_1 = require("./decorators/SlashOption"); | ||
/** | ||
* @deprecated Use `SlashChoices` instead. | ||
* @deprecated Use `SlashChoice` instead. | ||
*/ | ||
exports.Choices = SlashChoices_1.SlashChoices; | ||
exports.Choices = SlashChoice_1.SlashChoice; | ||
/** | ||
@@ -37,3 +36,2 @@ * @deprecated Use `SlashGroup` instead. | ||
tslib_1.__exportStar(require("./decorators/SlashChoice"), exports); | ||
tslib_1.__exportStar(require("./decorators/SlashChoices"), exports); | ||
tslib_1.__exportStar(require("./decorators/DefaultPermission"), exports); | ||
@@ -40,0 +38,0 @@ tslib_1.__exportStar(require("./decorators/Permission"), exports); |
{ | ||
"name": "discordx", | ||
"version": "5.2.3", | ||
"version": "5.2.4", | ||
"description": "Create your discord bot by using TypeScript and decorators!", | ||
@@ -43,6 +43,6 @@ "main": "build/index.js", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^16.4.3", | ||
"@typescript-eslint/eslint-plugin": "^4.24.0", | ||
"@typescript-eslint/parser": "^4.24.0", | ||
"eslint": "^7.26.0", | ||
"@types/node": "^16.4.10", | ||
"@typescript-eslint/eslint-plugin": "^4.29.0", | ||
"@typescript-eslint/parser": "^4.29.0", | ||
"eslint": "^7.32.0", | ||
"jest": "^27.0.6", | ||
@@ -49,0 +49,0 @@ "prettier": "2.3.2", |
@@ -98,3 +98,2 @@ # Why discordx? | ||
- `@SlashChoice` | ||
- `@SlashChoices` | ||
- `@SlashGroup` | ||
@@ -101,0 +100,0 @@ - `@SlashOption` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
202683
174
3177
276