@discordjs/builders 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/README.md +28 -8
- package/dist/index.d.ts +850 -17
- package/dist/index.js +4 -21
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +4 -38
- package/dist/index.mjs.map +7 -0
- package/package.json +54 -42
- package/dist/index.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/Assertions.d.ts +0 -6
- package/dist/interactions/contextMenuCommands/Assertions.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/Assertions.js +0 -32
- package/dist/interactions/contextMenuCommands/Assertions.js.map +0 -1
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts +0 -43
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.js +0 -85
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.js.map +0 -1
- package/dist/interactions/slashCommands/Assertions.d.ts +0 -12
- package/dist/interactions/slashCommands/Assertions.d.ts.map +0 -1
- package/dist/interactions/slashCommands/Assertions.js +0 -63
- package/dist/interactions/slashCommands/Assertions.js.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +0 -58
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.js +0 -113
- package/dist/interactions/slashCommands/SlashCommandBuilder.js.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +0 -54
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandSubcommands.js +0 -123
- package/dist/interactions/slashCommands/SlashCommandSubcommands.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.d.ts +0 -18
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.js +0 -58
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts +0 -15
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.js +0 -48
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts +0 -49
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js +0 -71
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts +0 -54
- package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptions.js +0 -91
- package/dist/interactions/slashCommands/mixins/CommandOptions.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts +0 -15
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/NameAndDescription.js +0 -42
- package/dist/interactions/slashCommands/mixins/NameAndDescription.js.map +0 -1
- package/dist/interactions/slashCommands/options/boolean.d.ts +0 -7
- package/dist/interactions/slashCommands/options/boolean.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/boolean.js +0 -18
- package/dist/interactions/slashCommands/options/boolean.js.map +0 -1
- package/dist/interactions/slashCommands/options/channel.d.ts +0 -7
- package/dist/interactions/slashCommands/options/channel.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/channel.js +0 -18
- package/dist/interactions/slashCommands/options/channel.js.map +0 -1
- package/dist/interactions/slashCommands/options/integer.d.ts +0 -7
- package/dist/interactions/slashCommands/options/integer.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/integer.js +0 -18
- package/dist/interactions/slashCommands/options/integer.js.map +0 -1
- package/dist/interactions/slashCommands/options/mentionable.d.ts +0 -7
- package/dist/interactions/slashCommands/options/mentionable.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/mentionable.js +0 -18
- package/dist/interactions/slashCommands/options/mentionable.js.map +0 -1
- package/dist/interactions/slashCommands/options/number.d.ts +0 -7
- package/dist/interactions/slashCommands/options/number.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/number.js +0 -18
- package/dist/interactions/slashCommands/options/number.js.map +0 -1
- package/dist/interactions/slashCommands/options/role.d.ts +0 -7
- package/dist/interactions/slashCommands/options/role.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/role.js +0 -18
- package/dist/interactions/slashCommands/options/role.js.map +0 -1
- package/dist/interactions/slashCommands/options/string.d.ts +0 -7
- package/dist/interactions/slashCommands/options/string.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/string.js +0 -18
- package/dist/interactions/slashCommands/options/string.js.map +0 -1
- package/dist/interactions/slashCommands/options/user.d.ts +0 -7
- package/dist/interactions/slashCommands/options/user.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/user.js +0 -18
- package/dist/interactions/slashCommands/options/user.js.map +0 -1
- package/dist/messages/embed/Assertions.d.ts +0 -23
- package/dist/messages/embed/Assertions.d.ts.map +0 -1
- package/dist/messages/embed/Assertions.js +0 -26
- package/dist/messages/embed/Assertions.js.map +0 -1
- package/dist/messages/embed/Embed.d.ts +0 -140
- package/dist/messages/embed/Embed.d.ts.map +0 -1
- package/dist/messages/embed/Embed.js +0 -300
- package/dist/messages/embed/Embed.js.map +0 -1
- package/dist/messages/formatters.d.ts +0 -198
- package/dist/messages/formatters.d.ts.map +0 -1
- package/dist/messages/formatters.js +0 -181
- package/dist/messages/formatters.js.map +0 -1
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateDefaultPermission = exports.validateType = exports.validateName = exports.validateRequiredParameters = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ow_1 = (0, tslib_1.__importDefault)(require("ow"));
|
|
6
|
-
require("discord-api-types/v9");
|
|
7
|
-
function validateRequiredParameters(name, type) {
|
|
8
|
-
// Assert name matches all conditions
|
|
9
|
-
validateName(name);
|
|
10
|
-
// Assert type is valid
|
|
11
|
-
validateType(type);
|
|
12
|
-
}
|
|
13
|
-
exports.validateRequiredParameters = validateRequiredParameters;
|
|
14
|
-
const namePredicate = ow_1.default.string
|
|
15
|
-
.minLength(1)
|
|
16
|
-
.maxLength(32)
|
|
17
|
-
.matches(/^( *[\p{L}\p{N}_-]+ *)+$/u);
|
|
18
|
-
function validateName(name) {
|
|
19
|
-
(0, ow_1.default)(name, 'name', namePredicate);
|
|
20
|
-
}
|
|
21
|
-
exports.validateName = validateName;
|
|
22
|
-
const typePredicate = ow_1.default.number.oneOf([2 /* User */, 3 /* Message */]);
|
|
23
|
-
function validateType(type) {
|
|
24
|
-
(0, ow_1.default)(type, 'type', typePredicate);
|
|
25
|
-
}
|
|
26
|
-
exports.validateType = validateType;
|
|
27
|
-
const defaultPermissionPredicate = ow_1.default.boolean;
|
|
28
|
-
function validateDefaultPermission(value) {
|
|
29
|
-
(0, ow_1.default)(value, 'default_permission', defaultPermissionPredicate);
|
|
30
|
-
}
|
|
31
|
-
exports.validateDefaultPermission = validateDefaultPermission;
|
|
32
|
-
//# sourceMappingURL=Assertions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Assertions.js","sourceRoot":"/","sources":["interactions/contextMenuCommands/Assertions.ts"],"names":[],"mappings":";;;;AAAA,yDAAoB;AACpB,gCAA8D;AAG9D,SAAgB,0BAA0B,CAAC,IAAY,EAAE,IAAY;IACpE,qCAAqC;IACrC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEnB,uBAAuB;IACvB,YAAY,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;AAND,gEAMC;AAED,MAAM,aAAa,GAAG,YAAE,CAAC,MAAM;KAC7B,SAAS,CAAC,CAAC,CAAC;KACZ,SAAS,CAAC,EAAE,CAAC;KACb,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAEvC,SAAgB,YAAY,CAAC,IAAa;IACzC,IAAA,YAAE,EAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AACjC,CAAC;AAFD,oCAEC;AAED,MAAM,aAAa,GAAG,YAAE,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA6D,CAAC,CAAC;AAErG,SAAgB,YAAY,CAAC,IAAa;IACzC,IAAA,YAAE,EAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AACjC,CAAC;AAFD,oCAEC;AAED,MAAM,0BAA0B,GAAG,YAAE,CAAC,OAAO,CAAC;AAE9C,SAAgB,yBAAyB,CAAC,KAAc;IACvD,IAAA,YAAE,EAAC,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,CAAC,CAAC;AAC7D,CAAC;AAFD,8DAEC","sourcesContent":["import ow from 'ow';\nimport { ApplicationCommandType } from 'discord-api-types/v9';\nimport type { ContextMenuCommandType } from './ContextMenuCommandBuilder';\n\nexport function validateRequiredParameters(name: string, type: number) {\n\t// Assert name matches all conditions\n\tvalidateName(name);\n\n\t// Assert type is valid\n\tvalidateType(type);\n}\n\nconst namePredicate = ow.string\n\t.minLength(1)\n\t.maxLength(32)\n\t.matches(/^( *[\\p{L}\\p{N}_-]+ *)+$/u);\n\nexport function validateName(name: unknown): asserts name is string {\n\tow(name, 'name', namePredicate);\n}\n\nconst typePredicate = ow.number.oneOf([ApplicationCommandType.User, ApplicationCommandType.Message]);\n\nexport function validateType(type: unknown): asserts type is ContextMenuCommandType {\n\tow(type, 'type', typePredicate);\n}\n\nconst defaultPermissionPredicate = ow.boolean;\n\nexport function validateDefaultPermission(value: unknown): asserts value is boolean {\n\tow(value, 'default_permission', defaultPermissionPredicate);\n}\n"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ApplicationCommandType, RESTPostAPIApplicationCommandsJSONBody } from 'discord-api-types/v9';
|
|
2
|
-
export declare class ContextMenuCommandBuilder {
|
|
3
|
-
/**
|
|
4
|
-
* The name of this context menu command
|
|
5
|
-
*/
|
|
6
|
-
readonly name: string;
|
|
7
|
-
/**
|
|
8
|
-
* The type of this context menu command
|
|
9
|
-
*/
|
|
10
|
-
readonly type: ContextMenuCommandType;
|
|
11
|
-
/**
|
|
12
|
-
* Whether the command is enabled by default when the app is added to a guild
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
readonly defaultPermission: boolean | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Sets the name
|
|
18
|
-
* @param name The name
|
|
19
|
-
*/
|
|
20
|
-
setName(name: string): this;
|
|
21
|
-
/**
|
|
22
|
-
* Sets the type
|
|
23
|
-
* @param type The type
|
|
24
|
-
*/
|
|
25
|
-
setType(type: ContextMenuCommandType): this;
|
|
26
|
-
/**
|
|
27
|
-
* Sets whether the command is enabled by default when the application is added to a guild.
|
|
28
|
-
*
|
|
29
|
-
* **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.
|
|
30
|
-
* @param value Whether or not to enable this command by default
|
|
31
|
-
*
|
|
32
|
-
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
33
|
-
*/
|
|
34
|
-
setDefaultPermission(value: boolean): this;
|
|
35
|
-
/**
|
|
36
|
-
* Returns the final data that should be sent to Discord.
|
|
37
|
-
*
|
|
38
|
-
* **Note:** Calling this function will validate required properties based on their conditions.
|
|
39
|
-
*/
|
|
40
|
-
toJSON(): RESTPostAPIApplicationCommandsJSONBody;
|
|
41
|
-
}
|
|
42
|
-
export declare type ContextMenuCommandType = ApplicationCommandType.User | ApplicationCommandType.Message;
|
|
43
|
-
//# sourceMappingURL=ContextMenuCommandBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuCommandBuilder.d.ts","sourceRoot":"/","sources":["interactions/contextMenuCommands/ContextMenuCommandBuilder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sCAAsC,EAAE,MAAM,sBAAsB,CAAC;AAE3G,qBAAa,yBAAyB;IACrC;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,IAAI,EAAE,sBAAsB,CAAc;IAE1D;;;OAGG;IACH,SAAgB,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAa;IAEnE;;;OAGG;IACI,OAAO,CAAC,IAAI,EAAE,MAAM;IAS3B;;;OAGG;IACI,OAAO,CAAC,IAAI,EAAE,sBAAsB;IAS3C;;;;;;;OAOG;IACI,oBAAoB,CAAC,KAAK,EAAE,OAAO;IAS1C;;;;OAIG;IACI,MAAM,IAAI,sCAAsC;CAQvD;AAED,oBAAY,sBAAsB,GAAG,sBAAsB,CAAC,IAAI,GAAG,sBAAsB,CAAC,OAAO,CAAC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextMenuCommandBuilder = void 0;
|
|
4
|
-
const Assertions_1 = require("./Assertions");
|
|
5
|
-
class ContextMenuCommandBuilder {
|
|
6
|
-
constructor() {
|
|
7
|
-
/**
|
|
8
|
-
* The name of this context menu command
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(this, "name", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: undefined
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* The type of this context menu command
|
|
18
|
-
*/
|
|
19
|
-
Object.defineProperty(this, "type", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: undefined
|
|
24
|
-
});
|
|
25
|
-
/**
|
|
26
|
-
* Whether the command is enabled by default when the app is added to a guild
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
Object.defineProperty(this, "defaultPermission", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: undefined
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Sets the name
|
|
38
|
-
* @param name The name
|
|
39
|
-
*/
|
|
40
|
-
setName(name) {
|
|
41
|
-
// Assert the name matches the conditions
|
|
42
|
-
(0, Assertions_1.validateName)(name);
|
|
43
|
-
Reflect.set(this, 'name', name);
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Sets the type
|
|
48
|
-
* @param type The type
|
|
49
|
-
*/
|
|
50
|
-
setType(type) {
|
|
51
|
-
// Assert the type is valid
|
|
52
|
-
(0, Assertions_1.validateType)(type);
|
|
53
|
-
Reflect.set(this, 'type', type);
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Sets whether the command is enabled by default when the application is added to a guild.
|
|
58
|
-
*
|
|
59
|
-
* **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.
|
|
60
|
-
* @param value Whether or not to enable this command by default
|
|
61
|
-
*
|
|
62
|
-
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
63
|
-
*/
|
|
64
|
-
setDefaultPermission(value) {
|
|
65
|
-
// Assert the value matches the conditions
|
|
66
|
-
(0, Assertions_1.validateDefaultPermission)(value);
|
|
67
|
-
Reflect.set(this, 'defaultPermission', value);
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Returns the final data that should be sent to Discord.
|
|
72
|
-
*
|
|
73
|
-
* **Note:** Calling this function will validate required properties based on their conditions.
|
|
74
|
-
*/
|
|
75
|
-
toJSON() {
|
|
76
|
-
(0, Assertions_1.validateRequiredParameters)(this.name, this.type);
|
|
77
|
-
return {
|
|
78
|
-
name: this.name,
|
|
79
|
-
type: this.type,
|
|
80
|
-
default_permission: this.defaultPermission,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.ContextMenuCommandBuilder = ContextMenuCommandBuilder;
|
|
85
|
-
//# sourceMappingURL=ContextMenuCommandBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuCommandBuilder.js","sourceRoot":"/","sources":["interactions/contextMenuCommands/ContextMenuCommandBuilder.ts"],"names":[],"mappings":";;;AAAA,6CAAiH;AAGjH,MAAa,yBAAyB;IAAtC;QACC;;WAEG;QACH;;;;mBAA+B,SAAU;WAAC;QAE1C;;WAEG;QACH;;;;mBAA+C,SAAU;WAAC;QAE1D;;;WAGG;QACH;;;;mBAAyD,SAAS;WAAC;IA0DpE,CAAC;IAxDA;;;OAGG;IACI,OAAO,CAAC,IAAY;QAC1B,yCAAyC;QACzC,IAAA,yBAAY,EAAC,IAAI,CAAC,CAAC;QAEnB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEhC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,IAA4B;QAC1C,2BAA2B;QAC3B,IAAA,yBAAY,EAAC,IAAI,CAAC,CAAC;QAEnB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEhC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;;OAOG;IACI,oBAAoB,CAAC,KAAc;QACzC,0CAA0C;QAC1C,IAAA,sCAAyB,EAAC,KAAK,CAAC,CAAC;QAEjC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;OAIG;IACI,MAAM;QACZ,IAAA,uCAA0B,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,kBAAkB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC;IACH,CAAC;CACD;AAzED,8DAyEC","sourcesContent":["import { validateRequiredParameters, validateName, validateType, validateDefaultPermission } from './Assertions';\nimport type { ApplicationCommandType, RESTPostAPIApplicationCommandsJSONBody } from 'discord-api-types/v9';\n\nexport class ContextMenuCommandBuilder {\n\t/**\n\t * The name of this context menu command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The type of this context menu command\n\t */\n\tpublic readonly type: ContextMenuCommandType = undefined!;\n\n\t/**\n\t * Whether the command is enabled by default when the app is added to a guild\n\t * @default true\n\t */\n\tpublic readonly defaultPermission: boolean | undefined = undefined;\n\n\t/**\n\t * Sets the name\n\t * @param name The name\n\t */\n\tpublic setName(name: string) {\n\t\t// Assert the name matches the conditions\n\t\tvalidateName(name);\n\n\t\tReflect.set(this, 'name', name);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the type\n\t * @param type The type\n\t */\n\tpublic setType(type: ContextMenuCommandType) {\n\t\t// Assert the type is valid\n\t\tvalidateType(type);\n\n\t\tReflect.set(this, 'type', type);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.\n\t * @param value Whether or not to enable this command by default\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'defaultPermission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the final data that should be sent to Discord.\n\t *\n\t * **Note:** Calling this function will validate required properties based on their conditions.\n\t */\n\tpublic toJSON(): RESTPostAPIApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.type);\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\ttype: this.type,\n\t\t\tdefault_permission: this.defaultPermission,\n\t\t};\n\t}\n}\n\nexport type ContextMenuCommandType = ApplicationCommandType.User | ApplicationCommandType.Message;\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { APIApplicationCommandOptionChoice } from 'discord-api-types/v9';
|
|
2
|
-
import type { SlashCommandOptionBase } from './mixins/CommandOptionBase';
|
|
3
|
-
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
|
|
4
|
-
import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
|
|
5
|
-
export declare function validateRequiredParameters(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
|
|
6
|
-
export declare function validateName(name: unknown): asserts name is string;
|
|
7
|
-
export declare function validateDescription(description: unknown): asserts description is string;
|
|
8
|
-
export declare function validateDefaultPermission(value: unknown): asserts value is boolean;
|
|
9
|
-
export declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
|
|
10
|
-
export declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
|
|
11
|
-
export declare function assertReturnOfBuilder<T extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
|
|
12
|
-
//# sourceMappingURL=Assertions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Assertions.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/Assertions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAEnH,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,8BAA8B,EAAE,QAUzC;AAUD,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAElE;AAID,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAEvF;AAID,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAElF;AAID,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,8BAA8B,EAAE,CAE9G;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iCAAiC,EAAE,QAEpF;AAED,wBAAgB,qBAAqB,CACpC,CAAC,SAAS,sBAAsB,GAAG,6BAA6B,GAAG,kCAAkC,EACpG,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAuBrE"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertReturnOfBuilder = exports.validateMaxChoicesLength = exports.validateMaxOptionsLength = exports.validateDefaultPermission = exports.validateDescription = exports.validateName = exports.validateRequiredParameters = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const is_1 = (0, tslib_1.__importDefault)(require("@sindresorhus/is"));
|
|
6
|
-
const ow_1 = (0, tslib_1.__importDefault)(require("ow"));
|
|
7
|
-
function validateRequiredParameters(name, description, options) {
|
|
8
|
-
// Assert name matches all conditions
|
|
9
|
-
validateName(name);
|
|
10
|
-
// Assert description conditions
|
|
11
|
-
validateDescription(description);
|
|
12
|
-
// Assert options conditions
|
|
13
|
-
validateMaxOptionsLength(options);
|
|
14
|
-
}
|
|
15
|
-
exports.validateRequiredParameters = validateRequiredParameters;
|
|
16
|
-
const namePredicate = ow_1.default.string.lowercase
|
|
17
|
-
.minLength(1)
|
|
18
|
-
.maxLength(32)
|
|
19
|
-
.addValidator({
|
|
20
|
-
message: (value, label) => `Expected ${label} to match "^[\\p{L}\\p{N}_-]+$", got ${value} instead`,
|
|
21
|
-
validator: (value) => /^[\p{L}\p{N}_-]+$/u.test(value),
|
|
22
|
-
});
|
|
23
|
-
function validateName(name) {
|
|
24
|
-
(0, ow_1.default)(name, 'name', namePredicate);
|
|
25
|
-
}
|
|
26
|
-
exports.validateName = validateName;
|
|
27
|
-
const descriptionPredicate = ow_1.default.string.minLength(1).maxLength(100);
|
|
28
|
-
function validateDescription(description) {
|
|
29
|
-
(0, ow_1.default)(description, 'description', descriptionPredicate);
|
|
30
|
-
}
|
|
31
|
-
exports.validateDescription = validateDescription;
|
|
32
|
-
const defaultPermissionPredicate = ow_1.default.boolean;
|
|
33
|
-
function validateDefaultPermission(value) {
|
|
34
|
-
(0, ow_1.default)(value, 'default_permission', defaultPermissionPredicate);
|
|
35
|
-
}
|
|
36
|
-
exports.validateDefaultPermission = validateDefaultPermission;
|
|
37
|
-
const maxArrayLengthPredicate = ow_1.default.array.maxLength(25);
|
|
38
|
-
function validateMaxOptionsLength(options) {
|
|
39
|
-
(0, ow_1.default)(options, 'options', maxArrayLengthPredicate);
|
|
40
|
-
}
|
|
41
|
-
exports.validateMaxOptionsLength = validateMaxOptionsLength;
|
|
42
|
-
function validateMaxChoicesLength(choices) {
|
|
43
|
-
(0, ow_1.default)(choices, 'choices', maxArrayLengthPredicate);
|
|
44
|
-
}
|
|
45
|
-
exports.validateMaxChoicesLength = validateMaxChoicesLength;
|
|
46
|
-
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
47
|
-
const instanceName = ExpectedInstanceOf.name;
|
|
48
|
-
if (is_1.default.nullOrUndefined(input)) {
|
|
49
|
-
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${input === null ? 'null' : 'undefined'} instead.`);
|
|
50
|
-
}
|
|
51
|
-
if (is_1.default.primitive(input)) {
|
|
52
|
-
throw new TypeError(`Expected to receive a ${instanceName} builder, got a primitive (${typeof input}) instead.`);
|
|
53
|
-
}
|
|
54
|
-
if (!(input instanceof ExpectedInstanceOf)) {
|
|
55
|
-
const casted = input;
|
|
56
|
-
const constructorName = is_1.default.function_(input) ? input.name : casted.constructor.name;
|
|
57
|
-
const stringTag = Reflect.get(casted, Symbol.toStringTag);
|
|
58
|
-
const fullResultName = stringTag ? `${constructorName} [${stringTag}]` : constructorName;
|
|
59
|
-
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${fullResultName} instead.`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.assertReturnOfBuilder = assertReturnOfBuilder;
|
|
63
|
-
//# sourceMappingURL=Assertions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Assertions.js","sourceRoot":"/","sources":["interactions/slashCommands/Assertions.ts"],"names":[],"mappings":";;;;AAAA,uEAAkC;AAElC,yDAAoB;AAKpB,SAAgB,0BAA0B,CACzC,IAAY,EACZ,WAAmB,EACnB,OAAyC;IAEzC,qCAAqC;IACrC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEnB,gCAAgC;IAChC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEjC,4BAA4B;IAC5B,wBAAwB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAbD,gEAaC;AAED,MAAM,aAAa,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS;KACvC,SAAS,CAAC,CAAC,CAAC;KACZ,SAAS,CAAC,EAAE,CAAC;KACb,YAAY,CAAC;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,YAAY,KAAM,wCAAwC,KAAK,UAAU;IACpG,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;CACtD,CAAC,CAAC;AAEJ,SAAgB,YAAY,CAAC,IAAa;IACzC,IAAA,YAAE,EAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AACjC,CAAC;AAFD,oCAEC;AAED,MAAM,oBAAoB,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAEnE,SAAgB,mBAAmB,CAAC,WAAoB;IACvD,IAAA,YAAE,EAAC,WAAW,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAFD,kDAEC;AAED,MAAM,0BAA0B,GAAG,YAAE,CAAC,OAAO,CAAC;AAE9C,SAAgB,yBAAyB,CAAC,KAAc;IACvD,IAAA,YAAE,EAAC,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,CAAC,CAAC;AAC7D,CAAC;AAFD,8DAEC;AAED,MAAM,uBAAuB,GAAG,YAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAEvD,SAAgB,wBAAwB,CAAC,OAAgB;IACxD,IAAA,YAAE,EAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACjD,CAAC;AAFD,4DAEC;AAED,SAAgB,wBAAwB,CAAC,OAA4C;IACpF,IAAA,YAAE,EAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACjD,CAAC;AAFD,4DAEC;AAED,SAAgB,qBAAqB,CAEnC,KAAc,EAAE,kBAA+B;IAChD,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAE7C,IAAI,YAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,IAAI,SAAS,CAClB,yBAAyB,YAAY,iBAAiB,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,WAAW,CACtG,CAAC;KACF;IAED,IAAI,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACxB,MAAM,IAAI,SAAS,CAAC,yBAAyB,YAAY,8BAA8B,OAAO,KAAK,YAAY,CAAC,CAAC;KACjH;IAED,IAAI,CAAC,CAAC,KAAK,YAAY,kBAAkB,CAAC,EAAE;QAC3C,MAAM,MAAM,GAAG,KAAqC,CAAC;QAErD,MAAM,eAAe,GAAG,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;QACnF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAuB,CAAC;QAEhF,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,KAAK,SAAS,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC;QAEzF,MAAM,IAAI,SAAS,CAAC,yBAAyB,YAAY,iBAAiB,cAAc,WAAW,CAAC,CAAC;KACrG;AACF,CAAC;AAzBD,sDAyBC","sourcesContent":["import is from '@sindresorhus/is';\nimport type { APIApplicationCommandOptionChoice } from 'discord-api-types/v9';\nimport ow from 'ow';\nimport type { SlashCommandOptionBase } from './mixins/CommandOptionBase';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';\nimport type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\n\nexport function validateRequiredParameters(\n\tname: string,\n\tdescription: string,\n\toptions: ToAPIApplicationCommandOptions[],\n) {\n\t// Assert name matches all conditions\n\tvalidateName(name);\n\n\t// Assert description conditions\n\tvalidateDescription(description);\n\n\t// Assert options conditions\n\tvalidateMaxOptionsLength(options);\n}\n\nconst namePredicate = ow.string.lowercase\n\t.minLength(1)\n\t.maxLength(32)\n\t.addValidator({\n\t\tmessage: (value, label) => `Expected ${label!} to match \"^[\\\\p{L}\\\\p{N}_-]+$\", got ${value} instead`,\n\t\tvalidator: (value) => /^[\\p{L}\\p{N}_-]+$/u.test(value),\n\t});\n\nexport function validateName(name: unknown): asserts name is string {\n\tow(name, 'name', namePredicate);\n}\n\nconst descriptionPredicate = ow.string.minLength(1).maxLength(100);\n\nexport function validateDescription(description: unknown): asserts description is string {\n\tow(description, 'description', descriptionPredicate);\n}\n\nconst defaultPermissionPredicate = ow.boolean;\n\nexport function validateDefaultPermission(value: unknown): asserts value is boolean {\n\tow(value, 'default_permission', defaultPermissionPredicate);\n}\n\nconst maxArrayLengthPredicate = ow.array.maxLength(25);\n\nexport function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[] {\n\tow(options, 'options', maxArrayLengthPredicate);\n}\n\nexport function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]) {\n\tow(choices, 'choices', maxArrayLengthPredicate);\n}\n\nexport function assertReturnOfBuilder<\n\tT extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder,\n>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T {\n\tconst instanceName = ExpectedInstanceOf.name;\n\n\tif (is.nullOrUndefined(input)) {\n\t\tthrow new TypeError(\n\t\t\t`Expected to receive a ${instanceName} builder, got ${input === null ? 'null' : 'undefined'} instead.`,\n\t\t);\n\t}\n\n\tif (is.primitive(input)) {\n\t\tthrow new TypeError(`Expected to receive a ${instanceName} builder, got a primitive (${typeof input}) instead.`);\n\t}\n\n\tif (!(input instanceof ExpectedInstanceOf)) {\n\t\tconst casted = input as Record<PropertyKey, unknown>;\n\n\t\tconst constructorName = is.function_(input) ? input.name : casted.constructor.name;\n\t\tconst stringTag = Reflect.get(casted, Symbol.toStringTag) as string | undefined;\n\n\t\tconst fullResultName = stringTag ? `${constructorName} [${stringTag}]` : constructorName;\n\n\t\tthrow new TypeError(`Expected to receive a ${instanceName} builder, got ${fullResultName} instead.`);\n\t}\n}\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { APIApplicationCommandOption, RESTPostAPIApplicationCommandsJSONBody } from 'discord-api-types/v9';
|
|
2
|
-
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
|
|
3
|
-
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
|
4
|
-
import { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
|
|
5
|
-
export declare class SlashCommandBuilder {
|
|
6
|
-
/**
|
|
7
|
-
* The name of this slash command
|
|
8
|
-
*/
|
|
9
|
-
readonly name: string;
|
|
10
|
-
/**
|
|
11
|
-
* The description of this slash command
|
|
12
|
-
*/
|
|
13
|
-
readonly description: string;
|
|
14
|
-
/**
|
|
15
|
-
* The options of this slash command
|
|
16
|
-
*/
|
|
17
|
-
readonly options: ToAPIApplicationCommandOptions[];
|
|
18
|
-
/**
|
|
19
|
-
* Whether the command is enabled by default when the app is added to a guild
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
readonly defaultPermission: boolean | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the final data that should be sent to Discord.
|
|
25
|
-
*
|
|
26
|
-
* **Note:** Calling this function will validate required properties based on their conditions.
|
|
27
|
-
*/
|
|
28
|
-
toJSON(): RESTPostAPIApplicationCommandsJSONBody;
|
|
29
|
-
/**
|
|
30
|
-
* Sets whether the command is enabled by default when the application is added to a guild.
|
|
31
|
-
*
|
|
32
|
-
* **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.
|
|
33
|
-
* @param value Whether or not to enable this command by default
|
|
34
|
-
*
|
|
35
|
-
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
36
|
-
*/
|
|
37
|
-
setDefaultPermission(value: boolean): this;
|
|
38
|
-
/**
|
|
39
|
-
* Adds a new subcommand group to this command
|
|
40
|
-
* @param input A function that returns a subcommand group builder, or an already built builder
|
|
41
|
-
*/
|
|
42
|
-
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
43
|
-
/**
|
|
44
|
-
* Adds a new subcommand to this command
|
|
45
|
-
* @param input A function that returns a subcommand builder, or an already built builder
|
|
46
|
-
*/
|
|
47
|
-
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
48
|
-
}
|
|
49
|
-
export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {
|
|
50
|
-
}
|
|
51
|
-
export interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {
|
|
52
|
-
}
|
|
53
|
-
export interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
|
|
54
|
-
}
|
|
55
|
-
export interface ToAPIApplicationCommandOptions {
|
|
56
|
-
toJSON(): APIApplicationCommandOption;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=SlashCommandBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandBuilder.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,sCAAsC,EAAE,MAAM,sBAAsB,CAAC;AAQhH,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAE9G,qBACa,mBAAmB;IAC/B;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;OAGG;IACH,SAAgB,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAa;IAEnE;;;;OAIG;IACI,MAAM,IAAI,sCAAsC;IAUvD;;;;;;;OAOG;IACI,oBAAoB,CAAC,KAAK,EAAE,OAAO;IAS1C;;;OAGG;IACI,kBAAkB,CACxB,KAAK,EACF,kCAAkC,GAClC,CAAC,CAAC,eAAe,EAAE,kCAAkC,KAAK,kCAAkC,CAAC,GAC9F,kCAAkC;IAiBrC;;;OAGG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC,GACpF,kCAAkC;CAgBrC;AAED,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB,EAAE,yBAAyB;CAAG;AAEnG,MAAM,WAAW,kCAChB,SAAQ,wBAAwB,EAC/B,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,eAAe,GAAG,oBAAoB,CAAC;CAAG;AAEjF,MAAM,WAAW,8BAChB,SAAQ,wBAAwB,EAC/B,yBAAyB,EACzB,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC;CAAG;AAExC,MAAM,WAAW,8BAA8B;IAC9C,MAAM,IAAI,2BAA2B,CAAC;CACtC"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlashCommandBuilder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const Assertions_1 = require("./Assertions");
|
|
7
|
-
const CommandOptions_1 = require("./mixins/CommandOptions");
|
|
8
|
-
const NameAndDescription_1 = require("./mixins/NameAndDescription");
|
|
9
|
-
const SlashCommandSubcommands_1 = require("./SlashCommandSubcommands");
|
|
10
|
-
let SlashCommandBuilder = class SlashCommandBuilder {
|
|
11
|
-
constructor() {
|
|
12
|
-
/**
|
|
13
|
-
* The name of this slash command
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(this, "name", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: undefined
|
|
20
|
-
});
|
|
21
|
-
/**
|
|
22
|
-
* The description of this slash command
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(this, "description", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: undefined
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* The options of this slash command
|
|
32
|
-
*/
|
|
33
|
-
Object.defineProperty(this, "options", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: []
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Whether the command is enabled by default when the app is added to a guild
|
|
41
|
-
* @default true
|
|
42
|
-
*/
|
|
43
|
-
Object.defineProperty(this, "defaultPermission", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
configurable: true,
|
|
46
|
-
writable: true,
|
|
47
|
-
value: undefined
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Returns the final data that should be sent to Discord.
|
|
52
|
-
*
|
|
53
|
-
* **Note:** Calling this function will validate required properties based on their conditions.
|
|
54
|
-
*/
|
|
55
|
-
toJSON() {
|
|
56
|
-
(0, Assertions_1.validateRequiredParameters)(this.name, this.description, this.options);
|
|
57
|
-
return {
|
|
58
|
-
name: this.name,
|
|
59
|
-
description: this.description,
|
|
60
|
-
options: this.options.map((option) => option.toJSON()),
|
|
61
|
-
default_permission: this.defaultPermission,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Sets whether the command is enabled by default when the application is added to a guild.
|
|
66
|
-
*
|
|
67
|
-
* **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.
|
|
68
|
-
* @param value Whether or not to enable this command by default
|
|
69
|
-
*
|
|
70
|
-
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
71
|
-
*/
|
|
72
|
-
setDefaultPermission(value) {
|
|
73
|
-
// Assert the value matches the conditions
|
|
74
|
-
(0, Assertions_1.validateDefaultPermission)(value);
|
|
75
|
-
Reflect.set(this, 'defaultPermission', value);
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Adds a new subcommand group to this command
|
|
80
|
-
* @param input A function that returns a subcommand group builder, or an already built builder
|
|
81
|
-
*/
|
|
82
|
-
addSubcommandGroup(input) {
|
|
83
|
-
const { options } = this;
|
|
84
|
-
// First, assert options conditions - we cannot have more than 25 options
|
|
85
|
-
(0, Assertions_1.validateMaxOptionsLength)(options);
|
|
86
|
-
// Get the final result
|
|
87
|
-
const result = typeof input === 'function' ? input(new SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder()) : input;
|
|
88
|
-
(0, Assertions_1.assertReturnOfBuilder)(result, SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder);
|
|
89
|
-
// Push it
|
|
90
|
-
options.push(result);
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Adds a new subcommand to this command
|
|
95
|
-
* @param input A function that returns a subcommand builder, or an already built builder
|
|
96
|
-
*/
|
|
97
|
-
addSubcommand(input) {
|
|
98
|
-
const { options } = this;
|
|
99
|
-
// First, assert options conditions - we cannot have more than 25 options
|
|
100
|
-
(0, Assertions_1.validateMaxOptionsLength)(options);
|
|
101
|
-
// Get the final result
|
|
102
|
-
const result = typeof input === 'function' ? input(new SlashCommandSubcommands_1.SlashCommandSubcommandBuilder()) : input;
|
|
103
|
-
(0, Assertions_1.assertReturnOfBuilder)(result, SlashCommandSubcommands_1.SlashCommandSubcommandBuilder);
|
|
104
|
-
// Push it
|
|
105
|
-
options.push(result);
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
SlashCommandBuilder = (0, tslib_1.__decorate)([
|
|
110
|
-
(0, ts_mixer_1.mix)(CommandOptions_1.SharedSlashCommandOptions, NameAndDescription_1.SharedNameAndDescription)
|
|
111
|
-
], SlashCommandBuilder);
|
|
112
|
-
exports.SlashCommandBuilder = SlashCommandBuilder;
|
|
113
|
-
//# sourceMappingURL=SlashCommandBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandBuilder.js","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandBuilder.ts"],"names":[],"mappings":";;;;AACA,uCAA+B;AAC/B,6CAKsB;AACtB,4DAAoE;AACpE,oEAAuE;AACvE,uEAA8G;AAG9G,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAAhC;QACC;;WAEG;QACH;;;;mBAA+B,SAAU;WAAC;QAE1C;;WAEG;QACH;;;;mBAAsC,SAAU;WAAC;QAEjD;;WAEG;QACH;;;;mBAA4D,EAAE;WAAC;QAE/D;;;WAGG;QACH;;;;mBAAyD,SAAS;WAAC;IAmFpE,CAAC;IAjFA;;;;OAIG;IACI,MAAM;QACZ,IAAA,uCAA0B,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACtD,kBAAkB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACI,oBAAoB,CAAC,KAAc;QACzC,0CAA0C;QAC1C,IAAA,sCAAyB,EAAC,KAAK,CAAC,CAAC;QAEjC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,kBAAkB,CACxB,KAEgG;QAEhG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,yEAAyE;QACzE,IAAA,qCAAwB,EAAC,OAAO,CAAC,CAAC;QAElC,uBAAuB;QACvB,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,4DAAkC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAErG,IAAA,kCAAqB,EAAC,MAAM,EAAE,4DAAkC,CAAC,CAAC;QAElE,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,aAAa,CACnB,KAEsF;QAEtF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,yEAAyE;QACzE,IAAA,qCAAwB,EAAC,OAAO,CAAC,CAAC;QAElC,uBAAuB;QACvB,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,uDAA6B,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAEhG,IAAA,kCAAqB,EAAC,MAAM,EAAE,uDAA6B,CAAC,CAAC;QAE7D,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAA;AAvGY,mBAAmB;IAD/B,IAAA,cAAG,EAAC,0CAAyB,EAAE,6CAAwB,CAAC;GAC5C,mBAAmB,CAuG/B;AAvGY,kDAAmB","sourcesContent":["import type { APIApplicationCommandOption, RESTPostAPIApplicationCommandsJSONBody } from 'discord-api-types/v9';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n} from './Assertions';\nimport { SharedSlashCommandOptions } from './mixins/CommandOptions';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\n\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this slash command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this slash command\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The options of this slash command\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether the command is enabled by default when the app is added to a guild\n\t * @default true\n\t */\n\tpublic readonly defaultPermission: boolean | undefined = undefined;\n\n\t/**\n\t * Returns the final data that should be sent to Discord.\n\t *\n\t * **Note:** Calling this function will validate required properties based on their conditions.\n\t */\n\tpublic toJSON(): RESTPostAPIApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t\tdefault_permission: this.defaultPermission,\n\t\t};\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.\n\t * @param value Whether or not to enable this command by default\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'defaultPermission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command\n\t * @param input A function that returns a subcommand group builder, or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command\n\t * @param input A function that returns a subcommand builder, or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n\nexport interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n\nexport interface SlashCommandSubcommandsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tPick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {}\n\nexport interface SlashCommandOptionsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tSharedSlashCommandOptions,\n\t\tPick<SlashCommandBuilder, 'toJSON'> {}\n\nexport interface ToAPIApplicationCommandOptions {\n\ttoJSON(): APIApplicationCommandOption;\n}\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { APIApplicationCommandSubCommandOptions } from 'discord-api-types/v9';
|
|
2
|
-
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
|
|
3
|
-
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
|
4
|
-
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a folder for subcommands
|
|
7
|
-
*
|
|
8
|
-
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
9
|
-
*/
|
|
10
|
-
export declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
|
|
11
|
-
/**
|
|
12
|
-
* The name of this subcommand group
|
|
13
|
-
*/
|
|
14
|
-
readonly name: string;
|
|
15
|
-
/**
|
|
16
|
-
* The description of this subcommand group
|
|
17
|
-
*/
|
|
18
|
-
readonly description: string;
|
|
19
|
-
/**
|
|
20
|
-
* The subcommands part of this subcommand group
|
|
21
|
-
*/
|
|
22
|
-
readonly options: ToAPIApplicationCommandOptions[];
|
|
23
|
-
/**
|
|
24
|
-
* Adds a new subcommand to this group
|
|
25
|
-
* @param input A function that returns a subcommand builder, or an already built builder
|
|
26
|
-
*/
|
|
27
|
-
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this;
|
|
28
|
-
toJSON(): APIApplicationCommandSubCommandOptions;
|
|
29
|
-
}
|
|
30
|
-
export interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Represents a subcommand
|
|
34
|
-
*
|
|
35
|
-
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
36
|
-
*/
|
|
37
|
-
export declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
|
|
38
|
-
/**
|
|
39
|
-
* The name of this subcommand
|
|
40
|
-
*/
|
|
41
|
-
readonly name: string;
|
|
42
|
-
/**
|
|
43
|
-
* The description of this subcommand
|
|
44
|
-
*/
|
|
45
|
-
readonly description: string;
|
|
46
|
-
/**
|
|
47
|
-
* The options of this subcommand
|
|
48
|
-
*/
|
|
49
|
-
readonly options: ToAPIApplicationCommandOptions[];
|
|
50
|
-
toJSON(): APIApplicationCommandSubCommandOptions;
|
|
51
|
-
}
|
|
52
|
-
export interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=SlashCommandSubcommands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandSubcommands.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandSubcommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAgC,MAAM,sBAAsB,CAAC;AAG5G,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAE5E;;;;GAIG;AACH,qBACa,kCAAmC,YAAW,8BAA8B;IACxF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;OAGG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC;IAkBhF,MAAM,IAAI,sCAAsC;CASvD;AAED,MAAM,WAAW,kCAAmC,SAAQ,wBAAwB;CAAG;AAEvF;;;;GAIG;AACH,qBACa,6BAA8B,YAAW,8BAA8B;IACnF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAExD,MAAM,IAAI,sCAAsC;CASvD;AAED,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB,EAAE,yBAAyB,CAAC,KAAK,CAAC;CAAG"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlashCommandSubcommandBuilder = exports.SlashCommandSubcommandGroupBuilder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
require("discord-api-types/v9");
|
|
6
|
-
const ts_mixer_1 = require("ts-mixer");
|
|
7
|
-
const Assertions_1 = require("./Assertions");
|
|
8
|
-
const CommandOptions_1 = require("./mixins/CommandOptions");
|
|
9
|
-
const NameAndDescription_1 = require("./mixins/NameAndDescription");
|
|
10
|
-
/**
|
|
11
|
-
* Represents a folder for subcommands
|
|
12
|
-
*
|
|
13
|
-
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
14
|
-
*/
|
|
15
|
-
let SlashCommandSubcommandGroupBuilder = class SlashCommandSubcommandGroupBuilder {
|
|
16
|
-
constructor() {
|
|
17
|
-
/**
|
|
18
|
-
* The name of this subcommand group
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(this, "name", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: undefined
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
* The description of this subcommand group
|
|
28
|
-
*/
|
|
29
|
-
Object.defineProperty(this, "description", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: undefined
|
|
34
|
-
});
|
|
35
|
-
/**
|
|
36
|
-
* The subcommands part of this subcommand group
|
|
37
|
-
*/
|
|
38
|
-
Object.defineProperty(this, "options", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: []
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Adds a new subcommand to this group
|
|
47
|
-
* @param input A function that returns a subcommand builder, or an already built builder
|
|
48
|
-
*/
|
|
49
|
-
addSubcommand(input) {
|
|
50
|
-
const { options } = this;
|
|
51
|
-
// First, assert options conditions - we cannot have more than 25 options
|
|
52
|
-
(0, Assertions_1.validateMaxOptionsLength)(options);
|
|
53
|
-
// Get the final result
|
|
54
|
-
const result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;
|
|
55
|
-
(0, Assertions_1.assertReturnOfBuilder)(result, SlashCommandSubcommandBuilder);
|
|
56
|
-
// Push it
|
|
57
|
-
options.push(result);
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
toJSON() {
|
|
61
|
-
(0, Assertions_1.validateRequiredParameters)(this.name, this.description, this.options);
|
|
62
|
-
return {
|
|
63
|
-
type: 2 /* SubcommandGroup */,
|
|
64
|
-
name: this.name,
|
|
65
|
-
description: this.description,
|
|
66
|
-
options: this.options.map((option) => option.toJSON()),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
SlashCommandSubcommandGroupBuilder = (0, tslib_1.__decorate)([
|
|
71
|
-
(0, ts_mixer_1.mix)(NameAndDescription_1.SharedNameAndDescription)
|
|
72
|
-
], SlashCommandSubcommandGroupBuilder);
|
|
73
|
-
exports.SlashCommandSubcommandGroupBuilder = SlashCommandSubcommandGroupBuilder;
|
|
74
|
-
/**
|
|
75
|
-
* Represents a subcommand
|
|
76
|
-
*
|
|
77
|
-
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
78
|
-
*/
|
|
79
|
-
let SlashCommandSubcommandBuilder = class SlashCommandSubcommandBuilder {
|
|
80
|
-
constructor() {
|
|
81
|
-
/**
|
|
82
|
-
* The name of this subcommand
|
|
83
|
-
*/
|
|
84
|
-
Object.defineProperty(this, "name", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
configurable: true,
|
|
87
|
-
writable: true,
|
|
88
|
-
value: undefined
|
|
89
|
-
});
|
|
90
|
-
/**
|
|
91
|
-
* The description of this subcommand
|
|
92
|
-
*/
|
|
93
|
-
Object.defineProperty(this, "description", {
|
|
94
|
-
enumerable: true,
|
|
95
|
-
configurable: true,
|
|
96
|
-
writable: true,
|
|
97
|
-
value: undefined
|
|
98
|
-
});
|
|
99
|
-
/**
|
|
100
|
-
* The options of this subcommand
|
|
101
|
-
*/
|
|
102
|
-
Object.defineProperty(this, "options", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
configurable: true,
|
|
105
|
-
writable: true,
|
|
106
|
-
value: []
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
toJSON() {
|
|
110
|
-
(0, Assertions_1.validateRequiredParameters)(this.name, this.description, this.options);
|
|
111
|
-
return {
|
|
112
|
-
type: 1 /* Subcommand */,
|
|
113
|
-
name: this.name,
|
|
114
|
-
description: this.description,
|
|
115
|
-
options: this.options.map((option) => option.toJSON()),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
SlashCommandSubcommandBuilder = (0, tslib_1.__decorate)([
|
|
120
|
-
(0, ts_mixer_1.mix)(NameAndDescription_1.SharedNameAndDescription, CommandOptions_1.SharedSlashCommandOptions)
|
|
121
|
-
], SlashCommandSubcommandBuilder);
|
|
122
|
-
exports.SlashCommandSubcommandBuilder = SlashCommandSubcommandBuilder;
|
|
123
|
-
//# sourceMappingURL=SlashCommandSubcommands.js.map
|