@discordjs/builders 1.1.0-dev.1658102995-dda2895 → 1.1.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/CHANGELOG.md +16 -0
- package/README.md +5 -2
- package/dist/components/ActionRow.cjs +32 -0
- package/dist/components/ActionRow.cjs.map +1 -0
- package/dist/components/ActionRow.d.ts +35 -0
- package/dist/components/ActionRow.d.ts.map +1 -0
- package/dist/components/ActionRow.mjs +28 -0
- package/dist/components/ActionRow.mjs.map +1 -0
- package/dist/components/Assertions.cjs +77 -0
- package/dist/components/Assertions.cjs.map +1 -0
- package/dist/components/Assertions.d.ts +48 -0
- package/dist/components/Assertions.d.ts.map +1 -0
- package/dist/components/Assertions.mjs +57 -0
- package/dist/components/Assertions.mjs.map +1 -0
- package/dist/components/Component.cjs +12 -0
- package/dist/components/Component.cjs.map +1 -0
- package/dist/components/Component.d.ts +15 -0
- package/dist/components/Component.d.ts.map +1 -0
- package/dist/components/Component.mjs +8 -0
- package/dist/components/Component.mjs.map +1 -0
- package/dist/components/Components.cjs +31 -0
- package/dist/components/Components.cjs.map +1 -0
- package/dist/components/Components.d.ts +21 -0
- package/dist/components/Components.d.ts.map +1 -0
- package/dist/components/Components.mjs +27 -0
- package/dist/components/Components.mjs.map +1 -0
- package/dist/components/button/Button.cjs +46 -0
- package/dist/components/button/Button.cjs.map +1 -0
- package/dist/components/button/Button.d.ts +46 -0
- package/dist/components/button/Button.d.ts.map +1 -0
- package/dist/components/button/Button.mjs +42 -0
- package/dist/components/button/Button.mjs.map +1 -0
- package/dist/components/selectMenu/SelectMenu.cjs +59 -0
- package/dist/components/selectMenu/SelectMenu.cjs.map +1 -0
- package/dist/components/selectMenu/SelectMenu.d.ts +59 -0
- package/dist/components/selectMenu/SelectMenu.d.ts.map +1 -0
- package/dist/components/selectMenu/SelectMenu.mjs +55 -0
- package/dist/components/selectMenu/SelectMenu.mjs.map +1 -0
- package/dist/components/selectMenu/SelectMenuOption.cjs +40 -0
- package/dist/components/selectMenu/SelectMenuOption.cjs.map +1 -0
- package/dist/components/selectMenu/SelectMenuOption.d.ts +40 -0
- package/dist/components/selectMenu/SelectMenuOption.d.ts.map +1 -0
- package/dist/components/selectMenu/SelectMenuOption.mjs +36 -0
- package/dist/components/selectMenu/SelectMenuOption.mjs.map +1 -0
- package/dist/components/textInput/Assertions.cjs +31 -0
- package/dist/components/textInput/Assertions.cjs.map +1 -0
- package/dist/components/textInput/Assertions.d.ts +10 -0
- package/dist/components/textInput/Assertions.d.ts.map +1 -0
- package/dist/components/textInput/Assertions.mjs +20 -0
- package/dist/components/textInput/Assertions.mjs.map +1 -0
- package/dist/components/textInput/TextInput.cjs +67 -0
- package/dist/components/textInput/TextInput.cjs.map +1 -0
- package/dist/components/textInput/TextInput.d.ts +59 -0
- package/dist/components/textInput/TextInput.d.ts.map +1 -0
- package/dist/components/textInput/TextInput.mjs +59 -0
- package/dist/components/textInput/TextInput.mjs.map +1 -0
- package/dist/index.cjs +129 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +40 -1406
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +46 -1482
- package/dist/index.mjs.map +1 -1
- package/dist/interactions/contextMenuCommands/Assertions.cjs +40 -0
- package/dist/interactions/contextMenuCommands/Assertions.cjs.map +1 -0
- package/dist/interactions/contextMenuCommands/Assertions.d.ts +8 -0
- package/dist/interactions/contextMenuCommands/Assertions.d.ts.map +1 -0
- package/dist/interactions/contextMenuCommands/Assertions.mjs +31 -0
- package/dist/interactions/contextMenuCommands/Assertions.mjs.map +1 -0
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs +71 -0
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs.map +1 -0
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts +94 -0
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts.map +1 -0
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs +67 -0
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs.map +1 -0
- package/dist/interactions/modals/Assertions.cjs +21 -0
- package/dist/interactions/modals/Assertions.cjs.map +1 -0
- package/dist/interactions/modals/Assertions.d.ts +5 -0
- package/dist/interactions/modals/Assertions.d.ts.map +1 -0
- package/dist/interactions/modals/Assertions.mjs +15 -0
- package/dist/interactions/modals/Assertions.mjs.map +1 -0
- package/dist/interactions/modals/Modal.cjs +43 -0
- package/dist/interactions/modals/Modal.cjs.map +1 -0
- package/dist/interactions/modals/Modal.d.ts +35 -0
- package/dist/interactions/modals/Modal.d.ts.map +1 -0
- package/dist/interactions/modals/Modal.mjs +39 -0
- package/dist/interactions/modals/Modal.mjs.map +1 -0
- package/dist/interactions/slashCommands/Assertions.cjs +70 -0
- package/dist/interactions/slashCommands/Assertions.cjs.map +1 -0
- package/dist/interactions/slashCommands/Assertions.d.ts +18 -0
- package/dist/interactions/slashCommands/Assertions.d.ts.map +1 -0
- package/dist/interactions/slashCommands/Assertions.mjs +54 -0
- package/dist/interactions/slashCommands/Assertions.mjs.map +1 -0
- package/dist/interactions/slashCommands/SlashCommandBuilder.cjs +75 -0
- package/dist/interactions/slashCommands/SlashCommandBuilder.cjs.map +1 -0
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +100 -0
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +1 -0
- package/dist/interactions/slashCommands/SlashCommandBuilder.mjs +73 -0
- package/dist/interactions/slashCommands/SlashCommandBuilder.mjs.map +1 -0
- package/dist/interactions/slashCommands/SlashCommandSubcommands.cjs +72 -0
- package/dist/interactions/slashCommands/SlashCommandSubcommands.cjs.map +1 -0
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +56 -0
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +1 -0
- package/dist/interactions/slashCommands/SlashCommandSubcommands.mjs +70 -0
- package/dist/interactions/slashCommands/SlashCommandSubcommands.mjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs +9 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts +17 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.mjs +5 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.mjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs +27 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts +15 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs +23 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs +30 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.d.ts +14 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.d.ts.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.mjs +26 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.mjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs +57 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts +19 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts.map +1 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs +53 -0
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs +65 -0
- package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts +46 -0
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +1 -0
- package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs +61 -0
- package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs +55 -0
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs.map +1 -0
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts +69 -0
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts.map +1 -0
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.mjs +51 -0
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/attachment.cjs +20 -0
- package/dist/interactions/slashCommands/options/attachment.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/attachment.d.ts +7 -0
- package/dist/interactions/slashCommands/options/attachment.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/attachment.mjs +16 -0
- package/dist/interactions/slashCommands/options/attachment.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/boolean.cjs +20 -0
- package/dist/interactions/slashCommands/options/boolean.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/boolean.d.ts +7 -0
- package/dist/interactions/slashCommands/options/boolean.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/boolean.mjs +16 -0
- package/dist/interactions/slashCommands/options/boolean.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/channel.cjs +34 -0
- package/dist/interactions/slashCommands/options/channel.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/channel.d.ts +10 -0
- package/dist/interactions/slashCommands/options/channel.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/channel.mjs +32 -0
- package/dist/interactions/slashCommands/options/channel.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/integer.cjs +50 -0
- package/dist/interactions/slashCommands/options/integer.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/integer.d.ts +13 -0
- package/dist/interactions/slashCommands/options/integer.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/integer.mjs +48 -0
- package/dist/interactions/slashCommands/options/integer.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/mentionable.cjs +20 -0
- package/dist/interactions/slashCommands/options/mentionable.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/mentionable.d.ts +7 -0
- package/dist/interactions/slashCommands/options/mentionable.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/mentionable.mjs +16 -0
- package/dist/interactions/slashCommands/options/mentionable.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/number.cjs +50 -0
- package/dist/interactions/slashCommands/options/number.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/number.d.ts +13 -0
- package/dist/interactions/slashCommands/options/number.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/number.mjs +48 -0
- package/dist/interactions/slashCommands/options/number.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/role.cjs +20 -0
- package/dist/interactions/slashCommands/options/role.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/role.d.ts +7 -0
- package/dist/interactions/slashCommands/options/role.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/role.mjs +16 -0
- package/dist/interactions/slashCommands/options/role.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/string.cjs +50 -0
- package/dist/interactions/slashCommands/options/string.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/string.d.ts +24 -0
- package/dist/interactions/slashCommands/options/string.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/string.mjs +48 -0
- package/dist/interactions/slashCommands/options/string.mjs.map +1 -0
- package/dist/interactions/slashCommands/options/user.cjs +20 -0
- package/dist/interactions/slashCommands/options/user.cjs.map +1 -0
- package/dist/interactions/slashCommands/options/user.d.ts +7 -0
- package/dist/interactions/slashCommands/options/user.d.ts.map +1 -0
- package/dist/interactions/slashCommands/options/user.mjs +16 -0
- package/dist/interactions/slashCommands/options/user.mjs.map +1 -0
- package/dist/messages/embed/Assertions.cjs +62 -0
- package/dist/messages/embed/Assertions.cjs.map +1 -0
- package/dist/messages/embed/Assertions.d.ts +50 -0
- package/dist/messages/embed/Assertions.d.ts.map +1 -0
- package/dist/messages/embed/Assertions.mjs +41 -0
- package/dist/messages/embed/Assertions.mjs.map +1 -0
- package/dist/messages/embed/Embed.cjs +101 -0
- package/dist/messages/embed/Embed.cjs.map +1 -0
- package/dist/messages/embed/Embed.d.ts +108 -0
- package/dist/messages/embed/Embed.d.ts.map +1 -0
- package/dist/messages/embed/Embed.mjs +97 -0
- package/dist/messages/embed/Embed.mjs.map +1 -0
- package/dist/messages/formatters.cjs +102 -0
- package/dist/messages/formatters.cjs.map +1 -0
- package/dist/messages/formatters.d.ts +246 -0
- package/dist/messages/formatters.d.ts.map +1 -0
- package/dist/messages/formatters.mjs +79 -0
- package/dist/messages/formatters.mjs.map +1 -0
- package/dist/util/componentUtil.cjs +10 -0
- package/dist/util/componentUtil.cjs.map +1 -0
- package/dist/util/componentUtil.d.ts +3 -0
- package/dist/util/componentUtil.d.ts.map +1 -0
- package/dist/util/componentUtil.mjs +6 -0
- package/dist/util/componentUtil.mjs.map +1 -0
- package/dist/util/equatable.cjs +10 -0
- package/dist/util/equatable.cjs.map +1 -0
- package/dist/util/equatable.d.ts +12 -0
- package/dist/util/equatable.d.ts.map +1 -0
- package/dist/util/equatable.mjs +6 -0
- package/dist/util/equatable.mjs.map +1 -0
- package/dist/util/jsonEncodable.cjs +10 -0
- package/dist/util/jsonEncodable.cjs.map +1 -0
- package/dist/util/jsonEncodable.d.ts +12 -0
- package/dist/util/jsonEncodable.d.ts.map +1 -0
- package/dist/util/jsonEncodable.mjs +6 -0
- package/dist/util/jsonEncodable.mjs.map +1 -0
- package/dist/util/normalizeArray.cjs +12 -0
- package/dist/util/normalizeArray.cjs.map +1 -0
- package/dist/util/normalizeArray.d.ts +3 -0
- package/dist/util/normalizeArray.d.ts.map +1 -0
- package/dist/util/normalizeArray.mjs +8 -0
- package/dist/util/normalizeArray.mjs.map +1 -0
- package/dist/util/validation.cjs +13 -0
- package/dist/util/validation.cjs.map +1 -0
- package/dist/util/validation.d.ts +4 -0
- package/dist/util/validation.d.ts.map +1 -0
- package/dist/util/validation.mjs +7 -0
- package/dist/util/validation.mjs.map +1 -0
- package/package.json +17 -16
- package/dist/index.js +0 -1557
- package/dist/index.js.map +0 -1
package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionChannelTypesMixin.d.ts","sourceRoot":"","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,QAAA,MAAM,mBAAmB,qOASf,CAAC;AAEX,oBAAY,2CAA2C,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAI7F,qBAAa,yCAAyC;IACrD,SAAgB,aAAa,CAAC,EAAE,2CAA2C,EAAE,CAAC;IAE9E;;;;OAIG;IACI,eAAe,CAAC,GAAG,YAAY,EAAE,2CAA2C,EAAE;CASrF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import { ChannelType } from 'discord-api-types/v10';
|
|
3
|
+
|
|
4
|
+
const allowedChannelTypes = [
|
|
5
|
+
ChannelType.GuildText,
|
|
6
|
+
ChannelType.GuildVoice,
|
|
7
|
+
ChannelType.GuildCategory,
|
|
8
|
+
ChannelType.GuildNews,
|
|
9
|
+
ChannelType.GuildNewsThread,
|
|
10
|
+
ChannelType.GuildPublicThread,
|
|
11
|
+
ChannelType.GuildPrivateThread,
|
|
12
|
+
ChannelType.GuildStageVoice
|
|
13
|
+
];
|
|
14
|
+
const channelTypesPredicate = s.array(s.union(...allowedChannelTypes.map((type) => s.literal(type))));
|
|
15
|
+
class ApplicationCommandOptionChannelTypesMixin {
|
|
16
|
+
addChannelTypes(...channelTypes) {
|
|
17
|
+
if (this.channel_types === void 0) {
|
|
18
|
+
Reflect.set(this, "channel_types", []);
|
|
19
|
+
}
|
|
20
|
+
this.channel_types.push(...channelTypesPredicate.parse(channelTypes));
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { ApplicationCommandOptionChannelTypesMixin };
|
|
26
|
+
//# sourceMappingURL=ApplicationCommandOptionChannelTypesMixin.mjs.map
|
package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionChannelTypesMixin.mjs","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport { ChannelType } from 'discord-api-types/v10';\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.GuildText,\n\tChannelType.GuildVoice,\n\tChannelType.GuildCategory,\n\tChannelType.GuildNews,\n\tChannelType.GuildNewsThread,\n\tChannelType.GuildPublicThread,\n\tChannelType.GuildPrivateThread,\n\tChannelType.GuildStageVoice,\n] as const;\n\nexport type ApplicationCommandOptionAllowedChannelTypes = typeof allowedChannelTypes[number];\n\nconst channelTypesPredicate = s.array(s.union(...allowedChannelTypes.map((type) => s.literal(type))));\n\nexport class ApplicationCommandOptionChannelTypesMixin {\n\tpublic readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[];\n\n\t/**\n\t * Adds channel types to this option\n\t *\n\t * @param channelTypes - The channel types to add\n\t */\n\tpublic addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]) {\n\t\tif (this.channel_types === undefined) {\n\t\t\tReflect.set(this, 'channel_types', []);\n\t\t}\n\n\t\tthis.channel_types!.push(...channelTypesPredicate.parse(channelTypes));\n\n\t\treturn this;\n\t}\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAG;AAC5B,EAAE,WAAW,CAAC,SAAS;AACvB,EAAE,WAAW,CAAC,UAAU;AACxB,EAAE,WAAW,CAAC,aAAa;AAC3B,EAAE,WAAW,CAAC,SAAS;AACvB,EAAE,WAAW,CAAC,eAAe;AAC7B,EAAE,WAAW,CAAC,iBAAiB;AAC/B,EAAE,WAAW,CAAC,kBAAkB;AAChC,EAAE,WAAW,CAAC,eAAe;AAC7B,CAAC,CAAC;AACF,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/F,MAAM,yCAAyC,CAAC;AACvD,EAAE,eAAe,CAAC,GAAG,YAAY,EAAE;AACnC,IAAI,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,EAAE;AACvC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;AAC7C,KAAK;AACL,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1E,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const shapeshift = require('@sapphire/shapeshift');
|
|
6
|
+
const v10 = require('discord-api-types/v10');
|
|
7
|
+
const Assertions = require('../Assertions.cjs');
|
|
8
|
+
|
|
9
|
+
const stringPredicate = shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
10
|
+
const numberPredicate = shapeshift.s.number.greaterThan(-Infinity).lessThan(Infinity);
|
|
11
|
+
const choicesPredicate = shapeshift.s.object({
|
|
12
|
+
name: stringPredicate,
|
|
13
|
+
name_localizations: Assertions.localizationMapPredicate,
|
|
14
|
+
value: shapeshift.s.union(stringPredicate, numberPredicate)
|
|
15
|
+
}).array;
|
|
16
|
+
const booleanPredicate = shapeshift.s.boolean;
|
|
17
|
+
class ApplicationCommandOptionWithChoicesAndAutocompleteMixin {
|
|
18
|
+
addChoices(...choices) {
|
|
19
|
+
if (choices.length > 0 && this.autocomplete) {
|
|
20
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
21
|
+
}
|
|
22
|
+
choicesPredicate.parse(choices);
|
|
23
|
+
if (this.choices === void 0) {
|
|
24
|
+
Reflect.set(this, "choices", []);
|
|
25
|
+
}
|
|
26
|
+
Assertions.validateChoicesLength(choices.length, this.choices);
|
|
27
|
+
for (const { name, name_localizations, value } of choices) {
|
|
28
|
+
if (this.type === v10.ApplicationCommandOptionType.String) {
|
|
29
|
+
stringPredicate.parse(value);
|
|
30
|
+
} else {
|
|
31
|
+
numberPredicate.parse(value);
|
|
32
|
+
}
|
|
33
|
+
this.choices.push({ name, name_localizations, value });
|
|
34
|
+
}
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
setChoices(...choices) {
|
|
38
|
+
if (choices.length > 0 && this.autocomplete) {
|
|
39
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
40
|
+
}
|
|
41
|
+
choicesPredicate.parse(choices);
|
|
42
|
+
Reflect.set(this, "choices", []);
|
|
43
|
+
this.addChoices(...choices);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
setAutocomplete(autocomplete) {
|
|
47
|
+
booleanPredicate.parse(autocomplete);
|
|
48
|
+
if (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {
|
|
49
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
50
|
+
}
|
|
51
|
+
Reflect.set(this, "autocomplete", autocomplete);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.ApplicationCommandOptionWithChoicesAndAutocompleteMixin = ApplicationCommandOptionWithChoicesAndAutocompleteMixin;
|
|
57
|
+
//# sourceMappingURL=ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v10';\nimport { localizationMapPredicate, validateChoicesLength } from '../Assertions';\n\nconst stringPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);\nconst numberPredicate = s.number.greaterThan(-Infinity).lessThan(Infinity);\nconst choicesPredicate = s.object({\n\tname: stringPredicate,\n\tname_localizations: localizationMapPredicate,\n\tvalue: s.union(stringPredicate, numberPredicate),\n}).array;\nconst booleanPredicate = s.boolean;\n\nexport class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends string | number> {\n\tpublic readonly choices?: APIApplicationCommandOptionChoice<T>[];\n\tpublic readonly autocomplete?: boolean;\n\n\t// Since this is present and this is a mixin, this is needed\n\tpublic readonly type!: ApplicationCommandOptionType;\n\n\t/**\n\t * Adds multiple choices for this option\n\t *\n\t * @param choices - The choices to add\n\t */\n\tpublic addChoices(...choices: APIApplicationCommandOptionChoice<T>[]): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tif (this.choices === undefined) {\n\t\t\tReflect.set(this, 'choices', []);\n\t\t}\n\n\t\tvalidateChoicesLength(choices.length, this.choices);\n\n\t\tfor (const { name, name_localizations, value } of choices) {\n\t\t\t// Validate the value\n\t\t\tif (this.type === ApplicationCommandOptionType.String) {\n\t\t\t\tstringPredicate.parse(value);\n\t\t\t} else {\n\t\t\t\tnumberPredicate.parse(value);\n\t\t\t}\n\n\t\t\tthis.choices!.push({ name, name_localizations, value });\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic setChoices<Input extends APIApplicationCommandOptionChoice<T>[]>(...choices: Input): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tReflect.set(this, 'choices', []);\n\t\tthis.addChoices(...choices);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Marks the option as autocompletable\n\t * @param autocomplete - If this option should be autocompletable\n\t */\n\tpublic setAutocomplete(autocomplete: boolean): this {\n\t\t// Assert that you actually passed a boolean\n\t\tbooleanPredicate.parse(autocomplete);\n\n\t\tif (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tReflect.set(this, 'autocomplete', autocomplete);\n\n\t\treturn this;\n\t}\n}\n"],"names":["s","localizationMapPredicate","validateChoicesLength","ApplicationCommandOptionType"],"mappings":";;;;;;;;AAGA,MAAM,eAAe,GAAGA,YAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;AACxF,MAAM,eAAe,GAAGA,YAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC3E,MAAM,gBAAgB,GAAGA,YAAC,CAAC,MAAM,CAAC;AAClC,EAAE,IAAI,EAAE,eAAe;AACvB,EAAE,kBAAkB,EAAEC,mCAAwB;AAC9C,EAAE,KAAK,EAAED,YAAC,CAAC,KAAK,CAAC,eAAe,EAAE,eAAe,CAAC;AAClD,CAAC,CAAC,CAAC,KAAK,CAAC;AACT,MAAM,gBAAgB,GAAGA,YAAC,CAAC,OAAO,CAAC;AAC5B,MAAM,uDAAuD,CAAC;AACrE,EAAE,UAAU,CAAC,GAAG,OAAO,EAAE;AACzB,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;AACjD,MAAM,MAAM,IAAI,UAAU,CAAC,gEAAgE,CAAC,CAAC;AAC7F,KAAK;AACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACpC,IAAI,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE;AACjC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;AACvC,KAAK;AACL,IAAIE,gCAAqB,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AACxD,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,OAAO,EA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0,0 +1,19 @@
|
|
|
1
|
+
import { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v10';
|
|
2
|
+
export declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends string | number> {
|
|
3
|
+
readonly choices?: APIApplicationCommandOptionChoice<T>[];
|
|
4
|
+
readonly autocomplete?: boolean;
|
|
5
|
+
readonly type: ApplicationCommandOptionType;
|
|
6
|
+
/**
|
|
7
|
+
* Adds multiple choices for this option
|
|
8
|
+
*
|
|
9
|
+
* @param choices - The choices to add
|
|
10
|
+
*/
|
|
11
|
+
addChoices(...choices: APIApplicationCommandOptionChoice<T>[]): this;
|
|
12
|
+
setChoices<Input extends APIApplicationCommandOptionChoice<T>[]>(...choices: Input): this;
|
|
13
|
+
/**
|
|
14
|
+
* Marks the option as autocompletable
|
|
15
|
+
* @param autocomplete - If this option should be autocompletable
|
|
16
|
+
*/
|
|
17
|
+
setAutocomplete(autocomplete: boolean): this;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts","sourceRoot":"","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAYxG,qBAAa,uDAAuD,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC7F,SAAgB,OAAO,CAAC,EAAE,iCAAiC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,SAAgB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvC,SAAgB,IAAI,EAAG,4BAA4B,CAAC;IAEpD;;;;OAIG;IACI,UAAU,CAAC,GAAG,OAAO,EAAE,iCAAiC,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI;IA2BpE,UAAU,CAAC,KAAK,SAAS,iCAAiC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,GAAG,IAAI;IAahG;;;OAGG;IACI,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI;CAYnD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import { ApplicationCommandOptionType } from 'discord-api-types/v10';
|
|
3
|
+
import { localizationMapPredicate, validateChoicesLength } from '../Assertions.mjs';
|
|
4
|
+
|
|
5
|
+
const stringPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
6
|
+
const numberPredicate = s.number.greaterThan(-Infinity).lessThan(Infinity);
|
|
7
|
+
const choicesPredicate = s.object({
|
|
8
|
+
name: stringPredicate,
|
|
9
|
+
name_localizations: localizationMapPredicate,
|
|
10
|
+
value: s.union(stringPredicate, numberPredicate)
|
|
11
|
+
}).array;
|
|
12
|
+
const booleanPredicate = s.boolean;
|
|
13
|
+
class ApplicationCommandOptionWithChoicesAndAutocompleteMixin {
|
|
14
|
+
addChoices(...choices) {
|
|
15
|
+
if (choices.length > 0 && this.autocomplete) {
|
|
16
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
17
|
+
}
|
|
18
|
+
choicesPredicate.parse(choices);
|
|
19
|
+
if (this.choices === void 0) {
|
|
20
|
+
Reflect.set(this, "choices", []);
|
|
21
|
+
}
|
|
22
|
+
validateChoicesLength(choices.length, this.choices);
|
|
23
|
+
for (const { name, name_localizations, value } of choices) {
|
|
24
|
+
if (this.type === ApplicationCommandOptionType.String) {
|
|
25
|
+
stringPredicate.parse(value);
|
|
26
|
+
} else {
|
|
27
|
+
numberPredicate.parse(value);
|
|
28
|
+
}
|
|
29
|
+
this.choices.push({ name, name_localizations, value });
|
|
30
|
+
}
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
setChoices(...choices) {
|
|
34
|
+
if (choices.length > 0 && this.autocomplete) {
|
|
35
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
36
|
+
}
|
|
37
|
+
choicesPredicate.parse(choices);
|
|
38
|
+
Reflect.set(this, "choices", []);
|
|
39
|
+
this.addChoices(...choices);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
setAutocomplete(autocomplete) {
|
|
43
|
+
booleanPredicate.parse(autocomplete);
|
|
44
|
+
if (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {
|
|
45
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
46
|
+
}
|
|
47
|
+
Reflect.set(this, "autocomplete", autocomplete);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { ApplicationCommandOptionWithChoicesAndAutocompleteMixin };
|
|
53
|
+
//# sourceMappingURL=ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v10';\nimport { localizationMapPredicate, validateChoicesLength } from '../Assertions';\n\nconst stringPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);\nconst numberPredicate = s.number.greaterThan(-Infinity).lessThan(Infinity);\nconst choicesPredicate = s.object({\n\tname: stringPredicate,\n\tname_localizations: localizationMapPredicate,\n\tvalue: s.union(stringPredicate, numberPredicate),\n}).array;\nconst booleanPredicate = s.boolean;\n\nexport class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends string | number> {\n\tpublic readonly choices?: APIApplicationCommandOptionChoice<T>[];\n\tpublic readonly autocomplete?: boolean;\n\n\t// Since this is present and this is a mixin, this is needed\n\tpublic readonly type!: ApplicationCommandOptionType;\n\n\t/**\n\t * Adds multiple choices for this option\n\t *\n\t * @param choices - The choices to add\n\t */\n\tpublic addChoices(...choices: APIApplicationCommandOptionChoice<T>[]): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tif (this.choices === undefined) {\n\t\t\tReflect.set(this, 'choices', []);\n\t\t}\n\n\t\tvalidateChoicesLength(choices.length, this.choices);\n\n\t\tfor (const { name, name_localizations, value } of choices) {\n\t\t\t// Validate the value\n\t\t\tif (this.type === ApplicationCommandOptionType.String) {\n\t\t\t\tstringPredicate.parse(value);\n\t\t\t} else {\n\t\t\t\tnumberPredicate.parse(value);\n\t\t\t}\n\n\t\t\tthis.choices!.push({ name, name_localizations, value });\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic setChoices<Input extends APIApplicationCommandOptionChoice<T>[]>(...choices: Input): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tReflect.set(this, 'choices', []);\n\t\tthis.addChoices(...choices);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Marks the option as autocompletable\n\t * @param autocomplete - If this option should be autocompletable\n\t */\n\tpublic setAutocomplete(autocomplete: boolean): this {\n\t\t// Assert that you actually passed a boolean\n\t\tbooleanPredicate.parse(autocomplete);\n\n\t\tif (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tReflect.set(this, 'autocomplete', autocomplete);\n\n\t\treturn this;\n\t}\n}\n"],"names":[],"mappings":";;;;AAGA,MAAM,eAAe,GAAG,CAAC,CAAC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AK,CAAC,KAAK,CAAC,CAAC;AACrC,OAAO;AACP,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7D,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,UAAU,CAAC,GAAG,OAAO,EAAE;AACzB,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;AACjD,MAAM,MAAM,IAAI,UAAU,CAAC,gEAAgE,CAAC,CAAC;AAC7F,KAAK;AACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACpC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;AACrC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC;AAChC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,eAAe,CAAC,YAAY,EAAE;AAChC,IAAI,gBAAgB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AACzC,IAAI,IAAI,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;AAChF,MAAM,MAAM,IAAI,UAAU,CAAC,gEAAgE,CAAC,CAAC;AAC7F,KAAK;AACL,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AACpD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const Assertions = require('../Assertions.cjs');
|
|
6
|
+
|
|
7
|
+
class SharedNameAndDescription {
|
|
8
|
+
setName(name) {
|
|
9
|
+
Assertions.validateName(name);
|
|
10
|
+
Reflect.set(this, "name", name);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
setDescription(description) {
|
|
14
|
+
Assertions.validateDescription(description);
|
|
15
|
+
Reflect.set(this, "description", description);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
setNameLocalization(locale, localizedName) {
|
|
19
|
+
if (!this.name_localizations) {
|
|
20
|
+
Reflect.set(this, "name_localizations", {});
|
|
21
|
+
}
|
|
22
|
+
const parsedLocale = Assertions.validateLocale(locale);
|
|
23
|
+
if (localizedName === null) {
|
|
24
|
+
this.name_localizations[parsedLocale] = null;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
Assertions.validateName(localizedName);
|
|
28
|
+
this.name_localizations[parsedLocale] = localizedName;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
setNameLocalizations(localizedNames) {
|
|
32
|
+
if (localizedNames === null) {
|
|
33
|
+
Reflect.set(this, "name_localizations", null);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
Reflect.set(this, "name_localizations", {});
|
|
37
|
+
Object.entries(localizedNames).forEach((args) => this.setNameLocalization(...args));
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
setDescriptionLocalization(locale, localizedDescription) {
|
|
41
|
+
if (!this.description_localizations) {
|
|
42
|
+
Reflect.set(this, "description_localizations", {});
|
|
43
|
+
}
|
|
44
|
+
const parsedLocale = Assertions.validateLocale(locale);
|
|
45
|
+
if (localizedDescription === null) {
|
|
46
|
+
this.description_localizations[parsedLocale] = null;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
Assertions.validateDescription(localizedDescription);
|
|
50
|
+
this.description_localizations[parsedLocale] = localizedDescription;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
setDescriptionLocalizations(localizedDescriptions) {
|
|
54
|
+
if (localizedDescriptions === null) {
|
|
55
|
+
Reflect.set(this, "description_localizations", null);
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
Reflect.set(this, "description_localizations", {});
|
|
59
|
+
Object.entries(localizedDescriptions).forEach((args) => this.setDescriptionLocalization(...args));
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.SharedNameAndDescription = SharedNameAndDescription;
|
|
65
|
+
//# sourceMappingURL=NameAndDescription.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NameAndDescription.cjs","sources":["../../../../src/interactions/slashCommands/mixins/NameAndDescription.ts"],"sourcesContent":["import type { LocaleString, LocalizationMap } from 'discord-api-types/v10';\nimport { validateDescription, validateLocale, validateName } from '../Assertions';\n\nexport class SharedNameAndDescription {\n\tpublic readonly name!: string;\n\tpublic readonly name_localizations?: LocalizationMap;\n\tpublic readonly description!: string;\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * Sets the name\n\t *\n\t * @param name - The name\n\t */\n\tpublic setName(name: string): this {\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 *\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\t/**\n\t * Sets a name localization\n\t *\n\t * @param locale - The locale to set a description for\n\t * @param localizedName - The localized description for the given locale\n\t */\n\tpublic setNameLocalization(locale: LocaleString, localizedName: string | null) {\n\t\tif (!this.name_localizations) {\n\t\t\tReflect.set(this, 'name_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedName === null) {\n\t\t\tthis.name_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateName(localizedName);\n\n\t\tthis.name_localizations![parsedLocale] = localizedName;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the name localizations\n\t *\n\t * @param localizedNames - The dictionary of localized descriptions to set\n\t */\n\tpublic setNameLocalizations(localizedNames: LocalizationMap | null) {\n\t\tif (localizedNames === null) {\n\t\t\tReflect.set(this, 'name_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'name_localizations', {});\n\n\t\tObject.entries(localizedNames).forEach((args) =>\n\t\t\tthis.setNameLocalization(...(args as [LocaleString, string | null])),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a description localization\n\t *\n\t * @param locale - The locale to set a description for\n\t * @param localizedDescription - The localized description for the given locale\n\t */\n\tpublic setDescriptionLocalization(locale: LocaleString, localizedDescription: string | null) {\n\t\tif (!this.description_localizations) {\n\t\t\tReflect.set(this, 'description_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedDescription === null) {\n\t\t\tthis.description_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateDescription(localizedDescription);\n\n\t\tthis.description_localizations![parsedLocale] = localizedDescription;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description localizations\n\t *\n\t * @param localizedDescriptions - The dictionary of localized descriptions to set\n\t */\n\tpublic setDescriptionLocalizations(localizedDescriptions: LocalizationMap | null) {\n\t\tif (localizedDescriptions === null) {\n\t\t\tReflect.set(this, 'description_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'description_localizations', {});\n\t\tObject.entries(localizedDescriptions).forEach((args) =>\n\t\t\tthis.setDescriptionLocalization(...(args as [LocaleString, string | null])),\n\t\t);\n\t\treturn this;\n\t}\n}\n"],"names":["validateName","validateDescription","validateLocale"],"mappings":";;;;;;AACO,MAAM,wBAAwB,CAAC;AACtC,EAAE,OAAO,CAAC,IAAI,EAAE;AAChB,IAAIA,uBAAY,CAAC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+
import type { LocaleString, LocalizationMap } from 'discord-api-types/v10';
|
|
2
|
+
export declare class SharedNameAndDescription {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly name_localizations?: LocalizationMap;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly description_localizations?: LocalizationMap;
|
|
7
|
+
/**
|
|
8
|
+
* Sets the name
|
|
9
|
+
*
|
|
10
|
+
* @param name - The name
|
|
11
|
+
*/
|
|
12
|
+
setName(name: string): this;
|
|
13
|
+
/**
|
|
14
|
+
* Sets the description
|
|
15
|
+
*
|
|
16
|
+
* @param description - The description
|
|
17
|
+
*/
|
|
18
|
+
setDescription(description: string): this;
|
|
19
|
+
/**
|
|
20
|
+
* Sets a name localization
|
|
21
|
+
*
|
|
22
|
+
* @param locale - The locale to set a description for
|
|
23
|
+
* @param localizedName - The localized description for the given locale
|
|
24
|
+
*/
|
|
25
|
+
setNameLocalization(locale: LocaleString, localizedName: string | null): this;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the name localizations
|
|
28
|
+
*
|
|
29
|
+
* @param localizedNames - The dictionary of localized descriptions to set
|
|
30
|
+
*/
|
|
31
|
+
setNameLocalizations(localizedNames: LocalizationMap | null): this;
|
|
32
|
+
/**
|
|
33
|
+
* Sets a description localization
|
|
34
|
+
*
|
|
35
|
+
* @param locale - The locale to set a description for
|
|
36
|
+
* @param localizedDescription - The localized description for the given locale
|
|
37
|
+
*/
|
|
38
|
+
setDescriptionLocalization(locale: LocaleString, localizedDescription: string | null): this;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the description localizations
|
|
41
|
+
*
|
|
42
|
+
* @param localizedDescriptions - The dictionary of localized descriptions to set
|
|
43
|
+
*/
|
|
44
|
+
setDescriptionLocalizations(localizedDescriptions: LocalizationMap | null): this;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=NameAndDescription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NameAndDescription.d.ts","sourceRoot":"","sources":["../../../../src/interactions/slashCommands/mixins/NameAndDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG3E,qBAAa,wBAAwB;IACpC,SAAgB,IAAI,EAAG,MAAM,CAAC;IAC9B,SAAgB,kBAAkB,CAAC,EAAE,eAAe,CAAC;IACrD,SAAgB,WAAW,EAAG,MAAM,CAAC;IACrC,SAAgB,yBAAyB,CAAC,EAAE,eAAe,CAAC;IAE5D;;;;OAIG;IACI,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IASlC;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;IASzC;;;;;OAKG;IACI,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IAkB7E;;;;OAIG;IACI,oBAAoB,CAAC,cAAc,EAAE,eAAe,GAAG,IAAI;IAclE;;;;;OAKG;IACI,0BAA0B,CAAC,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,GAAG,IAAI;IAkB3F;;;;OAIG;IACI,2BAA2B,CAAC,qBAAqB,EAAE,eAAe,GAAG,IAAI;CAYhF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { validateName, validateDescription, validateLocale } from '../Assertions.mjs';
|
|
2
|
+
|
|
3
|
+
class SharedNameAndDescription {
|
|
4
|
+
setName(name) {
|
|
5
|
+
validateName(name);
|
|
6
|
+
Reflect.set(this, "name", name);
|
|
7
|
+
return this;
|
|
8
|
+
}
|
|
9
|
+
setDescription(description) {
|
|
10
|
+
validateDescription(description);
|
|
11
|
+
Reflect.set(this, "description", description);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
setNameLocalization(locale, localizedName) {
|
|
15
|
+
if (!this.name_localizations) {
|
|
16
|
+
Reflect.set(this, "name_localizations", {});
|
|
17
|
+
}
|
|
18
|
+
const parsedLocale = validateLocale(locale);
|
|
19
|
+
if (localizedName === null) {
|
|
20
|
+
this.name_localizations[parsedLocale] = null;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
validateName(localizedName);
|
|
24
|
+
this.name_localizations[parsedLocale] = localizedName;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
setNameLocalizations(localizedNames) {
|
|
28
|
+
if (localizedNames === null) {
|
|
29
|
+
Reflect.set(this, "name_localizations", null);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
Reflect.set(this, "name_localizations", {});
|
|
33
|
+
Object.entries(localizedNames).forEach((args) => this.setNameLocalization(...args));
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
setDescriptionLocalization(locale, localizedDescription) {
|
|
37
|
+
if (!this.description_localizations) {
|
|
38
|
+
Reflect.set(this, "description_localizations", {});
|
|
39
|
+
}
|
|
40
|
+
const parsedLocale = validateLocale(locale);
|
|
41
|
+
if (localizedDescription === null) {
|
|
42
|
+
this.description_localizations[parsedLocale] = null;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
validateDescription(localizedDescription);
|
|
46
|
+
this.description_localizations[parsedLocale] = localizedDescription;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
setDescriptionLocalizations(localizedDescriptions) {
|
|
50
|
+
if (localizedDescriptions === null) {
|
|
51
|
+
Reflect.set(this, "description_localizations", null);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
Reflect.set(this, "description_localizations", {});
|
|
55
|
+
Object.entries(localizedDescriptions).forEach((args) => this.setDescriptionLocalization(...args));
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { SharedNameAndDescription };
|
|
61
|
+
//# sourceMappingURL=NameAndDescription.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NameAndDescription.mjs","sources":["../../../../src/interactions/slashCommands/mixins/NameAndDescription.ts"],"sourcesContent":["import type { LocaleString, LocalizationMap } from 'discord-api-types/v10';\nimport { validateDescription, validateLocale, validateName } from '../Assertions';\n\nexport class SharedNameAndDescription {\n\tpublic readonly name!: string;\n\tpublic readonly name_localizations?: LocalizationMap;\n\tpublic readonly description!: string;\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * Sets the name\n\t *\n\t * @param name - The name\n\t */\n\tpublic setName(name: string): this {\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 *\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\t/**\n\t * Sets a name localization\n\t *\n\t * @param locale - The locale to set a description for\n\t * @param localizedName - The localized description for the given locale\n\t */\n\tpublic setNameLocalization(locale: LocaleString, localizedName: string | null) {\n\t\tif (!this.name_localizations) {\n\t\t\tReflect.set(this, 'name_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedName === null) {\n\t\t\tthis.name_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateName(localizedName);\n\n\t\tthis.name_localizations![parsedLocale] = localizedName;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the name localizations\n\t *\n\t * @param localizedNames - The dictionary of localized descriptions to set\n\t */\n\tpublic setNameLocalizations(localizedNames: LocalizationMap | null) {\n\t\tif (localizedNames === null) {\n\t\t\tReflect.set(this, 'name_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'name_localizations', {});\n\n\t\tObject.entries(localizedNames).forEach((args) =>\n\t\t\tthis.setNameLocalization(...(args as [LocaleString, string | null])),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a description localization\n\t *\n\t * @param locale - The locale to set a description for\n\t * @param localizedDescription - The localized description for the given locale\n\t */\n\tpublic setDescriptionLocalization(locale: LocaleString, localizedDescription: string | null) {\n\t\tif (!this.description_localizations) {\n\t\t\tReflect.set(this, 'description_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedDescription === null) {\n\t\t\tthis.description_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateDescription(localizedDescription);\n\n\t\tthis.description_localizations![parsedLocale] = localizedDescription;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description localizations\n\t *\n\t * @param localizedDescriptions - The dictionary of localized descriptions to set\n\t */\n\tpublic setDescriptionLocalizations(localizedDescriptions: LocalizationMap | null) {\n\t\tif (localizedDescriptions === null) {\n\t\t\tReflect.set(this, 'description_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'description_localizations', {});\n\t\tObject.entries(localizedDescriptions).forEach((args) =>\n\t\t\tthis.setDescriptionLocalization(...(args as [LocaleString, string | null])),\n\t\t);\n\t\treturn this;\n\t}\n}\n"],"names":[],"mappings":";;AACO,MAAM,wBAAwB,CAAC;AACtC,EAAE,OAAO,CAAC,IAAI,EAAE;AAChB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;AACvB,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACpC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE;AAC7C,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAk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vC,MAAM,IAAI,CAAC,yBAAyB,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;AAC1D,MAAM,OAAO,IAAI,CAAC;AAClB,KAAK;AACL,IAAI,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;AAC9C,IAAI,IAAI,CAAC,yBAAyB,CAAC,YAAY,CAAC,GAAG,oBAAoB,CAAC;AACxE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,2BAA2B,CAAC,qBAAqB,EAAE;AACrD,IAAI,IAAI,qBAAqB,KAAK,IAAI,EAAE;AACxC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,2BAA2B,EAAE,IAAI,CAAC,CAAC;AAC3D,MAAM,OAAO,IAAI,CAAC;AAClB,KAAK;AACL,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,2BAA2B,EAAE,EAAE,CAAC,CAAC;AACvD,IAAI,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,0BAA0B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACtG,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const Assertions = require('../Assertions.cjs');
|
|
6
|
+
const attachment = require('../options/attachment.cjs');
|
|
7
|
+
const boolean = require('../options/boolean.cjs');
|
|
8
|
+
const channel = require('../options/channel.cjs');
|
|
9
|
+
const integer = require('../options/integer.cjs');
|
|
10
|
+
const mentionable = require('../options/mentionable.cjs');
|
|
11
|
+
const number = require('../options/number.cjs');
|
|
12
|
+
const role = require('../options/role.cjs');
|
|
13
|
+
const string = require('../options/string.cjs');
|
|
14
|
+
const user = require('../options/user.cjs');
|
|
15
|
+
|
|
16
|
+
class SharedSlashCommandOptions {
|
|
17
|
+
addBooleanOption(input) {
|
|
18
|
+
return this._sharedAddOptionMethod(input, boolean.SlashCommandBooleanOption);
|
|
19
|
+
}
|
|
20
|
+
addUserOption(input) {
|
|
21
|
+
return this._sharedAddOptionMethod(input, user.SlashCommandUserOption);
|
|
22
|
+
}
|
|
23
|
+
addChannelOption(input) {
|
|
24
|
+
return this._sharedAddOptionMethod(input, channel.SlashCommandChannelOption);
|
|
25
|
+
}
|
|
26
|
+
addRoleOption(input) {
|
|
27
|
+
return this._sharedAddOptionMethod(input, role.SlashCommandRoleOption);
|
|
28
|
+
}
|
|
29
|
+
addAttachmentOption(input) {
|
|
30
|
+
return this._sharedAddOptionMethod(input, attachment.SlashCommandAttachmentOption);
|
|
31
|
+
}
|
|
32
|
+
addMentionableOption(input) {
|
|
33
|
+
return this._sharedAddOptionMethod(input, mentionable.SlashCommandMentionableOption);
|
|
34
|
+
}
|
|
35
|
+
addStringOption(input) {
|
|
36
|
+
return this._sharedAddOptionMethod(input, string.SlashCommandStringOption);
|
|
37
|
+
}
|
|
38
|
+
addIntegerOption(input) {
|
|
39
|
+
return this._sharedAddOptionMethod(input, integer.SlashCommandIntegerOption);
|
|
40
|
+
}
|
|
41
|
+
addNumberOption(input) {
|
|
42
|
+
return this._sharedAddOptionMethod(input, number.SlashCommandNumberOption);
|
|
43
|
+
}
|
|
44
|
+
_sharedAddOptionMethod(input, Instance) {
|
|
45
|
+
const { options } = this;
|
|
46
|
+
Assertions.validateMaxOptionsLength(options);
|
|
47
|
+
const result = typeof input === "function" ? input(new Instance()) : input;
|
|
48
|
+
Assertions.assertReturnOfBuilder(result, Instance);
|
|
49
|
+
options.push(result);
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
exports.SharedSlashCommandOptions = SharedSlashCommandOptions;
|
|
55
|
+
//# sourceMappingURL=SharedSlashCommandOptions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedSlashCommandOptions.cjs","sources":["../../../../src/interactions/slashCommands/mixins/SharedSlashCommandOptions.ts"],"sourcesContent":["import type { ApplicationCommandOptionBase } from './ApplicationCommandOptionBase';\nimport { assertReturnOfBuilder, validateMaxOptionsLength } from '../Assertions';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SlashCommandAttachmentOption } from '../options/attachment';\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';\n\nexport class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {\n\tpublic readonly options!: ToAPIApplicationCommandOptions[];\n\n\t/**\n\t * Adds a boolean option\n\t *\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 *\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 *\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 *\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 an attachment option\n\t *\n\t * @param input - A function that returns an option builder, or an already built builder\n\t */\n\tpublic addAttachmentOption(\n\t\tinput: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandAttachmentOption);\n\t}\n\n\t/**\n\t * Adds a mentionable option\n\t *\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 *\n\t * @param input - A function that returns an option builder, or an already built builder\n\t */\n\tpublic addStringOption(\n\t\tinput:\n\t\t\t| SlashCommandStringOption\n\t\t\t| Omit<SlashCommandStringOption, 'setAutocomplete'>\n\t\t\t| Omit<SlashCommandStringOption, 'addChoices'>\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandStringOption,\n\t\t\t ) =>\n\t\t\t\t\t| SlashCommandStringOption\n\t\t\t\t\t| Omit<SlashCommandStringOption, 'setAutocomplete'>\n\t\t\t\t\t| Omit<SlashCommandStringOption, 'addChoices'>),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandStringOption);\n\t}\n\n\t/**\n\t * Adds an integer option\n\t *\n\t * @param input - A function that returns an option builder, or an already built builder\n\t */\n\tpublic addIntegerOption(\n\t\tinput:\n\t\t\t| SlashCommandIntegerOption\n\t\t\t| Omit<SlashCommandIntegerOption, 'setAutocomplete'>\n\t\t\t| Omit<SlashCommandIntegerOption, 'addChoices'>\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandIntegerOption,\n\t\t\t ) =>\n\t\t\t\t\t| SlashCommandIntegerOption\n\t\t\t\t\t| Omit<SlashCommandIntegerOption, 'setAutocomplete'>\n\t\t\t\t\t| Omit<SlashCommandIntegerOption, 'addChoices'>),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandIntegerOption);\n\t}\n\n\t/**\n\t * Adds a number option\n\t *\n\t * @param input - A function that returns an option builder, or an already built builder\n\t */\n\tpublic addNumberOption(\n\t\tinput:\n\t\t\t| SlashCommandNumberOption\n\t\t\t| Omit<SlashCommandNumberOption, 'setAutocomplete'>\n\t\t\t| Omit<SlashCommandNumberOption, 'addChoices'>\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandNumberOption,\n\t\t\t ) =>\n\t\t\t\t\t| SlashCommandNumberOption\n\t\t\t\t\t| Omit<SlashCommandNumberOption, 'setAutocomplete'>\n\t\t\t\t\t| Omit<SlashCommandNumberOption, 'addChoices'>),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandNumberOption);\n\t}\n\n\tprivate _sharedAddOptionMethod<T extends ApplicationCommandOptionBase>(\n\t\tinput:\n\t\t\t| T\n\t\t\t| Omit<T, 'setAutocomplete'>\n\t\t\t| Omit<T, 'addChoices'>\n\t\t\t| ((builder: T) => T | Omit<T, 'setAutocomplete'> | Omit<T, 'addChoices'>),\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"],"names":["SlashCommandBooleanOption","SlashCommandUserOption","SlashCommandChannelOption","SlashCommandRoleOption","SlashCommandAttachmentOption","SlashCommandMentionableOption","Slash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EC,+BAAwB,CAAC,CAAC;AACxE,GAAG;AACH,EAAE,sBAAsB,CAAC,KAAK,EAAE,QAAQ,EAAE;AAC1C,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AAC7B,IAAIC,mCAAwB,CAAC,OAAO,CAAC,CAAC;AACtC,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC;AAC/E,IAAIC,gCAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC5C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
|
2
|
+
import { SlashCommandAttachmentOption } from '../options/attachment';
|
|
3
|
+
import { SlashCommandBooleanOption } from '../options/boolean';
|
|
4
|
+
import { SlashCommandChannelOption } from '../options/channel';
|
|
5
|
+
import { SlashCommandIntegerOption } from '../options/integer';
|
|
6
|
+
import { SlashCommandMentionableOption } from '../options/mentionable';
|
|
7
|
+
import { SlashCommandNumberOption } from '../options/number';
|
|
8
|
+
import { SlashCommandRoleOption } from '../options/role';
|
|
9
|
+
import { SlashCommandStringOption } from '../options/string';
|
|
10
|
+
import { SlashCommandUserOption } from '../options/user';
|
|
11
|
+
export declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
|
|
12
|
+
readonly options: ToAPIApplicationCommandOptions[];
|
|
13
|
+
/**
|
|
14
|
+
* Adds a boolean option
|
|
15
|
+
*
|
|
16
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
17
|
+
*/
|
|
18
|
+
addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
19
|
+
/**
|
|
20
|
+
* Adds a user option
|
|
21
|
+
*
|
|
22
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
23
|
+
*/
|
|
24
|
+
addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
25
|
+
/**
|
|
26
|
+
* Adds a channel option
|
|
27
|
+
*
|
|
28
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
29
|
+
*/
|
|
30
|
+
addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
31
|
+
/**
|
|
32
|
+
* Adds a role option
|
|
33
|
+
*
|
|
34
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
35
|
+
*/
|
|
36
|
+
addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
37
|
+
/**
|
|
38
|
+
* Adds an attachment option
|
|
39
|
+
*
|
|
40
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
41
|
+
*/
|
|
42
|
+
addAttachmentOption(input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
43
|
+
/**
|
|
44
|
+
* Adds a mentionable option
|
|
45
|
+
*
|
|
46
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
47
|
+
*/
|
|
48
|
+
addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
49
|
+
/**
|
|
50
|
+
* Adds a string option
|
|
51
|
+
*
|
|
52
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
53
|
+
*/
|
|
54
|
+
addStringOption(input: SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'> | ((builder: SlashCommandStringOption) => SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'>)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
55
|
+
/**
|
|
56
|
+
* Adds an integer option
|
|
57
|
+
*
|
|
58
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
59
|
+
*/
|
|
60
|
+
addIntegerOption(input: SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'> | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'>)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
61
|
+
/**
|
|
62
|
+
* Adds a number option
|
|
63
|
+
*
|
|
64
|
+
* @param input - A function that returns an option builder, or an already built builder
|
|
65
|
+
*/
|
|
66
|
+
addNumberOption(input: SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'> | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'>)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
67
|
+
private _sharedAddOptionMethod;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=SharedSlashCommandOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedSlashCommandOptions.d.ts","sourceRoot":"","sources":["../../../../src/interactions/slashCommands/mixins/SharedSlashCommandOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,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;AAEzD,qBAAa,yBAAyB,CAAC,6BAA6B,GAAG,IAAI;IAC1E,SAAgB,OAAO,EAAG,8BAA8B,EAAE,CAAC;IAE3D;;;;OAIG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IAIlH;;;;OAIG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sB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turnOfBuilder } from '../Assertions.mjs';
|
|
2
|
+
import { SlashCommandAttachmentOption } from '../options/attachment.mjs';
|
|
3
|
+
import { SlashCommandBooleanOption } from '../options/boolean.mjs';
|
|
4
|
+
import { SlashCommandChannelOption } from '../options/channel.mjs';
|
|
5
|
+
import { SlashCommandIntegerOption } from '../options/integer.mjs';
|
|
6
|
+
import { SlashCommandMentionableOption } from '../options/mentionable.mjs';
|
|
7
|
+
import { SlashCommandNumberOption } from '../options/number.mjs';
|
|
8
|
+
import { SlashCommandRoleOption } from '../options/role.mjs';
|
|
9
|
+
import { SlashCommandStringOption } from '../options/string.mjs';
|
|
10
|
+
import { SlashCommandUserOption } from '../options/user.mjs';
|
|
11
|
+
|
|
12
|
+
class SharedSlashCommandOptions {
|
|
13
|
+
addBooleanOption(input) {
|
|
14
|
+
return this._sharedAddOptionMethod(input, SlashCommandBooleanOption);
|
|
15
|
+
}
|
|
16
|
+
addUserOption(input) {
|
|
17
|
+
return this._sharedAddOptionMethod(input, SlashCommandUserOption);
|
|
18
|
+
}
|
|
19
|
+
addChannelOption(input) {
|
|
20
|
+
return this._sharedAddOptionMethod(input, SlashCommandChannelOption);
|
|
21
|
+
}
|
|
22
|
+
addRoleOption(input) {
|
|
23
|
+
return this._sharedAddOptionMethod(input, SlashCommandRoleOption);
|
|
24
|
+
}
|
|
25
|
+
addAttachmentOption(input) {
|
|
26
|
+
return this._sharedAddOptionMethod(input, SlashCommandAttachmentOption);
|
|
27
|
+
}
|
|
28
|
+
addMentionableOption(input) {
|
|
29
|
+
return this._sharedAddOptionMethod(input, SlashCommandMentionableOption);
|
|
30
|
+
}
|
|
31
|
+
addStringOption(input) {
|
|
32
|
+
return this._sharedAddOptionMethod(input, SlashCommandStringOption);
|
|
33
|
+
}
|
|
34
|
+
addIntegerOption(input) {
|
|
35
|
+
return this._sharedAddOptionMethod(input, SlashCommandIntegerOption);
|
|
36
|
+
}
|
|
37
|
+
addNumberOption(input) {
|
|
38
|
+
return this._sharedAddOptionMethod(input, SlashCommandNumberOption);
|
|
39
|
+
}
|
|
40
|
+
_sharedAddOptionMethod(input, Instance) {
|
|
41
|
+
const { options } = this;
|
|
42
|
+
validateMaxOptionsLength(options);
|
|
43
|
+
const result = typeof input === "function" ? input(new Instance()) : input;
|
|
44
|
+
assertReturnOfBuilder(result, Instance);
|
|
45
|
+
options.push(result);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { SharedSlashCommandOptions };
|
|
51
|
+
//# sourceMappingURL=SharedSlashCommandOptions.mjs.map
|