@discordjs/builders 0.7.0 → 0.8.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 +818 -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 +53 -41
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandSubcommands.js","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandSubcommands.ts"],"names":[],"mappings":";;;;AAAA,gCAA4G;AAC5G,uCAA+B;AAC/B,6CAA2G;AAC3G,4DAAoE;AACpE,oEAAuE;AAGvE;;;;GAIG;AAEH,IAAa,kCAAkC,GAA/C,MAAa,kCAAkC;IAA/C;QACC;;WAEG;QACH;;;;mBAA+B,SAAU;WAAC;QAE1C;;WAEG;QACH;;;;mBAAsC,SAAU;WAAC;QAEjD;;WAEG;QACH;;;;mBAA4D,EAAE;WAAC;IAoChE,CAAC;IAlCA;;;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,6BAA6B,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAEhG,IAAA,kCAAqB,EAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;QAE7D,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM;QACZ,IAAA,uCAA0B,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO;YACN,IAAI,yBAA8C;YAClD,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;SACtD,CAAC;IACH,CAAC;CACD,CAAA;AAlDY,kCAAkC;IAD9C,IAAA,cAAG,EAAC,6CAAwB,CAAC;GACjB,kCAAkC,CAkD9C;AAlDY,gFAAkC;AAsD/C;;;;GAIG;AAEH,IAAa,6BAA6B,GAA1C,MAAa,6BAA6B;IAA1C;QACC;;WAEG;QACH;;;;mBAA+B,SAAU;WAAC;QAE1C;;WAEG;QACH;;;;mBAAsC,SAAU;WAAC;QAEjD;;WAEG;QACH;;;;mBAA4D,EAAE;WAAC;IAWhE,CAAC;IATO,MAAM;QACZ,IAAA,uCAA0B,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO;YACN,IAAI,oBAAyC;YAC7C,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;SACtD,CAAC;IACH,CAAC;CACD,CAAA;AAzBY,6BAA6B;IADzC,IAAA,cAAG,EAAC,6CAAwB,EAAE,0CAAyB,CAAC;GAC5C,6BAA6B,CAyBzC;AAzBY,sEAA6B","sourcesContent":["import { APIApplicationCommandSubCommandOptions, ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { mix } from 'ts-mixer';\nimport { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions';\nimport { SharedSlashCommandOptions } from './mixins/CommandOptions';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';\n\n/**\n * Represents a folder for subcommands\n *\n * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups\n */\n@mix(SharedNameAndDescription)\nexport class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand group\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand group\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The subcommands part of this subcommand group\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Adds a new subcommand to this group\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) {\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\tpublic toJSON(): APIApplicationCommandSubCommandOptions {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.SubcommandGroup,\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};\n\t}\n}\n\nexport interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {}\n\n/**\n * Represents a subcommand\n *\n * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups\n */\n@mix(SharedNameAndDescription, SharedSlashCommandOptions)\nexport class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The options of this subcommand\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\tpublic toJSON(): APIApplicationCommandSubCommandOptions {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.Subcommand,\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};\n\t}\n}\n\nexport interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { APIApplicationCommandChannelOptions, ChannelType } from 'discord-api-types/v9';
|
|
2
|
-
import type { ToAPIApplicationCommandOptions } from '../../..';
|
|
3
|
-
import { SlashCommandOptionBase } from './CommandOptionBase';
|
|
4
|
-
export declare abstract class ApplicationCommandOptionWithChannelTypesBase extends SlashCommandOptionBase implements ToAPIApplicationCommandOptions {
|
|
5
|
-
channelTypes?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
|
|
6
|
-
/**
|
|
7
|
-
* Adds a channel type to this option
|
|
8
|
-
* @param channelType The type of channel to allow
|
|
9
|
-
*/
|
|
10
|
-
addChannelType(channelType: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>): this;
|
|
11
|
-
/**
|
|
12
|
-
* Adds channel types to this option
|
|
13
|
-
* @param channelTypes The channel types to add
|
|
14
|
-
*/
|
|
15
|
-
addChannelTypes(channelTypes: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[]): this;
|
|
16
|
-
toJSON(): APIApplicationCommandChannelOptions;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=CommandChannelOptionBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandChannelOptionBase.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandChannelOptionBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAgC,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEtH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAiB7D,8BAAsB,4CACrB,SAAQ,sBACR,YAAW,8BAA8B;IAElC,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;IAEnF;;;OAGG;IACI,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC;IAS7F;;;OAGG;IACI,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,EAAE;IAKjF,MAAM,IAAI,mCAAmC;CAO7D"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApplicationCommandOptionWithChannelTypesBase = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
require("discord-api-types/v9");
|
|
6
|
-
const ow_1 = (0, tslib_1.__importDefault)(require("ow"));
|
|
7
|
-
const CommandOptionBase_1 = require("./CommandOptionBase");
|
|
8
|
-
// Only allow valid channel types to be used. (This can't be dynamic because const enums are erased at runtime)
|
|
9
|
-
const allowedChannelTypes = [
|
|
10
|
-
4 /* GuildCategory */,
|
|
11
|
-
5 /* GuildNews */,
|
|
12
|
-
10 /* GuildNewsThread */,
|
|
13
|
-
6 /* GuildStore */,
|
|
14
|
-
13 /* GuildStageVoice */,
|
|
15
|
-
0 /* GuildText */,
|
|
16
|
-
2 /* GuildVoice */,
|
|
17
|
-
11 /* GuildPublicThread */,
|
|
18
|
-
12 /* GuildPrivateThread */,
|
|
19
|
-
];
|
|
20
|
-
const channelTypePredicate = ow_1.default.number.oneOf(allowedChannelTypes);
|
|
21
|
-
class ApplicationCommandOptionWithChannelTypesBase extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
22
|
-
constructor() {
|
|
23
|
-
super(...arguments);
|
|
24
|
-
Object.defineProperty(this, "channelTypes", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: void 0
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Adds a channel type to this option
|
|
33
|
-
* @param channelType The type of channel to allow
|
|
34
|
-
*/
|
|
35
|
-
addChannelType(channelType) {
|
|
36
|
-
this.channelTypes ?? (this.channelTypes = []);
|
|
37
|
-
(0, ow_1.default)(channelType, 'channel type', channelTypePredicate);
|
|
38
|
-
this.channelTypes.push(channelType);
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Adds channel types to this option
|
|
43
|
-
* @param channelTypes The channel types to add
|
|
44
|
-
*/
|
|
45
|
-
addChannelTypes(channelTypes) {
|
|
46
|
-
channelTypes.forEach((channelType) => this.addChannelType(channelType));
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
toJSON() {
|
|
50
|
-
return {
|
|
51
|
-
...super.toJSON(),
|
|
52
|
-
type: 7 /* Channel */,
|
|
53
|
-
channel_types: this.channelTypes,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.ApplicationCommandOptionWithChannelTypesBase = ApplicationCommandOptionWithChannelTypesBase;
|
|
58
|
-
//# sourceMappingURL=CommandChannelOptionBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandChannelOptionBase.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandChannelOptionBase.ts"],"names":[],"mappings":";;;;AAAA,gCAAsH;AACtH,yDAAoB;AAEpB,2DAA6D;AAE7D,+GAA+G;AAC/G,MAAM,mBAAmB,GAAG;;;;;;;;;;CAU3B,CAAC;AAEF,MAAM,oBAAoB,GAAG,YAAE,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAElE,MAAsB,4CACrB,SAAQ,0CAAsB;IAD/B;;QAIC;;;;;WAAmF;IA+BpF,CAAC;IA7BA;;;OAGG;IACI,cAAc,CAAC,WAAuE;QAC5F,IAAI,CAAC,YAAY,KAAjB,IAAI,CAAC,YAAY,GAAK,EAAE,EAAC;QAEzB,IAAA,YAAE,EAAC,WAAW,EAAE,cAAc,EAAE,oBAAoB,CAAC,CAAC;QACtD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,YAA0E;QAChG,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACb,CAAC;IAEe,MAAM;QACrB,OAAO;YACN,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,IAAI,iBAAsC;YAC1C,aAAa,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;IACH,CAAC;CACD;AAnCD,oGAmCC","sourcesContent":["import { APIApplicationCommandChannelOptions, ApplicationCommandOptionType, ChannelType } from 'discord-api-types/v9';\nimport ow from 'ow';\nimport type { ToAPIApplicationCommandOptions } from '../../..';\nimport { SlashCommandOptionBase } from './CommandOptionBase';\n\n// Only allow valid channel types to be used. (This can't be dynamic because const enums are erased at runtime)\nconst allowedChannelTypes = [\n\tChannelType.GuildCategory,\n\tChannelType.GuildNews,\n\tChannelType.GuildNewsThread,\n\tChannelType.GuildStore,\n\tChannelType.GuildStageVoice,\n\tChannelType.GuildText,\n\tChannelType.GuildVoice,\n\tChannelType.GuildPublicThread,\n\tChannelType.GuildPrivateThread,\n];\n\nconst channelTypePredicate = ow.number.oneOf(allowedChannelTypes);\n\nexport abstract class ApplicationCommandOptionWithChannelTypesBase\n\textends SlashCommandOptionBase\n\timplements ToAPIApplicationCommandOptions\n{\n\tpublic channelTypes?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];\n\n\t/**\n\t * Adds a channel type to this option\n\t * @param channelType The type of channel to allow\n\t */\n\tpublic addChannelType(channelType: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>) {\n\t\tthis.channelTypes ??= [];\n\n\t\tow(channelType, 'channel type', channelTypePredicate);\n\t\tthis.channelTypes.push(channelType);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds channel types to this option\n\t * @param channelTypes The channel types to add\n\t */\n\tpublic addChannelTypes(channelTypes: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[]) {\n\t\tchannelTypes.forEach((channelType) => this.addChannelType(channelType));\n\t\treturn this;\n\t}\n\n\tpublic override toJSON(): APIApplicationCommandChannelOptions {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\ttype: ApplicationCommandOptionType.Channel,\n\t\t\tchannel_types: this.channelTypes,\n\t\t};\n\t}\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { APIApplicationCommandOption, ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
2
|
-
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
|
3
|
-
import { SharedNameAndDescription } from './NameAndDescription';
|
|
4
|
-
export declare class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {
|
|
5
|
-
required: boolean;
|
|
6
|
-
readonly type: ApplicationCommandOptionType;
|
|
7
|
-
constructor(type: ApplicationCommandOptionType);
|
|
8
|
-
/**
|
|
9
|
-
* Marks the option as required
|
|
10
|
-
* @param required If this option should be required
|
|
11
|
-
*/
|
|
12
|
-
setRequired(required: boolean): this;
|
|
13
|
-
toJSON(): APIApplicationCommandOption;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=CommandOptionBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandOptionBase.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGtG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,qBAAa,sBAAuB,SAAQ,wBAAyB,YAAW,8BAA8B;IACtG,QAAQ,UAAS;IACxB,SAAgB,IAAI,EAAE,4BAA4B,CAAC;gBAEhC,IAAI,EAAE,4BAA4B;IAKrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO;IAS7B,MAAM,IAAI,2BAA2B;CAa5C"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlashCommandOptionBase = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ow_1 = (0, tslib_1.__importDefault)(require("ow"));
|
|
6
|
-
const Assertions_1 = require("../Assertions");
|
|
7
|
-
const NameAndDescription_1 = require("./NameAndDescription");
|
|
8
|
-
class SlashCommandOptionBase extends NameAndDescription_1.SharedNameAndDescription {
|
|
9
|
-
constructor(type) {
|
|
10
|
-
super();
|
|
11
|
-
Object.defineProperty(this, "required", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: false
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(this, "type", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
this.type = type;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Marks the option as required
|
|
27
|
-
* @param required If this option should be required
|
|
28
|
-
*/
|
|
29
|
-
setRequired(required) {
|
|
30
|
-
// Assert that you actually passed a boolean
|
|
31
|
-
(0, ow_1.default)(required, 'required', ow_1.default.boolean);
|
|
32
|
-
this.required = required;
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
toJSON() {
|
|
36
|
-
(0, Assertions_1.validateRequiredParameters)(this.name, this.description, []);
|
|
37
|
-
// Assert that you actually passed a boolean
|
|
38
|
-
(0, ow_1.default)(this.required, 'required', ow_1.default.boolean);
|
|
39
|
-
return {
|
|
40
|
-
type: this.type,
|
|
41
|
-
name: this.name,
|
|
42
|
-
description: this.description,
|
|
43
|
-
required: this.required,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.SlashCommandOptionBase = SlashCommandOptionBase;
|
|
48
|
-
//# sourceMappingURL=CommandOptionBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandOptionBase.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionBase.ts"],"names":[],"mappings":";;;;AACA,yDAAoB;AACpB,8CAA2D;AAE3D,6DAAgE;AAEhE,MAAa,sBAAuB,SAAQ,6CAAwB;IAInE,YAAmB,IAAkC;QACpD,KAAK,EAAE,CAAC;QAJT;;;;mBAAkB,KAAK;WAAC;QACxB;;;;;WAAmD;QAIlD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,QAAiB;QACnC,4CAA4C;QAC5C,IAAA,YAAE,EAAC,QAAQ,EAAE,UAAU,EAAE,YAAE,CAAC,OAAO,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM;QACZ,IAAA,uCAA0B,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAE5D,4CAA4C;QAC5C,IAAA,YAAE,EAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAE,CAAC,OAAO,CAAC,CAAC;QAE1C,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC;IACH,CAAC;CACD;AAnCD,wDAmCC","sourcesContent":["import type { APIApplicationCommandOption, ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport ow from 'ow';\nimport { validateRequiredParameters } from '../Assertions';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SharedNameAndDescription } from './NameAndDescription';\n\nexport class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {\n\tpublic required = false;\n\tpublic readonly type: ApplicationCommandOptionType;\n\n\tpublic constructor(type: ApplicationCommandOptionType) {\n\t\tsuper();\n\t\tthis.type = type;\n\t}\n\n\t/**\n\t * Marks the option as required\n\t * @param required If this option should be required\n\t */\n\tpublic setRequired(required: boolean) {\n\t\t// Assert that you actually passed a boolean\n\t\tow(required, 'required', ow.boolean);\n\n\t\tthis.required = required;\n\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APIApplicationCommandOption {\n\t\tvalidateRequiredParameters(this.name, this.description, []);\n\n\t\t// Assert that you actually passed a boolean\n\t\tow(this.required, 'required', ow.boolean);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\trequired: this.required,\n\t\t};\n\t}\n}\n"]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
2
|
-
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
|
3
|
-
import { SlashCommandOptionBase } from './CommandOptionBase';
|
|
4
|
-
export declare abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number> extends SlashCommandOptionBase implements ToAPIApplicationCommandOptions {
|
|
5
|
-
choices?: APIApplicationCommandOptionChoice[];
|
|
6
|
-
/**
|
|
7
|
-
* Adds a choice for this option
|
|
8
|
-
* @param name The name of the choice
|
|
9
|
-
* @param value The value of the choice
|
|
10
|
-
*/
|
|
11
|
-
addChoice(name: string, value: T): this;
|
|
12
|
-
/**
|
|
13
|
-
* Adds multiple choices for this option
|
|
14
|
-
* @param choices The choices to add
|
|
15
|
-
*/
|
|
16
|
-
addChoices(choices: [name: string, value: T][]): this;
|
|
17
|
-
toJSON(): {
|
|
18
|
-
choices: APIApplicationCommandOptionChoice[] | undefined;
|
|
19
|
-
type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
|
20
|
-
name: string;
|
|
21
|
-
description: string;
|
|
22
|
-
default?: boolean | undefined;
|
|
23
|
-
required?: boolean | undefined;
|
|
24
|
-
} | {
|
|
25
|
-
choices: APIApplicationCommandOptionChoice[] | undefined;
|
|
26
|
-
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
|
|
27
|
-
options?: import("discord-api-types/v9").APIApplicationCommandOption[] | undefined;
|
|
28
|
-
name: string;
|
|
29
|
-
description: string;
|
|
30
|
-
default?: boolean | undefined;
|
|
31
|
-
required?: boolean | undefined;
|
|
32
|
-
} | {
|
|
33
|
-
choices: APIApplicationCommandOptionChoice[] | undefined;
|
|
34
|
-
type: ApplicationCommandOptionType.Channel;
|
|
35
|
-
channel_types?: (import("discord-api-types/v9").ChannelType.GuildText | import("discord-api-types/v9").ChannelType.GuildVoice | import("discord-api-types/v9").ChannelType.GuildCategory | import("discord-api-types/v9").ChannelType.GuildNews | import("discord-api-types/v9").ChannelType.GuildStore | import("discord-api-types/v9").ChannelType.GuildNewsThread | import("discord-api-types/v9").ChannelType.GuildPublicThread | import("discord-api-types/v9").ChannelType.GuildPrivateThread | import("discord-api-types/v9").ChannelType.GuildStageVoice)[] | undefined;
|
|
36
|
-
name: string;
|
|
37
|
-
description: string;
|
|
38
|
-
default?: boolean | undefined;
|
|
39
|
-
required?: boolean | undefined;
|
|
40
|
-
} | {
|
|
41
|
-
choices: APIApplicationCommandOptionChoice[] | undefined;
|
|
42
|
-
type: ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.User | ApplicationCommandOptionType.Role | ApplicationCommandOptionType.Mentionable;
|
|
43
|
-
name: string;
|
|
44
|
-
description: string;
|
|
45
|
-
default?: boolean | undefined;
|
|
46
|
-
required?: boolean | undefined;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=CommandOptionWithChoices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandOptionWithChoices.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionWithChoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGvG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAU7D,8BAAsB,uCAAuC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CACtF,SAAQ,sBACR,YAAW,8BAA8B;IAElC,OAAO,CAAC,EAAE,iCAAiC,EAAE,CAAC;IAErD;;;;OAIG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAiBvC;;;OAGG;IACI,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE;IAOrC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMtB"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApplicationCommandOptionWithChoicesBase = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
require("discord-api-types/v9");
|
|
6
|
-
const ow_1 = (0, tslib_1.__importDefault)(require("ow"));
|
|
7
|
-
const Assertions_1 = require("../Assertions");
|
|
8
|
-
const CommandOptionBase_1 = require("./CommandOptionBase");
|
|
9
|
-
const stringPredicate = ow_1.default.string.minLength(1).maxLength(100);
|
|
10
|
-
const integerPredicate = ow_1.default.number.finite;
|
|
11
|
-
// TODO: See resolution for sindresorhus/ow#217 in relation to this cast
|
|
12
|
-
const choicesPredicate = ow_1.default.array.ofType(ow_1.default.array.exactShape([stringPredicate, ow_1.default.any(ow_1.default.string, integerPredicate)]));
|
|
13
|
-
class ApplicationCommandOptionWithChoicesBase extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
Object.defineProperty(this, "choices", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Adds a choice for this option
|
|
25
|
-
* @param name The name of the choice
|
|
26
|
-
* @param value The value of the choice
|
|
27
|
-
*/
|
|
28
|
-
addChoice(name, value) {
|
|
29
|
-
this.choices ?? (this.choices = []);
|
|
30
|
-
(0, Assertions_1.validateMaxChoicesLength)(this.choices);
|
|
31
|
-
// Validate name
|
|
32
|
-
(0, ow_1.default)(name, `${ApplicationCommandOptionTypeNames[this.type]} choice name`, stringPredicate);
|
|
33
|
-
// Validate the value
|
|
34
|
-
if (this.type === 3 /* String */)
|
|
35
|
-
(0, ow_1.default)(value, 'string choice value', stringPredicate);
|
|
36
|
-
else
|
|
37
|
-
(0, ow_1.default)(value, `${ApplicationCommandOptionTypeNames[this.type]} choice value`, integerPredicate);
|
|
38
|
-
this.choices.push({ name, value });
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Adds multiple choices for this option
|
|
43
|
-
* @param choices The choices to add
|
|
44
|
-
*/
|
|
45
|
-
addChoices(choices) {
|
|
46
|
-
(0, ow_1.default)(choices, `${ApplicationCommandOptionTypeNames[this.type]} choices`, choicesPredicate);
|
|
47
|
-
for (const [label, value] of choices)
|
|
48
|
-
this.addChoice(label, value);
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
toJSON() {
|
|
52
|
-
return {
|
|
53
|
-
...super.toJSON(),
|
|
54
|
-
choices: this.choices,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.ApplicationCommandOptionWithChoicesBase = ApplicationCommandOptionWithChoicesBase;
|
|
59
|
-
const ApplicationCommandOptionTypeNames = {
|
|
60
|
-
[1 /* Subcommand */]: 'subcommand',
|
|
61
|
-
[2 /* SubcommandGroup */]: 'subcommand group',
|
|
62
|
-
[3 /* String */]: 'string',
|
|
63
|
-
[4 /* Integer */]: 'integer',
|
|
64
|
-
[5 /* Boolean */]: 'boolean',
|
|
65
|
-
[6 /* User */]: 'user',
|
|
66
|
-
[7 /* Channel */]: 'channel',
|
|
67
|
-
[8 /* Role */]: 'role',
|
|
68
|
-
[9 /* Mentionable */]: 'mentionable',
|
|
69
|
-
[10 /* Number */]: 'number',
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=CommandOptionWithChoices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandOptionWithChoices.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionWithChoices.ts"],"names":[],"mappings":";;;;AAAA,gCAAuG;AACvG,yDAAmC;AACnC,8CAAyD;AAEzD,2DAA6D;AAE7D,MAAM,eAAe,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC9D,MAAM,gBAAgB,GAAG,YAAE,CAAC,MAAM,CAAC,MAAM,CAAC;AAE1C,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,YAAE,CAAC,KAAK,CAAC,MAAM,CACvC,YAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,EAAE,gBAAgB,CAA0C,CAAC,CAAC,CACpH,CAAC;AAEF,MAAsB,uCACrB,SAAQ,0CAAsB;IAD/B;;QAIC;;;;;WAAqD;IAyCtD,CAAC;IAvCA;;;;OAIG;IACI,SAAS,CAAC,IAAY,EAAE,KAAQ;QACtC,IAAI,CAAC,OAAO,KAAZ,IAAI,CAAC,OAAO,GAAK,EAAE,EAAC;QAEpB,IAAA,qCAAwB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEvC,gBAAgB;QAChB,IAAA,YAAE,EAAC,IAAI,EAAE,GAAG,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QAEzF,qBAAqB;QACrB,IAAI,IAAI,CAAC,IAAI,mBAAwC;YAAE,IAAA,YAAE,EAAC,KAAK,EAAE,qBAAqB,EAAE,eAAe,CAAC,CAAC;;YACpG,IAAA,YAAE,EAAC,KAAK,EAAE,GAAG,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAEjG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,OAAmC;QACpD,IAAA,YAAE,EAAC,OAAO,EAAE,GAAG,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAEzF,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO;YAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACb,CAAC;IAEe,MAAM;QACrB,OAAO;YACN,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD;AA7CD,0FA6CC;AAED,MAAM,iCAAiC,GAAG;IACzC,oBAAyC,EAAE,YAAY;IACvD,yBAA8C,EAAE,kBAAkB;IAClE,gBAAqC,EAAE,QAAQ;IAC/C,iBAAsC,EAAE,SAAS;IACjD,iBAAsC,EAAE,SAAS;IACjD,cAAmC,EAAE,MAAM;IAC3C,iBAAsC,EAAE,SAAS;IACjD,cAAmC,EAAE,MAAM;IAC3C,qBAA0C,EAAE,aAAa;IACzD,iBAAqC,EAAE,QAAQ;CACtC,CAAC","sourcesContent":["import { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport ow, { Predicate } from 'ow';\nimport { validateMaxChoicesLength } from '../Assertions';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SlashCommandOptionBase } from './CommandOptionBase';\n\nconst stringPredicate = ow.string.minLength(1).maxLength(100);\nconst integerPredicate = ow.number.finite;\n\n// TODO: See resolution for sindresorhus/ow#217 in relation to this cast\nconst choicesPredicate = ow.array.ofType<[string, string | number]>(\n\tow.array.exactShape([stringPredicate, ow.any(ow.string, integerPredicate) as unknown as Predicate<string | number>]),\n);\n\nexport abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number>\n\textends SlashCommandOptionBase\n\timplements ToAPIApplicationCommandOptions\n{\n\tpublic choices?: APIApplicationCommandOptionChoice[];\n\n\t/**\n\t * Adds a choice for this option\n\t * @param name The name of the choice\n\t * @param value The value of the choice\n\t */\n\tpublic addChoice(name: string, value: T) {\n\t\tthis.choices ??= [];\n\n\t\tvalidateMaxChoicesLength(this.choices);\n\n\t\t// Validate name\n\t\tow(name, `${ApplicationCommandOptionTypeNames[this.type]} choice name`, stringPredicate);\n\n\t\t// Validate the value\n\t\tif (this.type === ApplicationCommandOptionType.String) ow(value, 'string choice value', stringPredicate);\n\t\telse ow(value, `${ApplicationCommandOptionTypeNames[this.type]} choice value`, integerPredicate);\n\n\t\tthis.choices.push({ name, value });\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds multiple choices for this option\n\t * @param choices The choices to add\n\t */\n\tpublic addChoices(choices: [name: string, value: T][]) {\n\t\tow(choices, `${ApplicationCommandOptionTypeNames[this.type]} choices`, choicesPredicate);\n\n\t\tfor (const [label, value] of choices) this.addChoice(label, value);\n\t\treturn this;\n\t}\n\n\tpublic override toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\tchoices: this.choices,\n\t\t};\n\t}\n}\n\nconst ApplicationCommandOptionTypeNames = {\n\t[ApplicationCommandOptionType.Subcommand]: 'subcommand',\n\t[ApplicationCommandOptionType.SubcommandGroup]: 'subcommand group',\n\t[ApplicationCommandOptionType.String]: 'string',\n\t[ApplicationCommandOptionType.Integer]: 'integer',\n\t[ApplicationCommandOptionType.Boolean]: 'boolean',\n\t[ApplicationCommandOptionType.User]: 'user',\n\t[ApplicationCommandOptionType.Channel]: 'channel',\n\t[ApplicationCommandOptionType.Role]: 'role',\n\t[ApplicationCommandOptionType.Mentionable]: 'mentionable',\n\t[ApplicationCommandOptionType.Number]: 'number',\n} as const;\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { SlashCommandBooleanOption } from '../options/boolean';
|
|
2
|
-
import { SlashCommandChannelOption } from '../options/channel';
|
|
3
|
-
import { SlashCommandIntegerOption } from '../options/integer';
|
|
4
|
-
import { SlashCommandMentionableOption } from '../options/mentionable';
|
|
5
|
-
import { SlashCommandNumberOption } from '../options/number';
|
|
6
|
-
import { SlashCommandRoleOption } from '../options/role';
|
|
7
|
-
import { SlashCommandStringOption } from '../options/string';
|
|
8
|
-
import { SlashCommandUserOption } from '../options/user';
|
|
9
|
-
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
|
10
|
-
export declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
|
|
11
|
-
readonly options: ToAPIApplicationCommandOptions[];
|
|
12
|
-
/**
|
|
13
|
-
* Adds a boolean option
|
|
14
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
15
|
-
*/
|
|
16
|
-
addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
17
|
-
/**
|
|
18
|
-
* Adds a user option
|
|
19
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
20
|
-
*/
|
|
21
|
-
addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
22
|
-
/**
|
|
23
|
-
* Adds a channel option
|
|
24
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
25
|
-
*/
|
|
26
|
-
addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
27
|
-
/**
|
|
28
|
-
* Adds a role option
|
|
29
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
30
|
-
*/
|
|
31
|
-
addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
32
|
-
/**
|
|
33
|
-
* Adds a mentionable option
|
|
34
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
35
|
-
*/
|
|
36
|
-
addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
37
|
-
/**
|
|
38
|
-
* Adds a string option
|
|
39
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
40
|
-
*/
|
|
41
|
-
addStringOption(input: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
42
|
-
/**
|
|
43
|
-
* Adds an integer option
|
|
44
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
45
|
-
*/
|
|
46
|
-
addIntegerOption(input: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
47
|
-
/**
|
|
48
|
-
* Adds a number option
|
|
49
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
50
|
-
*/
|
|
51
|
-
addNumberOption(input: SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
52
|
-
private _sharedAddOptionMethod;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=CommandOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandOptions.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAE7E,qBAAa,yBAAyB,CAAC,6BAA6B,GAAG,IAAI;IAC1E,SAAgB,OAAO,EAAG,8BAA8B,EAAE,CAAC;IAE3D;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IAIlH;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IAIlH;;;OAGG;IACI,oBAAoB,CAC1B,KAAK,EAAE,6BAA6B,GAAG,CAAC,CAAC,OAAO,EAAE,6BAA6B,KAAK,6BAA6B,CAAC;IAKnH;;;OAGG;IACI,eAAe,CACrB,KAAK,EAAE,wBAAwB,GAAG,CAAC,CAAC,OAAO,EAAE,wBAAwB,KAAK,wBAAwB,CAAC;IAKpG;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,eAAe,CACrB,KAAK,EAAE,wBAAwB,GAAG,CAAC,CAAC,OAAO,EAAE,wBAAwB,KAAK,wBAAwB,CAAC;IAKpG,OAAO,CAAC,sBAAsB;CAmB9B"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SharedSlashCommandOptions = void 0;
|
|
4
|
-
const Assertions_1 = require("../Assertions");
|
|
5
|
-
const boolean_1 = require("../options/boolean");
|
|
6
|
-
const channel_1 = require("../options/channel");
|
|
7
|
-
const integer_1 = require("../options/integer");
|
|
8
|
-
const mentionable_1 = require("../options/mentionable");
|
|
9
|
-
const number_1 = require("../options/number");
|
|
10
|
-
const role_1 = require("../options/role");
|
|
11
|
-
const string_1 = require("../options/string");
|
|
12
|
-
const user_1 = require("../options/user");
|
|
13
|
-
class SharedSlashCommandOptions {
|
|
14
|
-
constructor() {
|
|
15
|
-
Object.defineProperty(this, "options", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: void 0
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Adds a boolean option
|
|
24
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
25
|
-
*/
|
|
26
|
-
addBooleanOption(input) {
|
|
27
|
-
return this._sharedAddOptionMethod(input, boolean_1.SlashCommandBooleanOption);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Adds a user option
|
|
31
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
32
|
-
*/
|
|
33
|
-
addUserOption(input) {
|
|
34
|
-
return this._sharedAddOptionMethod(input, user_1.SlashCommandUserOption);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Adds a channel option
|
|
38
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
39
|
-
*/
|
|
40
|
-
addChannelOption(input) {
|
|
41
|
-
return this._sharedAddOptionMethod(input, channel_1.SlashCommandChannelOption);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Adds a role option
|
|
45
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
46
|
-
*/
|
|
47
|
-
addRoleOption(input) {
|
|
48
|
-
return this._sharedAddOptionMethod(input, role_1.SlashCommandRoleOption);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Adds a mentionable option
|
|
52
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
53
|
-
*/
|
|
54
|
-
addMentionableOption(input) {
|
|
55
|
-
return this._sharedAddOptionMethod(input, mentionable_1.SlashCommandMentionableOption);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Adds a string option
|
|
59
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
60
|
-
*/
|
|
61
|
-
addStringOption(input) {
|
|
62
|
-
return this._sharedAddOptionMethod(input, string_1.SlashCommandStringOption);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Adds an integer option
|
|
66
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
67
|
-
*/
|
|
68
|
-
addIntegerOption(input) {
|
|
69
|
-
return this._sharedAddOptionMethod(input, integer_1.SlashCommandIntegerOption);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Adds a number option
|
|
73
|
-
* @param input A function that returns an option builder, or an already built builder
|
|
74
|
-
*/
|
|
75
|
-
addNumberOption(input) {
|
|
76
|
-
return this._sharedAddOptionMethod(input, number_1.SlashCommandNumberOption);
|
|
77
|
-
}
|
|
78
|
-
_sharedAddOptionMethod(input, Instance) {
|
|
79
|
-
const { options } = this;
|
|
80
|
-
// First, assert options conditions - we cannot have more than 25 options
|
|
81
|
-
(0, Assertions_1.validateMaxOptionsLength)(options);
|
|
82
|
-
// Get the final result
|
|
83
|
-
const result = typeof input === 'function' ? input(new Instance()) : input;
|
|
84
|
-
(0, Assertions_1.assertReturnOfBuilder)(result, Instance);
|
|
85
|
-
// Push it
|
|
86
|
-
options.push(result);
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.SharedSlashCommandOptions = SharedSlashCommandOptions;
|
|
91
|
-
//# sourceMappingURL=CommandOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandOptions.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptions.ts"],"names":[],"mappings":";;;AAAA,8CAAgF;AAEhF,gDAA+D;AAC/D,gDAA+D;AAC/D,gDAA+D;AAC/D,wDAAuE;AACvE,8CAA6D;AAC7D,0CAAyD;AACzD,8CAA6D;AAC7D,0CAAyD;AAGzD,MAAa,yBAAyB;IAAtC;QACC;;;;;WAA2D;IAiG5D,CAAC;IA/FA;;;OAGG;IACI,gBAAgB,CACtB,KAAsG;QAEtG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,mCAAyB,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,KAA6F;QACjH,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,6BAAsB,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,gBAAgB,CACtB,KAAsG;QAEtG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,mCAAyB,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,KAA6F;QACjH,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,6BAAsB,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAC1B,KAAkH;QAElH,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,2CAA6B,CAAC,CAAC;IAC1E,CAAC;IAED;;;OAGG;IACI,eAAe,CACrB,KAAmG;QAEnG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,iCAAwB,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACI,gBAAgB,CACtB,KAAsG;QAEtG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,mCAAyB,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,eAAe,CACrB,KAAmG;QAEnG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,iCAAwB,CAAC,CAAC;IACrE,CAAC;IAEO,sBAAsB,CAC7B,KAA8B,EAC9B,QAAqB;QAErB,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,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAE3E,IAAA,kCAAqB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAExC,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAlGD,8DAkGC","sourcesContent":["import { assertReturnOfBuilder, validateMaxOptionsLength } from '../Assertions';\nimport type { SlashCommandOptionBase } from './CommandOptionBase';\nimport { SlashCommandBooleanOption } from '../options/boolean';\nimport { SlashCommandChannelOption } from '../options/channel';\nimport { SlashCommandIntegerOption } from '../options/integer';\nimport { SlashCommandMentionableOption } from '../options/mentionable';\nimport { SlashCommandNumberOption } from '../options/number';\nimport { SlashCommandRoleOption } from '../options/role';\nimport { SlashCommandStringOption } from '../options/string';\nimport { SlashCommandUserOption } from '../options/user';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\n\nexport class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {\n\tpublic readonly options!: ToAPIApplicationCommandOptions[];\n\n\t/**\n\t * Adds a boolean option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addBooleanOption(\n\t\tinput: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandBooleanOption);\n\t}\n\n\t/**\n\t * Adds a user option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandUserOption);\n\t}\n\n\t/**\n\t * Adds a channel option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addChannelOption(\n\t\tinput: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandChannelOption);\n\t}\n\n\t/**\n\t * Adds a role option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandRoleOption);\n\t}\n\n\t/**\n\t * Adds a mentionable option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addMentionableOption(\n\t\tinput: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandMentionableOption);\n\t}\n\n\t/**\n\t * Adds a string option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addStringOption(\n\t\tinput: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandStringOption);\n\t}\n\n\t/**\n\t * Adds an integer option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addIntegerOption(\n\t\tinput: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandIntegerOption);\n\t}\n\n\t/**\n\t * Adds a number option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addNumberOption(\n\t\tinput: SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandNumberOption);\n\t}\n\n\tprivate _sharedAddOptionMethod<T extends SlashCommandOptionBase>(\n\t\tinput: T | ((builder: T) => T),\n\t\tInstance: new () => T,\n\t): ShouldOmitSubcommandFunctions extends true ? Omit<this, 'addSubcommand' | 'addSubcommandGroup'> : this {\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 Instance()) : input;\n\n\t\tassertReturnOfBuilder(result, Instance);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class SharedNameAndDescription {
|
|
2
|
-
readonly name: string;
|
|
3
|
-
readonly description: string;
|
|
4
|
-
/**
|
|
5
|
-
* Sets the name
|
|
6
|
-
* @param name The name
|
|
7
|
-
*/
|
|
8
|
-
setName(name: string): this;
|
|
9
|
-
/**
|
|
10
|
-
* Sets the description
|
|
11
|
-
* @param description The description
|
|
12
|
-
*/
|
|
13
|
-
setDescription(description: string): this;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=NameAndDescription.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NameAndDescription.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/NameAndDescription.ts"],"names":[],"mappings":"AAEA,qBAAa,wBAAwB;IACpC,SAAgB,IAAI,EAAG,MAAM,CAAC;IAC9B,SAAgB,WAAW,EAAG,MAAM,CAAC;IAErC;;;OAGG;IACI,OAAO,CAAC,IAAI,EAAE,MAAM;IAS3B;;;OAGG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;CAQzC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SharedNameAndDescription = void 0;
|
|
4
|
-
const Assertions_1 = require("../Assertions");
|
|
5
|
-
class SharedNameAndDescription {
|
|
6
|
-
constructor() {
|
|
7
|
-
Object.defineProperty(this, "name", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true,
|
|
11
|
-
value: void 0
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(this, "description", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: void 0
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Sets the name
|
|
22
|
-
* @param name The name
|
|
23
|
-
*/
|
|
24
|
-
setName(name) {
|
|
25
|
-
// Assert the name matches the conditions
|
|
26
|
-
(0, Assertions_1.validateName)(name);
|
|
27
|
-
Reflect.set(this, 'name', name);
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Sets the description
|
|
32
|
-
* @param description The description
|
|
33
|
-
*/
|
|
34
|
-
setDescription(description) {
|
|
35
|
-
// Assert the description matches the conditions
|
|
36
|
-
(0, Assertions_1.validateDescription)(description);
|
|
37
|
-
Reflect.set(this, 'description', description);
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.SharedNameAndDescription = SharedNameAndDescription;
|
|
42
|
-
//# sourceMappingURL=NameAndDescription.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NameAndDescription.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/NameAndDescription.ts"],"names":[],"mappings":";;;AAAA,8CAAkE;AAElE,MAAa,wBAAwB;IAArC;QACC;;;;;WAA8B;QAC9B;;;;;WAAqC;IA2BtC,CAAC;IAzBA;;;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,cAAc,CAAC,WAAmB;QACxC,gDAAgD;QAChD,IAAA,gCAAmB,EAAC,WAAW,CAAC,CAAC;QAEjC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA7BD,4DA6BC","sourcesContent":["import { validateDescription, validateName } from '../Assertions';\n\nexport class SharedNameAndDescription {\n\tpublic readonly name!: string;\n\tpublic readonly description!: string;\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 description\n\t * @param description The description\n\t */\n\tpublic setDescription(description: string) {\n\t\t// Assert the description matches the conditions\n\t\tvalidateDescription(description);\n\n\t\tReflect.set(this, 'description', description);\n\n\t\treturn this;\n\t}\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
2
|
-
import { SlashCommandOptionBase } from '../mixins/CommandOptionBase';
|
|
3
|
-
export declare class SlashCommandBooleanOption extends SlashCommandOptionBase {
|
|
4
|
-
readonly type: ApplicationCommandOptionType.Boolean;
|
|
5
|
-
constructor();
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,yBAA0B,SAAQ,sBAAsB;IACpE,SAAyB,IAAI,uCAAiD;;CAK9E"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlashCommandBooleanOption = void 0;
|
|
4
|
-
require("discord-api-types/v9");
|
|
5
|
-
const CommandOptionBase_1 = require("../mixins/CommandOptionBase");
|
|
6
|
-
class SlashCommandBooleanOption extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(5 /* Boolean */);
|
|
9
|
-
Object.defineProperty(this, "type", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: 5 /* Boolean */
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.SlashCommandBooleanOption = SlashCommandBooleanOption;
|
|
18
|
-
//# sourceMappingURL=boolean.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"/","sources":["interactions/slashCommands/options/boolean.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,mEAAqE;AAErE,MAAa,yBAA0B,SAAQ,0CAAsB;IAGpE;QACC,KAAK,iBAAsC,CAAC;QAH7C;;;;mBAAgC,eAA6C;WAAC;IAI9E,CAAC;CACD;AAND,8DAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { SlashCommandOptionBase } from '../mixins/CommandOptionBase';\n\nexport class SlashCommandBooleanOption extends SlashCommandOptionBase {\n\tpublic override readonly type = ApplicationCommandOptionType.Boolean as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Boolean);\n\t}\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
2
|
-
import { ApplicationCommandOptionWithChannelTypesBase } from '../mixins/CommandChannelOptionBase';
|
|
3
|
-
export declare class SlashCommandChannelOption extends ApplicationCommandOptionWithChannelTypesBase {
|
|
4
|
-
readonly type: ApplicationCommandOptionType.Channel;
|
|
5
|
-
constructor();
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,4CAA4C,EAAE,MAAM,oCAAoC,CAAC;AAElG,qBAAa,yBAA0B,SAAQ,4CAA4C;IAC1F,SAAyB,IAAI,uCAAiD;;CAK9E"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlashCommandChannelOption = void 0;
|
|
4
|
-
require("discord-api-types/v9");
|
|
5
|
-
const CommandChannelOptionBase_1 = require("../mixins/CommandChannelOptionBase");
|
|
6
|
-
class SlashCommandChannelOption extends CommandChannelOptionBase_1.ApplicationCommandOptionWithChannelTypesBase {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(7 /* Channel */);
|
|
9
|
-
Object.defineProperty(this, "type", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: 7 /* Channel */
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.SlashCommandChannelOption = SlashCommandChannelOption;
|
|
18
|
-
//# sourceMappingURL=channel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"/","sources":["interactions/slashCommands/options/channel.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,iFAAkG;AAElG,MAAa,yBAA0B,SAAQ,uEAA4C;IAG1F;QACC,KAAK,iBAAsC,CAAC;QAH7C;;;;mBAAgC,eAA6C;WAAC;IAI9E,CAAC;CACD;AAND,8DAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { ApplicationCommandOptionWithChannelTypesBase } from '../mixins/CommandChannelOptionBase';\n\nexport class SlashCommandChannelOption extends ApplicationCommandOptionWithChannelTypesBase {\n\tpublic override readonly type = ApplicationCommandOptionType.Channel as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Channel);\n\t}\n}\n"]}
|