@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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { APIApplicationCommandOption, LocalizationMap, Permissions, RESTPostAPIApplicationCommandsJSONBody } from 'discord-api-types/v10';
|
|
2
|
+
import { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
|
|
3
|
+
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
|
4
|
+
import { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';
|
|
5
|
+
export declare class SlashCommandBuilder {
|
|
6
|
+
/**
|
|
7
|
+
* The name of this slash command
|
|
8
|
+
*/
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/**
|
|
11
|
+
* The localized names for this command
|
|
12
|
+
*/
|
|
13
|
+
readonly name_localizations?: LocalizationMap;
|
|
14
|
+
/**
|
|
15
|
+
* The description of this slash command
|
|
16
|
+
*/
|
|
17
|
+
readonly description: string;
|
|
18
|
+
/**
|
|
19
|
+
* The localized descriptions for this command
|
|
20
|
+
*/
|
|
21
|
+
readonly description_localizations?: LocalizationMap;
|
|
22
|
+
/**
|
|
23
|
+
* The options of this slash command
|
|
24
|
+
*/
|
|
25
|
+
readonly options: ToAPIApplicationCommandOptions[];
|
|
26
|
+
/**
|
|
27
|
+
* Whether the command is enabled by default when the app is added to a guild
|
|
28
|
+
*
|
|
29
|
+
* @deprecated This property is deprecated and will be removed in the future.
|
|
30
|
+
* You should use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
31
|
+
*/
|
|
32
|
+
readonly default_permission: boolean | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Set of permissions represented as a bit set for the command
|
|
35
|
+
*/
|
|
36
|
+
readonly default_member_permissions: Permissions | null | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Indicates whether the command is available in DMs with the application, only for globally-scoped commands.
|
|
39
|
+
* By default, commands are visible.
|
|
40
|
+
*/
|
|
41
|
+
readonly dm_permission: boolean | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the final data that should be sent to Discord.
|
|
44
|
+
*
|
|
45
|
+
* **Note:** Calling this function will validate required properties based on their conditions.
|
|
46
|
+
*/
|
|
47
|
+
toJSON(): RESTPostAPIApplicationCommandsJSONBody;
|
|
48
|
+
/**
|
|
49
|
+
* Sets whether the command is enabled by default when the application is added to a guild.
|
|
50
|
+
*
|
|
51
|
+
* **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.
|
|
52
|
+
*
|
|
53
|
+
* @param value - Whether or not to enable this command by default
|
|
54
|
+
*
|
|
55
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
56
|
+
* @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
57
|
+
*/
|
|
58
|
+
setDefaultPermission(value: boolean): this;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the default permissions a member should have in order to run the command.
|
|
61
|
+
*
|
|
62
|
+
* **Note:** You can set this to `'0'` to disable the command by default.
|
|
63
|
+
*
|
|
64
|
+
* @param permissions - The permissions bit field to set
|
|
65
|
+
*
|
|
66
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
67
|
+
*/
|
|
68
|
+
setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined): this;
|
|
69
|
+
/**
|
|
70
|
+
* Sets if the command is available in DMs with the application, only for globally-scoped commands.
|
|
71
|
+
* By default, commands are visible.
|
|
72
|
+
*
|
|
73
|
+
* @param enabled - If the command should be enabled in DMs
|
|
74
|
+
*
|
|
75
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
76
|
+
*/
|
|
77
|
+
setDMPermission(enabled: boolean | null | undefined): this;
|
|
78
|
+
/**
|
|
79
|
+
* Adds a new subcommand group to this command
|
|
80
|
+
*
|
|
81
|
+
* @param input - A function that returns a subcommand group builder, or an already built builder
|
|
82
|
+
*/
|
|
83
|
+
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
84
|
+
/**
|
|
85
|
+
* Adds a new subcommand to this command
|
|
86
|
+
*
|
|
87
|
+
* @param input - A function that returns a subcommand builder, or an already built builder
|
|
88
|
+
*/
|
|
89
|
+
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
90
|
+
}
|
|
91
|
+
export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {
|
|
92
|
+
}
|
|
93
|
+
export interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {
|
|
94
|
+
}
|
|
95
|
+
export interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
|
|
96
|
+
}
|
|
97
|
+
export interface ToAPIApplicationCommandOptions {
|
|
98
|
+
toJSON: () => APIApplicationCommandOption;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=SlashCommandBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlashCommandBuilder.d.ts","sourceRoot":"","sources":["../../../src/interactions/slashCommands/SlashCommandBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,2BAA2B,EAC3B,eAAe,EACf,WAAW,EACX,sCAAsC,EACtC,MAAM,uBAAuB,CAAC;AAW/B,OAAO,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAC9G,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,qBACa,mBAAmB;IAC/B;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,kBAAkB,CAAC,EAAE,eAAe,CAAC;IAErD;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,yBAAyB,CAAC,EAAE,eAAe,CAAC;IAE5D;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;;;OAKG;IACH,SAAgB,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAa;IAEpE;;OAEG;IACH,SAAgB,0BAA0B,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAa;IAEvF;;;OAGG;IACH,SAAgB,aAAa,EAAE,OAAO,GAAG,SAAS,CAAa;IAE/D;;;;OAIG;IACI,MAAM,IAAI,sCAAsC;IAYvD;;;;;;;;;OASG;IACI,oBAAoB,CAAC,KAAK,EAAE,OAAO;IAS1C;;;;;;;;OAQG;IACI,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IAShG;;;;;;;OAOG;IACI,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS;IAS1D;;;;OAIG;IACI,kBAAkB,CACxB,KAAK,EACF,kCAAkC,GAClC,CAAC,CAAC,eAAe,EAAE,kCAAkC,KAAK,kCAAkC,CAAC,GAC9F,kCAAkC;IAiBrC;;;;OAIG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC,GACpF,kCAAkC;CAgBrC;AAED,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB,EAAE,yBAAyB;CAAG;AAEnG,MAAM,WAAW,kCAChB,SAAQ,wBAAwB,EAC/B,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,eAAe,GAAG,oBAAoB,CAAC;CAAG;AAEjF,MAAM,WAAW,8BAChB,SAAQ,wBAAwB,EAC/B,yBAAyB,EACzB,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC;CAAG;AAExC,MAAM,WAAW,8BAA8B;IAC9C,MAAM,EAAE,MAAM,2BAA2B,CAAC;CAC1C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { mix } from 'ts-mixer';
|
|
2
|
+
import { validateRequiredParameters, validateLocalizationMap, validateDefaultPermission, validateDefaultMemberPermissions, validateDMPermission, validateMaxOptionsLength, assertReturnOfBuilder } from './Assertions.mjs';
|
|
3
|
+
import { SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandBuilder } from './SlashCommandSubcommands.mjs';
|
|
4
|
+
import { SharedNameAndDescription } from './mixins/NameAndDescription.mjs';
|
|
5
|
+
import { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions.mjs';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result)
|
|
15
|
+
__defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
let SlashCommandBuilder = class {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.name = void 0;
|
|
21
|
+
this.description = void 0;
|
|
22
|
+
this.options = [];
|
|
23
|
+
this.default_permission = void 0;
|
|
24
|
+
this.default_member_permissions = void 0;
|
|
25
|
+
this.dm_permission = void 0;
|
|
26
|
+
}
|
|
27
|
+
toJSON() {
|
|
28
|
+
validateRequiredParameters(this.name, this.description, this.options);
|
|
29
|
+
validateLocalizationMap(this.name_localizations);
|
|
30
|
+
validateLocalizationMap(this.description_localizations);
|
|
31
|
+
return {
|
|
32
|
+
...this,
|
|
33
|
+
options: this.options.map((option) => option.toJSON())
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
setDefaultPermission(value) {
|
|
37
|
+
validateDefaultPermission(value);
|
|
38
|
+
Reflect.set(this, "default_permission", value);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
setDefaultMemberPermissions(permissions) {
|
|
42
|
+
const permissionValue = validateDefaultMemberPermissions(permissions);
|
|
43
|
+
Reflect.set(this, "default_member_permissions", permissionValue);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
setDMPermission(enabled) {
|
|
47
|
+
validateDMPermission(enabled);
|
|
48
|
+
Reflect.set(this, "dm_permission", enabled);
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
addSubcommandGroup(input) {
|
|
52
|
+
const { options } = this;
|
|
53
|
+
validateMaxOptionsLength(options);
|
|
54
|
+
const result = typeof input === "function" ? input(new SlashCommandSubcommandGroupBuilder()) : input;
|
|
55
|
+
assertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);
|
|
56
|
+
options.push(result);
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
addSubcommand(input) {
|
|
60
|
+
const { options } = this;
|
|
61
|
+
validateMaxOptionsLength(options);
|
|
62
|
+
const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input;
|
|
63
|
+
assertReturnOfBuilder(result, SlashCommandSubcommandBuilder);
|
|
64
|
+
options.push(result);
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
SlashCommandBuilder = __decorateClass([
|
|
69
|
+
mix(SharedSlashCommandOptions, SharedNameAndDescription)
|
|
70
|
+
], SlashCommandBuilder);
|
|
71
|
+
|
|
72
|
+
export { SlashCommandBuilder };
|
|
73
|
+
//# sourceMappingURL=SlashCommandBuilder.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlashCommandBuilder.mjs","sources":["../../../src/interactions/slashCommands/SlashCommandBuilder.ts"],"sourcesContent":["import type {\n\tAPIApplicationCommandOption,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDefaultPermission,\n\tvalidateLocalizationMap,\n\tvalidateDMPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n} from './Assertions';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';\n\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this slash command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The localized names for this command\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this slash command\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The localized descriptions for this command\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * The options of this slash command\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether the command is enabled by default when the app is added to a guild\n\t *\n\t * @deprecated This property is deprecated and will be removed in the future.\n\t * You should use `setDefaultMemberPermissions` or `setDMPermission` instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Set of permissions represented as a bit set for the command\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Returns the final data that should be sent to Discord.\n\t *\n\t * **Note:** Calling this function will validate required properties based on their conditions.\n\t */\n\tpublic toJSON(): RESTPostAPIApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\treturn {\n\t\t\t...this,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.\n\t *\n\t * @param value - Whether or not to enable this command by default\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t * @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run the command.\n\t *\n\t * **Note:** You can set this to `'0'` to disable the command by default.\n\t *\n\t * @param permissions - The permissions bit field to set\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t *\n\t * @param enabled - If the command should be enabled in DMs\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command\n\t *\n\t * @param input - A function that returns a subcommand group builder, or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command\n\t *\n\t * @param input - A function that returns a subcommand builder, or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n\nexport interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n\nexport interface SlashCommandSubcommandsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tPick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {}\n\nexport interface SlashCommandOptionsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tSharedSlashCommandOptions,\n\t\tPick<SlashCommandBuilder, 'toJSON'> {}\n\nexport interface ToAPIApplicationCommandOptions {\n\ttoJSON: () => APIApplicationCommandOption;\n}\n"],"names":[],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AACvD,IAAI,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,KAAK;AACzD,EAAE,IAAI,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;AACjF,EAAE,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;AAC5D,IAAI,IAAI,SAAS,GAA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AE,6BAA6B,CAAC,CAAC;AACjE,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE;AACF,mBAAmB,GAAG,eAAe,CAAC;AACtC,EAAE,GAAG,CAAC,yBAAyB,EAAE,wBAAwB,CAAC;AAC1D,CAAC,EAAE,mBAAmB,CAAC;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const v10 = require('discord-api-types/v10');
|
|
6
|
+
const tsMixer = require('ts-mixer');
|
|
7
|
+
const Assertions = require('./Assertions.cjs');
|
|
8
|
+
const NameAndDescription = require('./mixins/NameAndDescription.cjs');
|
|
9
|
+
const SharedSlashCommandOptions = require('./mixins/SharedSlashCommandOptions.cjs');
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
15
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
+
if (decorator = decorators[i])
|
|
17
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
18
|
+
if (kind && result)
|
|
19
|
+
__defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
exports.SlashCommandSubcommandGroupBuilder = class {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.name = void 0;
|
|
25
|
+
this.description = void 0;
|
|
26
|
+
this.options = [];
|
|
27
|
+
}
|
|
28
|
+
addSubcommand(input) {
|
|
29
|
+
const { options } = this;
|
|
30
|
+
Assertions.validateMaxOptionsLength(options);
|
|
31
|
+
const result = typeof input === "function" ? input(new exports.SlashCommandSubcommandBuilder()) : input;
|
|
32
|
+
Assertions.assertReturnOfBuilder(result, exports.SlashCommandSubcommandBuilder);
|
|
33
|
+
options.push(result);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
toJSON() {
|
|
37
|
+
Assertions.validateRequiredParameters(this.name, this.description, this.options);
|
|
38
|
+
return {
|
|
39
|
+
type: v10.ApplicationCommandOptionType.SubcommandGroup,
|
|
40
|
+
name: this.name,
|
|
41
|
+
name_localizations: this.name_localizations,
|
|
42
|
+
description: this.description,
|
|
43
|
+
description_localizations: this.description_localizations,
|
|
44
|
+
options: this.options.map((option) => option.toJSON())
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.SlashCommandSubcommandGroupBuilder = __decorateClass([
|
|
49
|
+
tsMixer.mix(NameAndDescription.SharedNameAndDescription)
|
|
50
|
+
], exports.SlashCommandSubcommandGroupBuilder);
|
|
51
|
+
exports.SlashCommandSubcommandBuilder = class {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.name = void 0;
|
|
54
|
+
this.description = void 0;
|
|
55
|
+
this.options = [];
|
|
56
|
+
}
|
|
57
|
+
toJSON() {
|
|
58
|
+
Assertions.validateRequiredParameters(this.name, this.description, this.options);
|
|
59
|
+
return {
|
|
60
|
+
type: v10.ApplicationCommandOptionType.Subcommand,
|
|
61
|
+
name: this.name,
|
|
62
|
+
name_localizations: this.name_localizations,
|
|
63
|
+
description: this.description,
|
|
64
|
+
description_localizations: this.description_localizations,
|
|
65
|
+
options: this.options.map((option) => option.toJSON())
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.SlashCommandSubcommandBuilder = __decorateClass([
|
|
70
|
+
tsMixer.mix(NameAndDescription.SharedNameAndDescription, SharedSlashCommandOptions.SharedSlashCommandOptions)
|
|
71
|
+
], exports.SlashCommandSubcommandBuilder);
|
|
72
|
+
//# sourceMappingURL=SlashCommandSubcommands.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlashCommandSubcommands.cjs","sources":["../../../src/interactions/slashCommands/SlashCommandSubcommands.ts"],"sourcesContent":["import {\n\tAPIApplicationCommandSubcommandGroupOption,\n\tAPIApplicationCommandSubcommandOption,\n\tApplicationCommandOptionType,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';\nimport type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';\n\n/**\n * Represents a folder for subcommands\n *\n * For more information, go to https://discord.com/developers/docs/interactions/application-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: SlashCommandSubcommandBuilder[] = [];\n\n\t/**\n\t * Adds a new subcommand to this group\n\t *\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\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\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(): APIApplicationCommandSubcommandGroupOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.SubcommandGroup,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\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/application-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: ApplicationCommandOptionBase[] = [];\n\n\tpublic toJSON(): APIApplicationCommandSubcommandOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.Subcommand,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\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"],"names":["SlashCommandSubcommandGroupBuilder","validateMaxOptionsLength","SlashCommandSubcommandBuilder","assertReturnOfBuilder","validateRequiredParameters","ApplicationCommandOptionType","mix","SharedNameAndDescription","SharedSlashCommandOptions"],"mappings":";;;;;;;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U;AACnD,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI;AACrB,MAAM,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;AACjD,MAAM,WAAW,EAAE,IAAI,CAAC,WAAW;AACnC,MAAM,yBAAyB,EAAE,IAAI,CAAC,yBAAyB;AAC/D,MAAM,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;AAC5D,KAAK,CAAC;AACN,GAAG;AACH,EAAE;AACFH,qCAA6B,GAAG,eAAe,CAAC;AAChD,EAAEI,WAAG,CAACC,2CAAwB,EAAEC,mDAAyB,CAAC;AAC1D,CAAC,EAAEN,qCAA6B,CAAC;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption } from 'discord-api-types/v10';
|
|
2
|
+
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
|
|
3
|
+
import type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase';
|
|
4
|
+
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
|
5
|
+
import { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a folder for subcommands
|
|
8
|
+
*
|
|
9
|
+
* For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
|
|
10
|
+
*/
|
|
11
|
+
export declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The name of this subcommand group
|
|
14
|
+
*/
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/**
|
|
17
|
+
* The description of this subcommand group
|
|
18
|
+
*/
|
|
19
|
+
readonly description: string;
|
|
20
|
+
/**
|
|
21
|
+
* The subcommands part of this subcommand group
|
|
22
|
+
*/
|
|
23
|
+
readonly options: SlashCommandSubcommandBuilder[];
|
|
24
|
+
/**
|
|
25
|
+
* Adds a new subcommand to this group
|
|
26
|
+
*
|
|
27
|
+
* @param input - A function that returns a subcommand builder, or an already built builder
|
|
28
|
+
*/
|
|
29
|
+
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this;
|
|
30
|
+
toJSON(): APIApplicationCommandSubcommandGroupOption;
|
|
31
|
+
}
|
|
32
|
+
export interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Represents a subcommand
|
|
36
|
+
*
|
|
37
|
+
* For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
|
|
38
|
+
*/
|
|
39
|
+
export declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
|
|
40
|
+
/**
|
|
41
|
+
* The name of this subcommand
|
|
42
|
+
*/
|
|
43
|
+
readonly name: string;
|
|
44
|
+
/**
|
|
45
|
+
* The description of this subcommand
|
|
46
|
+
*/
|
|
47
|
+
readonly description: string;
|
|
48
|
+
/**
|
|
49
|
+
* The options of this subcommand
|
|
50
|
+
*/
|
|
51
|
+
readonly options: ApplicationCommandOptionBase[];
|
|
52
|
+
toJSON(): APIApplicationCommandSubcommandOption;
|
|
53
|
+
}
|
|
54
|
+
export interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=SlashCommandSubcommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlashCommandSubcommands.d.ts","sourceRoot":"","sources":["../../../src/interactions/slashCommands/SlashCommandSubcommands.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,0CAA0C,EAC1C,qCAAqC,EAErC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;;;GAIG;AACH,qBACa,kCAAmC,YAAW,8BAA8B;IACxF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,6BAA6B,EAAE,CAAM;IAE9D;;;;OAIG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC;IAoBhF,MAAM,IAAI,0CAA0C;CAY3D;AAED,MAAM,WAAW,kCAAmC,SAAQ,wBAAwB;CAAG;AAEvF;;;;GAIG;AACH,qBACa,6BAA8B,YAAW,8BAA8B;IACnF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,4BAA4B,EAAE,CAAM;IAEtD,MAAM,IAAI,qCAAqC;CAYtD;AAED,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB,EAAE,yBAAyB,CAAC,KAAK,CAAC;CAAG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ApplicationCommandOptionType } from 'discord-api-types/v10';
|
|
2
|
+
import { mix } from 'ts-mixer';
|
|
3
|
+
import { validateMaxOptionsLength, assertReturnOfBuilder, validateRequiredParameters } from './Assertions.mjs';
|
|
4
|
+
import { SharedNameAndDescription } from './mixins/NameAndDescription.mjs';
|
|
5
|
+
import { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions.mjs';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result)
|
|
15
|
+
__defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
let SlashCommandSubcommandGroupBuilder = class {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.name = void 0;
|
|
21
|
+
this.description = void 0;
|
|
22
|
+
this.options = [];
|
|
23
|
+
}
|
|
24
|
+
addSubcommand(input) {
|
|
25
|
+
const { options } = this;
|
|
26
|
+
validateMaxOptionsLength(options);
|
|
27
|
+
const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input;
|
|
28
|
+
assertReturnOfBuilder(result, SlashCommandSubcommandBuilder);
|
|
29
|
+
options.push(result);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
toJSON() {
|
|
33
|
+
validateRequiredParameters(this.name, this.description, this.options);
|
|
34
|
+
return {
|
|
35
|
+
type: ApplicationCommandOptionType.SubcommandGroup,
|
|
36
|
+
name: this.name,
|
|
37
|
+
name_localizations: this.name_localizations,
|
|
38
|
+
description: this.description,
|
|
39
|
+
description_localizations: this.description_localizations,
|
|
40
|
+
options: this.options.map((option) => option.toJSON())
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
SlashCommandSubcommandGroupBuilder = __decorateClass([
|
|
45
|
+
mix(SharedNameAndDescription)
|
|
46
|
+
], SlashCommandSubcommandGroupBuilder);
|
|
47
|
+
let SlashCommandSubcommandBuilder = class {
|
|
48
|
+
constructor() {
|
|
49
|
+
this.name = void 0;
|
|
50
|
+
this.description = void 0;
|
|
51
|
+
this.options = [];
|
|
52
|
+
}
|
|
53
|
+
toJSON() {
|
|
54
|
+
validateRequiredParameters(this.name, this.description, this.options);
|
|
55
|
+
return {
|
|
56
|
+
type: ApplicationCommandOptionType.Subcommand,
|
|
57
|
+
name: this.name,
|
|
58
|
+
name_localizations: this.name_localizations,
|
|
59
|
+
description: this.description,
|
|
60
|
+
description_localizations: this.description_localizations,
|
|
61
|
+
options: this.options.map((option) => option.toJSON())
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
SlashCommandSubcommandBuilder = __decorateClass([
|
|
66
|
+
mix(SharedNameAndDescription, SharedSlashCommandOptions)
|
|
67
|
+
], SlashCommandSubcommandBuilder);
|
|
68
|
+
|
|
69
|
+
export { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder };
|
|
70
|
+
//# sourceMappingURL=SlashCommandSubcommands.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlashCommandSubcommands.mjs","sources":["../../../src/interactions/slashCommands/SlashCommandSubcommands.ts"],"sourcesContent":["import {\n\tAPIApplicationCommandSubcommandGroupOption,\n\tAPIApplicationCommandSubcommandOption,\n\tApplicationCommandOptionType,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';\nimport type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';\n\n/**\n * Represents a folder for subcommands\n *\n * For more information, go to https://discord.com/developers/docs/interactions/application-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: SlashCommandSubcommandBuilder[] = [];\n\n\t/**\n\t * Adds a new subcommand to this group\n\t *\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\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\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(): APIApplicationCommandSubcommandGroupOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.SubcommandGroup,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\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/application-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: ApplicationCommandOptionBase[] = [];\n\n\tpublic toJSON(): APIApplicationCommandSubcommandOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.Subcommand,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\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"],"names":[],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AACvD,IAAI,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,KAAK;AACzD,EAAE,IAAI,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;AACjF,EAAE,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;AAC5D,IAAI,IAAI,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC;AACjC,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;AACrF,EAAE,IAAI,IAAI,IAAI,MAAM;AACpB,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACnC,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAQQ,IAAC,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kC,CAAC,CAAC;AAC7B,IAAC,6BAA6B,GAAG,MAAM;AACjD,EAAE,WAAW,GAAG;AAChB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACvB,IAAI,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AAC9B,IAAI,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AACtB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,0BAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AAC1E,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,4BAA4B,CAAC,UAAU;AACnD,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI;AACrB,MAAM,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;AACjD,MAAM,WAAW,EAAE,IAAI,CAAC,WAAW;AACnC,MAAM,yBAAyB,EAAE,IAAI,CAAC,yBAAyB;AAC/D,MAAM,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;AAC5D,KAAK,CAAC;AACN,GAAG;AACH,EAAE;AACF,6BAA6B,GAAG,eAAe,CAAC;AAChD,EAAE,GAAG,CAAC,wBAAwB,EAAE,yBAAyB,CAAC;AAC1D,CAAC,EAAE,6BAA6B,CAAC;;;;"}
|
package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
class ApplicationCommandNumericOptionMinMaxValueMixin {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
exports.ApplicationCommandNumericOptionMinMaxValueMixin = ApplicationCommandNumericOptionMinMaxValueMixin;
|
|
9
|
+
//# sourceMappingURL=ApplicationCommandNumericOptionMinMaxValueMixin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandNumericOptionMinMaxValueMixin.cjs","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts"],"sourcesContent":["export abstract class ApplicationCommandNumericOptionMinMaxValueMixin {\n\tpublic readonly max_value?: number;\n\tpublic readonly min_value?: number;\n\n\t/**\n\t * Sets the maximum number value of this option\n\t *\n\t * @param max - The maximum value this option can be\n\t */\n\tpublic abstract setMaxValue(max: number): this;\n\n\t/**\n\t * Sets the minimum number value of this option\n\t *\n\t * @param min - The minimum value this option can be\n\t */\n\tpublic abstract setMinValue(min: number): this;\n}\n"],"names":[],"mappings":";;;;AAAO,MAAM,+CAA+C,CAAC;AAC7D;;;;"}
|
package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin {
|
|
2
|
+
readonly max_value?: number;
|
|
3
|
+
readonly min_value?: number;
|
|
4
|
+
/**
|
|
5
|
+
* Sets the maximum number value of this option
|
|
6
|
+
*
|
|
7
|
+
* @param max - The maximum value this option can be
|
|
8
|
+
*/
|
|
9
|
+
abstract setMaxValue(max: number): this;
|
|
10
|
+
/**
|
|
11
|
+
* Sets the minimum number value of this option
|
|
12
|
+
*
|
|
13
|
+
* @param min - The minimum value this option can be
|
|
14
|
+
*/
|
|
15
|
+
abstract setMinValue(min: number): this;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ApplicationCommandNumericOptionMinMaxValueMixin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandNumericOptionMinMaxValueMixin.d.ts","sourceRoot":"","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts"],"names":[],"mappings":"AAAA,8BAAsB,+CAA+C;IACpE,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnC;;;;OAIG;aACa,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAE9C;;;;OAIG;aACa,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandNumericOptionMinMaxValueMixin.mjs","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts"],"sourcesContent":["export abstract class ApplicationCommandNumericOptionMinMaxValueMixin {\n\tpublic readonly max_value?: number;\n\tpublic readonly min_value?: number;\n\n\t/**\n\t * Sets the maximum number value of this option\n\t *\n\t * @param max - The maximum value this option can be\n\t */\n\tpublic abstract setMaxValue(max: number): this;\n\n\t/**\n\t * Sets the minimum number value of this option\n\t *\n\t * @param min - The minimum value this option can be\n\t */\n\tpublic abstract setMinValue(min: number): this;\n}\n"],"names":[],"mappings":"AAAO,MAAM,+CAA+C,CAAC;AAC7D;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const NameAndDescription = require('./NameAndDescription.cjs');
|
|
6
|
+
const Assertions = require('../Assertions.cjs');
|
|
7
|
+
|
|
8
|
+
class ApplicationCommandOptionBase extends NameAndDescription.SharedNameAndDescription {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.required = false;
|
|
12
|
+
}
|
|
13
|
+
setRequired(required) {
|
|
14
|
+
Assertions.validateRequired(required);
|
|
15
|
+
Reflect.set(this, "required", required);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
runRequiredValidations() {
|
|
19
|
+
Assertions.validateRequiredParameters(this.name, this.description, []);
|
|
20
|
+
Assertions.validateLocalizationMap(this.name_localizations);
|
|
21
|
+
Assertions.validateLocalizationMap(this.description_localizations);
|
|
22
|
+
Assertions.validateRequired(this.required);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.ApplicationCommandOptionBase = ApplicationCommandOptionBase;
|
|
27
|
+
//# sourceMappingURL=ApplicationCommandOptionBase.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionBase.cjs","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts"],"sourcesContent":["import type { APIApplicationCommandBasicOption, ApplicationCommandOptionType } from 'discord-api-types/v10';\nimport { SharedNameAndDescription } from './NameAndDescription';\nimport { validateRequiredParameters, validateRequired, validateLocalizationMap } from '../Assertions';\n\nexport abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {\n\tpublic abstract readonly type: ApplicationCommandOptionType;\n\n\tpublic readonly required: boolean = false;\n\n\t/**\n\t * Marks the option as required\n\t *\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\tvalidateRequired(required);\n\n\t\tReflect.set(this, 'required', required);\n\n\t\treturn this;\n\t}\n\n\tpublic abstract toJSON(): APIApplicationCommandBasicOption;\n\n\tprotected runRequiredValidations() {\n\t\tvalidateRequiredParameters(this.name, this.description, []);\n\n\t\t// Validate localizations\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\t// Assert that you actually passed a boolean\n\t\tvalidateRequired(this.required);\n\t}\n}\n"],"names":["SharedNameAndDescription","validateRequired","validateRequiredParameters","validateLocalizationMap"],"mappings":";;;;;;;AAEO,MAAM,4BAA4B,SAASA,2CAAwB,CAAC;AAC3E,EAAE,WAAW,GAAG;AAChB,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AACxB,IAAI,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;AAC1B,GAAG;AACH,EAAE,WAAW,CAAC,QAAQ,EAAE;AACxB,IAAIC,2BAAgB,CAAC,QAAQ,CAAC,CAAC;AAC/B,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,sBAAsB,GAAG;AAC3B,IAAIC,qCAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAChE,IAAIC,kCAAuB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACrD,IAAIA,kCAAuB,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAC5D,IAAIF,2BAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpC,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { APIApplicationCommandBasicOption, ApplicationCommandOptionType } from 'discord-api-types/v10';
|
|
2
|
+
import { SharedNameAndDescription } from './NameAndDescription';
|
|
3
|
+
export declare abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {
|
|
4
|
+
abstract readonly type: ApplicationCommandOptionType;
|
|
5
|
+
readonly required: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Marks the option as required
|
|
8
|
+
*
|
|
9
|
+
* @param required - If this option should be required
|
|
10
|
+
*/
|
|
11
|
+
setRequired(required: boolean): this;
|
|
12
|
+
abstract toJSON(): APIApplicationCommandBasicOption;
|
|
13
|
+
protected runRequiredValidations(): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ApplicationCommandOptionBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionBase.d.ts","sourceRoot":"","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,8BAAsB,4BAA6B,SAAQ,wBAAwB;IAClF,kBAAyB,IAAI,EAAE,4BAA4B,CAAC;IAE5D,SAAgB,QAAQ,EAAE,OAAO,CAAS;IAE1C;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO;aASpB,MAAM,IAAI,gCAAgC;IAE1D,SAAS,CAAC,sBAAsB;CAUhC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SharedNameAndDescription } from './NameAndDescription.mjs';
|
|
2
|
+
import { validateRequired, validateRequiredParameters, validateLocalizationMap } from '../Assertions.mjs';
|
|
3
|
+
|
|
4
|
+
class ApplicationCommandOptionBase extends SharedNameAndDescription {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.required = false;
|
|
8
|
+
}
|
|
9
|
+
setRequired(required) {
|
|
10
|
+
validateRequired(required);
|
|
11
|
+
Reflect.set(this, "required", required);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
runRequiredValidations() {
|
|
15
|
+
validateRequiredParameters(this.name, this.description, []);
|
|
16
|
+
validateLocalizationMap(this.name_localizations);
|
|
17
|
+
validateLocalizationMap(this.description_localizations);
|
|
18
|
+
validateRequired(this.required);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { ApplicationCommandOptionBase };
|
|
23
|
+
//# sourceMappingURL=ApplicationCommandOptionBase.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionBase.mjs","sources":["../../../../src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts"],"sourcesContent":["import type { APIApplicationCommandBasicOption, ApplicationCommandOptionType } from 'discord-api-types/v10';\nimport { SharedNameAndDescription } from './NameAndDescription';\nimport { validateRequiredParameters, validateRequired, validateLocalizationMap } from '../Assertions';\n\nexport abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {\n\tpublic abstract readonly type: ApplicationCommandOptionType;\n\n\tpublic readonly required: boolean = false;\n\n\t/**\n\t * Marks the option as required\n\t *\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\tvalidateRequired(required);\n\n\t\tReflect.set(this, 'required', required);\n\n\t\treturn this;\n\t}\n\n\tpublic abstract toJSON(): APIApplicationCommandBasicOption;\n\n\tprotected runRequiredValidations() {\n\t\tvalidateRequiredParameters(this.name, this.description, []);\n\n\t\t// Validate localizations\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\t// Assert that you actually passed a boolean\n\t\tvalidateRequired(this.required);\n\t}\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,4BAA4B,SAAS,wBAAwB,CAAC;AAC3E,EAAE,WAAW,GAAG;AAChB,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AACxB,IAAI,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;AAC1B,GAAG;AACH,EAAE,WAAW,CAAC,QAAQ,EAAE;AACxB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AAC/B,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,sBAAsB,GAAG;AAC3B,IAAI,0BAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAChE,IAAI,uBAAuB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACrD,IAAI,uBAAuB,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAC5D,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpC,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
8
|
+
const allowedChannelTypes = [
|
|
9
|
+
v10.ChannelType.GuildText,
|
|
10
|
+
v10.ChannelType.GuildVoice,
|
|
11
|
+
v10.ChannelType.GuildCategory,
|
|
12
|
+
v10.ChannelType.GuildNews,
|
|
13
|
+
v10.ChannelType.GuildNewsThread,
|
|
14
|
+
v10.ChannelType.GuildPublicThread,
|
|
15
|
+
v10.ChannelType.GuildPrivateThread,
|
|
16
|
+
v10.ChannelType.GuildStageVoice
|
|
17
|
+
];
|
|
18
|
+
const channelTypesPredicate = shapeshift.s.array(shapeshift.s.union(...allowedChannelTypes.map((type) => shapeshift.s.literal(type))));
|
|
19
|
+
class ApplicationCommandOptionChannelTypesMixin {
|
|
20
|
+
addChannelTypes(...channelTypes) {
|
|
21
|
+
if (this.channel_types === void 0) {
|
|
22
|
+
Reflect.set(this, "channel_types", []);
|
|
23
|
+
}
|
|
24
|
+
this.channel_types.push(...channelTypesPredicate.parse(channelTypes));
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
exports.ApplicationCommandOptionChannelTypesMixin = ApplicationCommandOptionChannelTypesMixin;
|
|
30
|
+
//# sourceMappingURL=ApplicationCommandOptionChannelTypesMixin.cjs.map
|
package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationCommandOptionChannelTypesMixin.cjs","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":["ChannelType","s"],"mappings":";;;;;;;AAEA,MAAM,mBAAmB,GAAG;AAC5B,EAAEA,eAAW,CAAC,SAAS;AACvB,EAAEA,eAAW,CAAC,UAAU;AACxB,EAAEA,eAAW,CAAC,aAAa;AAC3B,EAAEA,eAAW,CAAC,SAAS;AACvB,EAAEA,eAAW,CAAC,eAAe;AAC7B,EAAEA,eAAW,CAAC,iBAAiB;AAC/B,EAAEA,eAAW,CAAC,kBAAkB;AAChC,EAAEA,eAAW,CAAC,eAAe;AAC7B,CAAC,CAAC;AACF,MAAM,qBAAqB,GAAGC,YAAC,CAAC,KAAK,CAACA,YAAC,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,KAAKA,YAAC,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,14 @@
|
|
|
1
|
+
import { ChannelType } from 'discord-api-types/v10';
|
|
2
|
+
declare const allowedChannelTypes: readonly [ChannelType.GuildText, ChannelType.GuildVoice, ChannelType.GuildCategory, ChannelType.GuildNews, ChannelType.GuildNewsThread, ChannelType.GuildPublicThread, ChannelType.GuildPrivateThread, ChannelType.GuildStageVoice];
|
|
3
|
+
export declare type ApplicationCommandOptionAllowedChannelTypes = typeof allowedChannelTypes[number];
|
|
4
|
+
export declare class ApplicationCommandOptionChannelTypesMixin {
|
|
5
|
+
readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[];
|
|
6
|
+
/**
|
|
7
|
+
* Adds channel types to this option
|
|
8
|
+
*
|
|
9
|
+
* @param channelTypes - The channel types to add
|
|
10
|
+
*/
|
|
11
|
+
addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ApplicationCommandOptionChannelTypesMixin.d.ts.map
|