@discordjs/builders 1.2.1-dev.1662077397-8a91d7c.0 → 1.2.1-dev.1662336804-4ffdada.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/dist/index.d.ts +1583 -40
- package/dist/index.js +1567 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1486 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -10
- package/dist/components/ActionRow.cjs +0 -32
- package/dist/components/ActionRow.cjs.map +0 -1
- package/dist/components/ActionRow.d.ts +0 -40
- package/dist/components/ActionRow.d.ts.map +0 -1
- package/dist/components/ActionRow.mjs +0 -28
- package/dist/components/ActionRow.mjs.map +0 -1
- package/dist/components/Assertions.cjs +0 -77
- package/dist/components/Assertions.cjs.map +0 -1
- package/dist/components/Assertions.d.ts +0 -48
- package/dist/components/Assertions.d.ts.map +0 -1
- package/dist/components/Assertions.mjs +0 -57
- package/dist/components/Assertions.mjs.map +0 -1
- package/dist/components/Component.cjs +0 -12
- package/dist/components/Component.cjs.map +0 -1
- package/dist/components/Component.d.ts +0 -24
- package/dist/components/Component.d.ts.map +0 -1
- package/dist/components/Component.mjs +0 -8
- package/dist/components/Component.mjs.map +0 -1
- package/dist/components/Components.cjs +0 -31
- package/dist/components/Components.cjs.map +0 -1
- package/dist/components/Components.d.ts +0 -21
- package/dist/components/Components.d.ts.map +0 -1
- package/dist/components/Components.mjs +0 -27
- package/dist/components/Components.mjs.map +0 -1
- package/dist/components/button/Button.cjs +0 -52
- package/dist/components/button/Button.cjs.map +0 -1
- package/dist/components/button/Button.d.ts +0 -82
- package/dist/components/button/Button.d.ts.map +0 -1
- package/dist/components/button/Button.mjs +0 -48
- package/dist/components/button/Button.mjs.map +0 -1
- package/dist/components/selectMenu/SelectMenu.cjs +0 -69
- package/dist/components/selectMenu/SelectMenu.cjs.map +0 -1
- package/dist/components/selectMenu/SelectMenu.d.ts +0 -62
- package/dist/components/selectMenu/SelectMenu.d.ts.map +0 -1
- package/dist/components/selectMenu/SelectMenu.mjs +0 -65
- package/dist/components/selectMenu/SelectMenu.mjs.map +0 -1
- package/dist/components/selectMenu/SelectMenuOption.cjs +0 -40
- package/dist/components/selectMenu/SelectMenuOption.cjs.map +0 -1
- package/dist/components/selectMenu/SelectMenuOption.d.ts +0 -44
- package/dist/components/selectMenu/SelectMenuOption.d.ts.map +0 -1
- package/dist/components/selectMenu/SelectMenuOption.mjs +0 -36
- package/dist/components/selectMenu/SelectMenuOption.mjs.map +0 -1
- package/dist/components/textInput/Assertions.cjs +0 -31
- package/dist/components/textInput/Assertions.cjs.map +0 -1
- package/dist/components/textInput/Assertions.d.ts +0 -10
- package/dist/components/textInput/Assertions.d.ts.map +0 -1
- package/dist/components/textInput/Assertions.mjs +0 -20
- package/dist/components/textInput/Assertions.mjs.map +0 -1
- package/dist/components/textInput/TextInput.cjs +0 -67
- package/dist/components/textInput/TextInput.cjs.map +0 -1
- package/dist/components/textInput/TextInput.d.ts +0 -66
- package/dist/components/textInput/TextInput.d.ts.map +0 -1
- package/dist/components/textInput/TextInput.mjs +0 -59
- package/dist/components/textInput/TextInput.mjs.map +0 -1
- package/dist/index.cjs +0 -129
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/Assertions.cjs +0 -44
- package/dist/interactions/contextMenuCommands/Assertions.cjs.map +0 -1
- package/dist/interactions/contextMenuCommands/Assertions.d.ts +0 -8
- package/dist/interactions/contextMenuCommands/Assertions.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/Assertions.mjs +0 -35
- package/dist/interactions/contextMenuCommands/Assertions.mjs.map +0 -1
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs +0 -72
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs.map +0 -1
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts +0 -91
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs +0 -68
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs.map +0 -1
- package/dist/interactions/modals/Assertions.cjs +0 -21
- package/dist/interactions/modals/Assertions.cjs.map +0 -1
- package/dist/interactions/modals/Assertions.d.ts +0 -5
- package/dist/interactions/modals/Assertions.d.ts.map +0 -1
- package/dist/interactions/modals/Assertions.mjs +0 -15
- package/dist/interactions/modals/Assertions.mjs.map +0 -1
- package/dist/interactions/modals/Modal.cjs +0 -47
- package/dist/interactions/modals/Modal.cjs.map +0 -1
- package/dist/interactions/modals/Modal.d.ts +0 -38
- package/dist/interactions/modals/Modal.d.ts.map +0 -1
- package/dist/interactions/modals/Modal.mjs +0 -43
- package/dist/interactions/modals/Modal.mjs.map +0 -1
- package/dist/interactions/slashCommands/Assertions.cjs +0 -74
- package/dist/interactions/slashCommands/Assertions.cjs.map +0 -1
- package/dist/interactions/slashCommands/Assertions.d.ts +0 -18
- package/dist/interactions/slashCommands/Assertions.d.ts.map +0 -1
- package/dist/interactions/slashCommands/Assertions.mjs +0 -58
- package/dist/interactions/slashCommands/Assertions.mjs.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.cjs +0 -75
- package/dist/interactions/slashCommands/SlashCommandBuilder.cjs.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +0 -97
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.mjs +0 -73
- package/dist/interactions/slashCommands/SlashCommandBuilder.mjs.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandSubcommands.cjs +0 -72
- package/dist/interactions/slashCommands/SlashCommandSubcommands.cjs.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +0 -56
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandSubcommands.mjs +0 -70
- package/dist/interactions/slashCommands/SlashCommandSubcommands.mjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs +0 -9
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts +0 -17
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.mjs +0 -5
- package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.mjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs +0 -27
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts +0 -15
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs +0 -23
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs +0 -30
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.d.ts +0 -14
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.mjs +0 -26
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.mjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs +0 -57
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts +0 -20
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs +0 -53
- package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs +0 -69
- package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts +0 -46
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs +0 -65
- package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs +0 -55
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs.map +0 -1
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts +0 -69
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.mjs +0 -51
- package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/attachment.cjs +0 -20
- package/dist/interactions/slashCommands/options/attachment.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/attachment.d.ts +0 -7
- package/dist/interactions/slashCommands/options/attachment.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/attachment.mjs +0 -16
- package/dist/interactions/slashCommands/options/attachment.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/boolean.cjs +0 -20
- package/dist/interactions/slashCommands/options/boolean.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/boolean.d.ts +0 -7
- package/dist/interactions/slashCommands/options/boolean.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/boolean.mjs +0 -16
- package/dist/interactions/slashCommands/options/boolean.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/channel.cjs +0 -34
- package/dist/interactions/slashCommands/options/channel.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/channel.d.ts +0 -10
- package/dist/interactions/slashCommands/options/channel.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/channel.mjs +0 -32
- package/dist/interactions/slashCommands/options/channel.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/integer.cjs +0 -50
- package/dist/interactions/slashCommands/options/integer.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/integer.d.ts +0 -19
- package/dist/interactions/slashCommands/options/integer.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/integer.mjs +0 -48
- package/dist/interactions/slashCommands/options/integer.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/mentionable.cjs +0 -20
- package/dist/interactions/slashCommands/options/mentionable.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/mentionable.d.ts +0 -7
- package/dist/interactions/slashCommands/options/mentionable.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/mentionable.mjs +0 -16
- package/dist/interactions/slashCommands/options/mentionable.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/number.cjs +0 -50
- package/dist/interactions/slashCommands/options/number.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/number.d.ts +0 -19
- package/dist/interactions/slashCommands/options/number.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/number.mjs +0 -48
- package/dist/interactions/slashCommands/options/number.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/role.cjs +0 -20
- package/dist/interactions/slashCommands/options/role.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/role.d.ts +0 -7
- package/dist/interactions/slashCommands/options/role.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/role.mjs +0 -16
- package/dist/interactions/slashCommands/options/role.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/string.cjs +0 -50
- package/dist/interactions/slashCommands/options/string.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/string.d.ts +0 -24
- package/dist/interactions/slashCommands/options/string.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/string.mjs +0 -48
- package/dist/interactions/slashCommands/options/string.mjs.map +0 -1
- package/dist/interactions/slashCommands/options/user.cjs +0 -20
- package/dist/interactions/slashCommands/options/user.cjs.map +0 -1
- package/dist/interactions/slashCommands/options/user.d.ts +0 -7
- package/dist/interactions/slashCommands/options/user.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/user.mjs +0 -16
- package/dist/interactions/slashCommands/options/user.mjs.map +0 -1
- package/dist/messages/embed/Assertions.cjs +0 -62
- package/dist/messages/embed/Assertions.cjs.map +0 -1
- package/dist/messages/embed/Assertions.d.ts +0 -50
- package/dist/messages/embed/Assertions.d.ts.map +0 -1
- package/dist/messages/embed/Assertions.mjs +0 -41
- package/dist/messages/embed/Assertions.mjs.map +0 -1
- package/dist/messages/embed/Embed.cjs +0 -101
- package/dist/messages/embed/Embed.cjs.map +0 -1
- package/dist/messages/embed/Embed.d.ts +0 -155
- package/dist/messages/embed/Embed.d.ts.map +0 -1
- package/dist/messages/embed/Embed.mjs +0 -97
- package/dist/messages/embed/Embed.mjs.map +0 -1
- package/dist/messages/formatters.cjs +0 -102
- package/dist/messages/formatters.cjs.map +0 -1
- package/dist/messages/formatters.d.ts +0 -246
- package/dist/messages/formatters.d.ts.map +0 -1
- package/dist/messages/formatters.mjs +0 -79
- package/dist/messages/formatters.mjs.map +0 -1
- package/dist/util/componentUtil.cjs +0 -10
- package/dist/util/componentUtil.cjs.map +0 -1
- package/dist/util/componentUtil.d.ts +0 -3
- package/dist/util/componentUtil.d.ts.map +0 -1
- package/dist/util/componentUtil.mjs +0 -6
- package/dist/util/componentUtil.mjs.map +0 -1
- package/dist/util/equatable.cjs +0 -10
- package/dist/util/equatable.cjs.map +0 -1
- package/dist/util/equatable.d.ts +0 -19
- package/dist/util/equatable.d.ts.map +0 -1
- package/dist/util/equatable.mjs +0 -6
- package/dist/util/equatable.mjs.map +0 -1
- package/dist/util/jsonEncodable.cjs +0 -10
- package/dist/util/jsonEncodable.cjs.map +0 -1
- package/dist/util/jsonEncodable.d.ts +0 -18
- package/dist/util/jsonEncodable.d.ts.map +0 -1
- package/dist/util/jsonEncodable.mjs +0 -6
- package/dist/util/jsonEncodable.mjs.map +0 -1
- package/dist/util/normalizeArray.cjs +0 -12
- package/dist/util/normalizeArray.cjs.map +0 -1
- package/dist/util/normalizeArray.d.ts +0 -3
- package/dist/util/normalizeArray.d.ts.map +0 -1
- package/dist/util/normalizeArray.mjs +0 -8
- package/dist/util/normalizeArray.mjs.map +0 -1
- package/dist/util/validation.cjs +0 -13
- package/dist/util/validation.cjs.map +0 -1
- package/dist/util/validation.d.ts +0 -4
- package/dist/util/validation.d.ts.map +0 -1
- package/dist/util/validation.mjs +0 -7
- package/dist/util/validation.mjs.map +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,1567 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
+
mod
|
|
24
|
+
));
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
27
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
28
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
29
|
+
if (decorator = decorators[i])
|
|
30
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
31
|
+
if (kind && result)
|
|
32
|
+
__defProp(target, key, result);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/index.ts
|
|
37
|
+
var src_exports = {};
|
|
38
|
+
__export(src_exports, {
|
|
39
|
+
ActionRowBuilder: () => ActionRowBuilder,
|
|
40
|
+
ApplicationCommandNumericOptionMinMaxValueMixin: () => ApplicationCommandNumericOptionMinMaxValueMixin,
|
|
41
|
+
ApplicationCommandOptionBase: () => ApplicationCommandOptionBase,
|
|
42
|
+
ApplicationCommandOptionChannelTypesMixin: () => ApplicationCommandOptionChannelTypesMixin,
|
|
43
|
+
ApplicationCommandOptionWithChoicesAndAutocompleteMixin: () => ApplicationCommandOptionWithChoicesAndAutocompleteMixin,
|
|
44
|
+
ButtonBuilder: () => ButtonBuilder,
|
|
45
|
+
ComponentAssertions: () => Assertions_exports2,
|
|
46
|
+
ComponentBuilder: () => ComponentBuilder,
|
|
47
|
+
ContextMenuCommandAssertions: () => Assertions_exports6,
|
|
48
|
+
ContextMenuCommandBuilder: () => ContextMenuCommandBuilder,
|
|
49
|
+
EmbedAssertions: () => Assertions_exports,
|
|
50
|
+
EmbedBuilder: () => EmbedBuilder,
|
|
51
|
+
Faces: () => Faces,
|
|
52
|
+
ModalAssertions: () => Assertions_exports4,
|
|
53
|
+
ModalBuilder: () => ModalBuilder,
|
|
54
|
+
SelectMenuBuilder: () => SelectMenuBuilder,
|
|
55
|
+
SelectMenuOptionBuilder: () => SelectMenuOptionBuilder,
|
|
56
|
+
SharedNameAndDescription: () => SharedNameAndDescription,
|
|
57
|
+
SharedSlashCommandOptions: () => SharedSlashCommandOptions,
|
|
58
|
+
SlashCommandAssertions: () => Assertions_exports5,
|
|
59
|
+
SlashCommandAttachmentOption: () => SlashCommandAttachmentOption,
|
|
60
|
+
SlashCommandBooleanOption: () => SlashCommandBooleanOption,
|
|
61
|
+
SlashCommandBuilder: () => SlashCommandBuilder,
|
|
62
|
+
SlashCommandChannelOption: () => SlashCommandChannelOption,
|
|
63
|
+
SlashCommandIntegerOption: () => SlashCommandIntegerOption,
|
|
64
|
+
SlashCommandMentionableOption: () => SlashCommandMentionableOption,
|
|
65
|
+
SlashCommandNumberOption: () => SlashCommandNumberOption,
|
|
66
|
+
SlashCommandRoleOption: () => SlashCommandRoleOption,
|
|
67
|
+
SlashCommandStringOption: () => SlashCommandStringOption,
|
|
68
|
+
SlashCommandSubcommandBuilder: () => SlashCommandSubcommandBuilder,
|
|
69
|
+
SlashCommandSubcommandGroupBuilder: () => SlashCommandSubcommandGroupBuilder,
|
|
70
|
+
SlashCommandUserOption: () => SlashCommandUserOption,
|
|
71
|
+
TextInputAssertions: () => Assertions_exports3,
|
|
72
|
+
TextInputBuilder: () => TextInputBuilder,
|
|
73
|
+
TimestampStyles: () => TimestampStyles,
|
|
74
|
+
blockQuote: () => blockQuote,
|
|
75
|
+
bold: () => bold,
|
|
76
|
+
channelLink: () => channelLink,
|
|
77
|
+
channelMention: () => channelMention,
|
|
78
|
+
chatInputApplicationCommandMention: () => chatInputApplicationCommandMention,
|
|
79
|
+
codeBlock: () => codeBlock,
|
|
80
|
+
createComponentBuilder: () => createComponentBuilder,
|
|
81
|
+
disableValidators: () => disableValidators,
|
|
82
|
+
embedLength: () => embedLength,
|
|
83
|
+
enableValidators: () => enableValidators,
|
|
84
|
+
formatEmoji: () => formatEmoji,
|
|
85
|
+
hideLinkEmbed: () => hideLinkEmbed,
|
|
86
|
+
hyperlink: () => hyperlink,
|
|
87
|
+
inlineCode: () => inlineCode,
|
|
88
|
+
isEquatable: () => isEquatable,
|
|
89
|
+
isJSONEncodable: () => isJSONEncodable,
|
|
90
|
+
isValidationEnabled: () => isValidationEnabled,
|
|
91
|
+
italic: () => italic,
|
|
92
|
+
messageLink: () => messageLink,
|
|
93
|
+
normalizeArray: () => normalizeArray,
|
|
94
|
+
quote: () => quote,
|
|
95
|
+
roleMention: () => roleMention,
|
|
96
|
+
spoiler: () => spoiler,
|
|
97
|
+
strikethrough: () => strikethrough,
|
|
98
|
+
time: () => time,
|
|
99
|
+
underscore: () => underscore,
|
|
100
|
+
userMention: () => userMention
|
|
101
|
+
});
|
|
102
|
+
module.exports = __toCommonJS(src_exports);
|
|
103
|
+
|
|
104
|
+
// src/messages/embed/Assertions.ts
|
|
105
|
+
var Assertions_exports = {};
|
|
106
|
+
__export(Assertions_exports, {
|
|
107
|
+
RGBPredicate: () => RGBPredicate,
|
|
108
|
+
authorNamePredicate: () => authorNamePredicate,
|
|
109
|
+
colorPredicate: () => colorPredicate,
|
|
110
|
+
descriptionPredicate: () => descriptionPredicate,
|
|
111
|
+
embedAuthorPredicate: () => embedAuthorPredicate,
|
|
112
|
+
embedFieldPredicate: () => embedFieldPredicate,
|
|
113
|
+
embedFieldsArrayPredicate: () => embedFieldsArrayPredicate,
|
|
114
|
+
embedFooterPredicate: () => embedFooterPredicate,
|
|
115
|
+
fieldInlinePredicate: () => fieldInlinePredicate,
|
|
116
|
+
fieldLengthPredicate: () => fieldLengthPredicate,
|
|
117
|
+
fieldNamePredicate: () => fieldNamePredicate,
|
|
118
|
+
fieldValuePredicate: () => fieldValuePredicate,
|
|
119
|
+
footerTextPredicate: () => footerTextPredicate,
|
|
120
|
+
imageURLPredicate: () => imageURLPredicate,
|
|
121
|
+
timestampPredicate: () => timestampPredicate,
|
|
122
|
+
titlePredicate: () => titlePredicate,
|
|
123
|
+
urlPredicate: () => urlPredicate,
|
|
124
|
+
validateFieldLength: () => validateFieldLength
|
|
125
|
+
});
|
|
126
|
+
var import_shapeshift = require("@sapphire/shapeshift");
|
|
127
|
+
|
|
128
|
+
// src/util/validation.ts
|
|
129
|
+
var validate = true;
|
|
130
|
+
var enableValidators = /* @__PURE__ */ __name(() => validate = true, "enableValidators");
|
|
131
|
+
var disableValidators = /* @__PURE__ */ __name(() => validate = false, "disableValidators");
|
|
132
|
+
var isValidationEnabled = /* @__PURE__ */ __name(() => validate, "isValidationEnabled");
|
|
133
|
+
|
|
134
|
+
// src/messages/embed/Assertions.ts
|
|
135
|
+
var fieldNamePredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(256).setValidationEnabled(isValidationEnabled);
|
|
136
|
+
var fieldValuePredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled);
|
|
137
|
+
var fieldInlinePredicate = import_shapeshift.s.boolean.optional;
|
|
138
|
+
var embedFieldPredicate = import_shapeshift.s.object({
|
|
139
|
+
name: fieldNamePredicate,
|
|
140
|
+
value: fieldValuePredicate,
|
|
141
|
+
inline: fieldInlinePredicate
|
|
142
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
143
|
+
var embedFieldsArrayPredicate = embedFieldPredicate.array.setValidationEnabled(isValidationEnabled);
|
|
144
|
+
var fieldLengthPredicate = import_shapeshift.s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
145
|
+
function validateFieldLength(amountAdding, fields) {
|
|
146
|
+
fieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding);
|
|
147
|
+
}
|
|
148
|
+
__name(validateFieldLength, "validateFieldLength");
|
|
149
|
+
var authorNamePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);
|
|
150
|
+
var imageURLPredicate = import_shapeshift.s.string.url({
|
|
151
|
+
allowedProtocols: ["http:", "https:", "attachment:"]
|
|
152
|
+
}).nullish.setValidationEnabled(isValidationEnabled);
|
|
153
|
+
var urlPredicate = import_shapeshift.s.string.url({
|
|
154
|
+
allowedProtocols: ["http:", "https:"]
|
|
155
|
+
}).nullish.setValidationEnabled(isValidationEnabled);
|
|
156
|
+
var embedAuthorPredicate = import_shapeshift.s.object({
|
|
157
|
+
name: authorNamePredicate,
|
|
158
|
+
iconURL: imageURLPredicate,
|
|
159
|
+
url: urlPredicate
|
|
160
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
161
|
+
var RGBPredicate = import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(255).setValidationEnabled(isValidationEnabled);
|
|
162
|
+
var colorPredicate = import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(16777215).or(import_shapeshift.s.tuple([RGBPredicate, RGBPredicate, RGBPredicate])).nullable.setValidationEnabled(isValidationEnabled);
|
|
163
|
+
var descriptionPredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4096).nullable.setValidationEnabled(isValidationEnabled);
|
|
164
|
+
var footerTextPredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(2048).nullable.setValidationEnabled(isValidationEnabled);
|
|
165
|
+
var embedFooterPredicate = import_shapeshift.s.object({
|
|
166
|
+
text: footerTextPredicate,
|
|
167
|
+
iconURL: imageURLPredicate
|
|
168
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
169
|
+
var timestampPredicate = import_shapeshift.s.union(import_shapeshift.s.number, import_shapeshift.s.date).nullable.setValidationEnabled(isValidationEnabled);
|
|
170
|
+
var titlePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);
|
|
171
|
+
|
|
172
|
+
// src/util/normalizeArray.ts
|
|
173
|
+
function normalizeArray(arr) {
|
|
174
|
+
if (Array.isArray(arr[0]))
|
|
175
|
+
return arr[0];
|
|
176
|
+
return arr;
|
|
177
|
+
}
|
|
178
|
+
__name(normalizeArray, "normalizeArray");
|
|
179
|
+
|
|
180
|
+
// src/messages/embed/Embed.ts
|
|
181
|
+
var EmbedBuilder = class {
|
|
182
|
+
data;
|
|
183
|
+
constructor(data = {}) {
|
|
184
|
+
this.data = { ...data };
|
|
185
|
+
if (data.timestamp)
|
|
186
|
+
this.data.timestamp = new Date(data.timestamp).toISOString();
|
|
187
|
+
}
|
|
188
|
+
addFields(...fields) {
|
|
189
|
+
fields = normalizeArray(fields);
|
|
190
|
+
validateFieldLength(fields.length, this.data.fields);
|
|
191
|
+
embedFieldsArrayPredicate.parse(fields);
|
|
192
|
+
if (this.data.fields)
|
|
193
|
+
this.data.fields.push(...fields);
|
|
194
|
+
else
|
|
195
|
+
this.data.fields = fields;
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
spliceFields(index, deleteCount, ...fields) {
|
|
199
|
+
validateFieldLength(fields.length - deleteCount, this.data.fields);
|
|
200
|
+
embedFieldsArrayPredicate.parse(fields);
|
|
201
|
+
if (this.data.fields)
|
|
202
|
+
this.data.fields.splice(index, deleteCount, ...fields);
|
|
203
|
+
else
|
|
204
|
+
this.data.fields = fields;
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
setFields(...fields) {
|
|
208
|
+
this.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
setAuthor(options) {
|
|
212
|
+
if (options === null) {
|
|
213
|
+
this.data.author = void 0;
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
embedAuthorPredicate.parse(options);
|
|
217
|
+
this.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
setColor(color) {
|
|
221
|
+
colorPredicate.parse(color);
|
|
222
|
+
if (Array.isArray(color)) {
|
|
223
|
+
const [red, green, blue] = color;
|
|
224
|
+
this.data.color = (red << 16) + (green << 8) + blue;
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
this.data.color = color ?? void 0;
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
setDescription(description) {
|
|
231
|
+
descriptionPredicate.parse(description);
|
|
232
|
+
this.data.description = description ?? void 0;
|
|
233
|
+
return this;
|
|
234
|
+
}
|
|
235
|
+
setFooter(options) {
|
|
236
|
+
if (options === null) {
|
|
237
|
+
this.data.footer = void 0;
|
|
238
|
+
return this;
|
|
239
|
+
}
|
|
240
|
+
embedFooterPredicate.parse(options);
|
|
241
|
+
this.data.footer = { text: options.text, icon_url: options.iconURL };
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
setImage(url) {
|
|
245
|
+
imageURLPredicate.parse(url);
|
|
246
|
+
this.data.image = url ? { url } : void 0;
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
setThumbnail(url) {
|
|
250
|
+
imageURLPredicate.parse(url);
|
|
251
|
+
this.data.thumbnail = url ? { url } : void 0;
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
setTimestamp(timestamp = Date.now()) {
|
|
255
|
+
timestampPredicate.parse(timestamp);
|
|
256
|
+
this.data.timestamp = timestamp ? new Date(timestamp).toISOString() : void 0;
|
|
257
|
+
return this;
|
|
258
|
+
}
|
|
259
|
+
setTitle(title) {
|
|
260
|
+
titlePredicate.parse(title);
|
|
261
|
+
this.data.title = title ?? void 0;
|
|
262
|
+
return this;
|
|
263
|
+
}
|
|
264
|
+
setURL(url) {
|
|
265
|
+
urlPredicate.parse(url);
|
|
266
|
+
this.data.url = url ?? void 0;
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
toJSON() {
|
|
270
|
+
return { ...this.data };
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
__name(EmbedBuilder, "EmbedBuilder");
|
|
274
|
+
|
|
275
|
+
// src/messages/formatters.ts
|
|
276
|
+
function codeBlock(language, content) {
|
|
277
|
+
return typeof content === "undefined" ? `\`\`\`
|
|
278
|
+
${language}
|
|
279
|
+
\`\`\`` : `\`\`\`${language}
|
|
280
|
+
${content}
|
|
281
|
+
\`\`\``;
|
|
282
|
+
}
|
|
283
|
+
__name(codeBlock, "codeBlock");
|
|
284
|
+
function inlineCode(content) {
|
|
285
|
+
return `\`${content}\``;
|
|
286
|
+
}
|
|
287
|
+
__name(inlineCode, "inlineCode");
|
|
288
|
+
function italic(content) {
|
|
289
|
+
return `_${content}_`;
|
|
290
|
+
}
|
|
291
|
+
__name(italic, "italic");
|
|
292
|
+
function bold(content) {
|
|
293
|
+
return `**${content}**`;
|
|
294
|
+
}
|
|
295
|
+
__name(bold, "bold");
|
|
296
|
+
function underscore(content) {
|
|
297
|
+
return `__${content}__`;
|
|
298
|
+
}
|
|
299
|
+
__name(underscore, "underscore");
|
|
300
|
+
function strikethrough(content) {
|
|
301
|
+
return `~~${content}~~`;
|
|
302
|
+
}
|
|
303
|
+
__name(strikethrough, "strikethrough");
|
|
304
|
+
function quote(content) {
|
|
305
|
+
return `> ${content}`;
|
|
306
|
+
}
|
|
307
|
+
__name(quote, "quote");
|
|
308
|
+
function blockQuote(content) {
|
|
309
|
+
return `>>> ${content}`;
|
|
310
|
+
}
|
|
311
|
+
__name(blockQuote, "blockQuote");
|
|
312
|
+
function hideLinkEmbed(url) {
|
|
313
|
+
return `<${url}>`;
|
|
314
|
+
}
|
|
315
|
+
__name(hideLinkEmbed, "hideLinkEmbed");
|
|
316
|
+
function hyperlink(content, url, title) {
|
|
317
|
+
return title ? `[${content}](${url} "${title}")` : `[${content}](${url})`;
|
|
318
|
+
}
|
|
319
|
+
__name(hyperlink, "hyperlink");
|
|
320
|
+
function spoiler(content) {
|
|
321
|
+
return `||${content}||`;
|
|
322
|
+
}
|
|
323
|
+
__name(spoiler, "spoiler");
|
|
324
|
+
function userMention(userId) {
|
|
325
|
+
return `<@${userId}>`;
|
|
326
|
+
}
|
|
327
|
+
__name(userMention, "userMention");
|
|
328
|
+
function channelMention(channelId) {
|
|
329
|
+
return `<#${channelId}>`;
|
|
330
|
+
}
|
|
331
|
+
__name(channelMention, "channelMention");
|
|
332
|
+
function roleMention(roleId) {
|
|
333
|
+
return `<@&${roleId}>`;
|
|
334
|
+
}
|
|
335
|
+
__name(roleMention, "roleMention");
|
|
336
|
+
function chatInputApplicationCommandMention(commandName, subcommandGroupName, subcommandName, commandId) {
|
|
337
|
+
if (typeof commandId !== "undefined") {
|
|
338
|
+
return `</${commandName} ${subcommandGroupName} ${subcommandName}:${commandId}>`;
|
|
339
|
+
}
|
|
340
|
+
if (typeof subcommandName !== "undefined") {
|
|
341
|
+
return `</${commandName} ${subcommandGroupName}:${subcommandName}>`;
|
|
342
|
+
}
|
|
343
|
+
return `</${commandName}:${subcommandGroupName}>`;
|
|
344
|
+
}
|
|
345
|
+
__name(chatInputApplicationCommandMention, "chatInputApplicationCommandMention");
|
|
346
|
+
function formatEmoji(emojiId, animated = false) {
|
|
347
|
+
return `<${animated ? "a" : ""}:_:${emojiId}>`;
|
|
348
|
+
}
|
|
349
|
+
__name(formatEmoji, "formatEmoji");
|
|
350
|
+
function channelLink(channelId, guildId) {
|
|
351
|
+
return `https://discord.com/channels/${guildId ?? "@me"}/${channelId}`;
|
|
352
|
+
}
|
|
353
|
+
__name(channelLink, "channelLink");
|
|
354
|
+
function messageLink(channelId, messageId, guildId) {
|
|
355
|
+
return `${typeof guildId === "undefined" ? channelLink(channelId) : channelLink(channelId, guildId)}/${messageId}`;
|
|
356
|
+
}
|
|
357
|
+
__name(messageLink, "messageLink");
|
|
358
|
+
function time(timeOrSeconds, style) {
|
|
359
|
+
if (typeof timeOrSeconds !== "number") {
|
|
360
|
+
timeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1e3);
|
|
361
|
+
}
|
|
362
|
+
return typeof style === "string" ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;
|
|
363
|
+
}
|
|
364
|
+
__name(time, "time");
|
|
365
|
+
var TimestampStyles = {
|
|
366
|
+
ShortTime: "t",
|
|
367
|
+
LongTime: "T",
|
|
368
|
+
ShortDate: "d",
|
|
369
|
+
LongDate: "D",
|
|
370
|
+
ShortDateTime: "f",
|
|
371
|
+
LongDateTime: "F",
|
|
372
|
+
RelativeTime: "R"
|
|
373
|
+
};
|
|
374
|
+
var Faces = /* @__PURE__ */ ((Faces2) => {
|
|
375
|
+
Faces2["Shrug"] = "\xAF\\_(\u30C4)\\_/\xAF";
|
|
376
|
+
Faces2["Tableflip"] = "(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B";
|
|
377
|
+
Faces2["Unflip"] = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)";
|
|
378
|
+
return Faces2;
|
|
379
|
+
})(Faces || {});
|
|
380
|
+
|
|
381
|
+
// src/components/Assertions.ts
|
|
382
|
+
var Assertions_exports2 = {};
|
|
383
|
+
__export(Assertions_exports2, {
|
|
384
|
+
buttonLabelValidator: () => buttonLabelValidator,
|
|
385
|
+
buttonStyleValidator: () => buttonStyleValidator,
|
|
386
|
+
customIdValidator: () => customIdValidator,
|
|
387
|
+
defaultValidator: () => defaultValidator,
|
|
388
|
+
disabledValidator: () => disabledValidator,
|
|
389
|
+
emojiValidator: () => emojiValidator,
|
|
390
|
+
jsonOptionValidator: () => jsonOptionValidator,
|
|
391
|
+
labelValueDescriptionValidator: () => labelValueDescriptionValidator,
|
|
392
|
+
minMaxValidator: () => minMaxValidator,
|
|
393
|
+
optionValidator: () => optionValidator,
|
|
394
|
+
optionsLengthValidator: () => optionsLengthValidator,
|
|
395
|
+
optionsValidator: () => optionsValidator,
|
|
396
|
+
placeholderValidator: () => placeholderValidator,
|
|
397
|
+
urlValidator: () => urlValidator,
|
|
398
|
+
validateRequiredButtonParameters: () => validateRequiredButtonParameters,
|
|
399
|
+
validateRequiredSelectMenuOptionParameters: () => validateRequiredSelectMenuOptionParameters,
|
|
400
|
+
validateRequiredSelectMenuParameters: () => validateRequiredSelectMenuParameters
|
|
401
|
+
});
|
|
402
|
+
var import_shapeshift2 = require("@sapphire/shapeshift");
|
|
403
|
+
var import_v10 = require("discord-api-types/v10");
|
|
404
|
+
|
|
405
|
+
// src/components/selectMenu/SelectMenuOption.ts
|
|
406
|
+
var SelectMenuOptionBuilder = class {
|
|
407
|
+
constructor(data = {}) {
|
|
408
|
+
this.data = data;
|
|
409
|
+
}
|
|
410
|
+
setLabel(label) {
|
|
411
|
+
this.data.label = labelValueDescriptionValidator.parse(label);
|
|
412
|
+
return this;
|
|
413
|
+
}
|
|
414
|
+
setValue(value) {
|
|
415
|
+
this.data.value = labelValueDescriptionValidator.parse(value);
|
|
416
|
+
return this;
|
|
417
|
+
}
|
|
418
|
+
setDescription(description) {
|
|
419
|
+
this.data.description = labelValueDescriptionValidator.parse(description);
|
|
420
|
+
return this;
|
|
421
|
+
}
|
|
422
|
+
setDefault(isDefault = true) {
|
|
423
|
+
this.data.default = defaultValidator.parse(isDefault);
|
|
424
|
+
return this;
|
|
425
|
+
}
|
|
426
|
+
setEmoji(emoji) {
|
|
427
|
+
this.data.emoji = emojiValidator.parse(emoji);
|
|
428
|
+
return this;
|
|
429
|
+
}
|
|
430
|
+
toJSON() {
|
|
431
|
+
validateRequiredSelectMenuOptionParameters(this.data.label, this.data.value);
|
|
432
|
+
return {
|
|
433
|
+
...this.data
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
__name(SelectMenuOptionBuilder, "SelectMenuOptionBuilder");
|
|
438
|
+
|
|
439
|
+
// src/components/Assertions.ts
|
|
440
|
+
var customIdValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
441
|
+
var emojiValidator = import_shapeshift2.s.object({
|
|
442
|
+
id: import_shapeshift2.s.string,
|
|
443
|
+
name: import_shapeshift2.s.string,
|
|
444
|
+
animated: import_shapeshift2.s.boolean
|
|
445
|
+
}).partial.strict.setValidationEnabled(isValidationEnabled);
|
|
446
|
+
var disabledValidator = import_shapeshift2.s.boolean;
|
|
447
|
+
var buttonLabelValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(80).setValidationEnabled(isValidationEnabled);
|
|
448
|
+
var buttonStyleValidator = import_shapeshift2.s.nativeEnum(import_v10.ButtonStyle);
|
|
449
|
+
var placeholderValidator = import_shapeshift2.s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);
|
|
450
|
+
var minMaxValidator = import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
451
|
+
var labelValueDescriptionValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
452
|
+
var jsonOptionValidator = import_shapeshift2.s.object({
|
|
453
|
+
label: labelValueDescriptionValidator,
|
|
454
|
+
value: labelValueDescriptionValidator,
|
|
455
|
+
description: labelValueDescriptionValidator.optional,
|
|
456
|
+
emoji: emojiValidator.optional,
|
|
457
|
+
default: import_shapeshift2.s.boolean.optional
|
|
458
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
459
|
+
var optionValidator = import_shapeshift2.s.instance(SelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);
|
|
460
|
+
var optionsValidator = optionValidator.array.lengthGreaterThanOrEqual(0).setValidationEnabled(isValidationEnabled);
|
|
461
|
+
var optionsLengthValidator = import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
462
|
+
function validateRequiredSelectMenuParameters(options, customId) {
|
|
463
|
+
customIdValidator.parse(customId);
|
|
464
|
+
optionsValidator.parse(options);
|
|
465
|
+
}
|
|
466
|
+
__name(validateRequiredSelectMenuParameters, "validateRequiredSelectMenuParameters");
|
|
467
|
+
var defaultValidator = import_shapeshift2.s.boolean;
|
|
468
|
+
function validateRequiredSelectMenuOptionParameters(label, value) {
|
|
469
|
+
labelValueDescriptionValidator.parse(label);
|
|
470
|
+
labelValueDescriptionValidator.parse(value);
|
|
471
|
+
}
|
|
472
|
+
__name(validateRequiredSelectMenuOptionParameters, "validateRequiredSelectMenuOptionParameters");
|
|
473
|
+
var urlValidator = import_shapeshift2.s.string.url({
|
|
474
|
+
allowedProtocols: ["http:", "https:", "discord:"]
|
|
475
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
476
|
+
function validateRequiredButtonParameters(style, label, emoji, customId, url) {
|
|
477
|
+
if (url && customId) {
|
|
478
|
+
throw new RangeError("URL and custom id are mutually exclusive");
|
|
479
|
+
}
|
|
480
|
+
if (!label && !emoji) {
|
|
481
|
+
throw new RangeError("Buttons must have a label and/or an emoji");
|
|
482
|
+
}
|
|
483
|
+
if (style === import_v10.ButtonStyle.Link) {
|
|
484
|
+
if (!url) {
|
|
485
|
+
throw new RangeError("Link buttons must have a url");
|
|
486
|
+
}
|
|
487
|
+
} else if (url) {
|
|
488
|
+
throw new RangeError("Non-link buttons cannot have a url");
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
__name(validateRequiredButtonParameters, "validateRequiredButtonParameters");
|
|
492
|
+
|
|
493
|
+
// src/components/ActionRow.ts
|
|
494
|
+
var import_v107 = require("discord-api-types/v10");
|
|
495
|
+
|
|
496
|
+
// src/components/Component.ts
|
|
497
|
+
var ComponentBuilder = class {
|
|
498
|
+
data;
|
|
499
|
+
constructor(data) {
|
|
500
|
+
this.data = data;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
__name(ComponentBuilder, "ComponentBuilder");
|
|
504
|
+
|
|
505
|
+
// src/components/Components.ts
|
|
506
|
+
var import_v106 = require("discord-api-types/v10");
|
|
507
|
+
|
|
508
|
+
// src/components/button/Button.ts
|
|
509
|
+
var import_v102 = require("discord-api-types/v10");
|
|
510
|
+
var ButtonBuilder = class extends ComponentBuilder {
|
|
511
|
+
constructor(data) {
|
|
512
|
+
super({ type: import_v102.ComponentType.Button, ...data });
|
|
513
|
+
}
|
|
514
|
+
setStyle(style) {
|
|
515
|
+
this.data.style = buttonStyleValidator.parse(style);
|
|
516
|
+
return this;
|
|
517
|
+
}
|
|
518
|
+
setURL(url) {
|
|
519
|
+
this.data.url = urlValidator.parse(url);
|
|
520
|
+
return this;
|
|
521
|
+
}
|
|
522
|
+
setCustomId(customId) {
|
|
523
|
+
this.data.custom_id = customIdValidator.parse(customId);
|
|
524
|
+
return this;
|
|
525
|
+
}
|
|
526
|
+
setEmoji(emoji) {
|
|
527
|
+
this.data.emoji = emojiValidator.parse(emoji);
|
|
528
|
+
return this;
|
|
529
|
+
}
|
|
530
|
+
setDisabled(disabled = true) {
|
|
531
|
+
this.data.disabled = disabledValidator.parse(disabled);
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
setLabel(label) {
|
|
535
|
+
this.data.label = buttonLabelValidator.parse(label);
|
|
536
|
+
return this;
|
|
537
|
+
}
|
|
538
|
+
toJSON() {
|
|
539
|
+
validateRequiredButtonParameters(
|
|
540
|
+
this.data.style,
|
|
541
|
+
this.data.label,
|
|
542
|
+
this.data.emoji,
|
|
543
|
+
this.data.custom_id,
|
|
544
|
+
this.data.url
|
|
545
|
+
);
|
|
546
|
+
return {
|
|
547
|
+
...this.data
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
__name(ButtonBuilder, "ButtonBuilder");
|
|
552
|
+
|
|
553
|
+
// src/components/selectMenu/SelectMenu.ts
|
|
554
|
+
var import_v103 = require("discord-api-types/v10");
|
|
555
|
+
var SelectMenuBuilder = class extends ComponentBuilder {
|
|
556
|
+
options;
|
|
557
|
+
constructor(data) {
|
|
558
|
+
const { options, ...initData } = data ?? {};
|
|
559
|
+
super({ type: import_v103.ComponentType.SelectMenu, ...initData });
|
|
560
|
+
this.options = options?.map((option) => new SelectMenuOptionBuilder(option)) ?? [];
|
|
561
|
+
}
|
|
562
|
+
setPlaceholder(placeholder) {
|
|
563
|
+
this.data.placeholder = placeholderValidator.parse(placeholder);
|
|
564
|
+
return this;
|
|
565
|
+
}
|
|
566
|
+
setMinValues(minValues) {
|
|
567
|
+
this.data.min_values = minMaxValidator.parse(minValues);
|
|
568
|
+
return this;
|
|
569
|
+
}
|
|
570
|
+
setMaxValues(maxValues) {
|
|
571
|
+
this.data.max_values = minMaxValidator.parse(maxValues);
|
|
572
|
+
return this;
|
|
573
|
+
}
|
|
574
|
+
setCustomId(customId) {
|
|
575
|
+
this.data.custom_id = customIdValidator.parse(customId);
|
|
576
|
+
return this;
|
|
577
|
+
}
|
|
578
|
+
setDisabled(disabled = true) {
|
|
579
|
+
this.data.disabled = disabledValidator.parse(disabled);
|
|
580
|
+
return this;
|
|
581
|
+
}
|
|
582
|
+
addOptions(...options) {
|
|
583
|
+
options = normalizeArray(options);
|
|
584
|
+
optionsLengthValidator.parse(this.options.length + options.length);
|
|
585
|
+
this.options.push(
|
|
586
|
+
...options.map(
|
|
587
|
+
(option) => option instanceof SelectMenuOptionBuilder ? option : new SelectMenuOptionBuilder(jsonOptionValidator.parse(option))
|
|
588
|
+
)
|
|
589
|
+
);
|
|
590
|
+
return this;
|
|
591
|
+
}
|
|
592
|
+
setOptions(...options) {
|
|
593
|
+
options = normalizeArray(options);
|
|
594
|
+
optionsLengthValidator.parse(options.length);
|
|
595
|
+
this.options.splice(
|
|
596
|
+
0,
|
|
597
|
+
this.options.length,
|
|
598
|
+
...options.map(
|
|
599
|
+
(option) => option instanceof SelectMenuOptionBuilder ? option : new SelectMenuOptionBuilder(jsonOptionValidator.parse(option))
|
|
600
|
+
)
|
|
601
|
+
);
|
|
602
|
+
return this;
|
|
603
|
+
}
|
|
604
|
+
toJSON() {
|
|
605
|
+
validateRequiredSelectMenuParameters(this.options, this.data.custom_id);
|
|
606
|
+
return {
|
|
607
|
+
...this.data,
|
|
608
|
+
options: this.options.map((option) => option.toJSON())
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
__name(SelectMenuBuilder, "SelectMenuBuilder");
|
|
613
|
+
|
|
614
|
+
// src/components/textInput/TextInput.ts
|
|
615
|
+
var import_v105 = require("discord-api-types/v10");
|
|
616
|
+
var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
|
|
617
|
+
|
|
618
|
+
// src/util/jsonEncodable.ts
|
|
619
|
+
function isJSONEncodable(maybeEncodable) {
|
|
620
|
+
return maybeEncodable !== null && typeof maybeEncodable === "object" && "toJSON" in maybeEncodable;
|
|
621
|
+
}
|
|
622
|
+
__name(isJSONEncodable, "isJSONEncodable");
|
|
623
|
+
|
|
624
|
+
// src/components/textInput/Assertions.ts
|
|
625
|
+
var Assertions_exports3 = {};
|
|
626
|
+
__export(Assertions_exports3, {
|
|
627
|
+
labelValidator: () => labelValidator,
|
|
628
|
+
maxLengthValidator: () => maxLengthValidator,
|
|
629
|
+
minLengthValidator: () => minLengthValidator,
|
|
630
|
+
placeholderValidator: () => placeholderValidator2,
|
|
631
|
+
requiredValidator: () => requiredValidator,
|
|
632
|
+
textInputStyleValidator: () => textInputStyleValidator,
|
|
633
|
+
validateRequiredParameters: () => validateRequiredParameters,
|
|
634
|
+
valueValidator: () => valueValidator
|
|
635
|
+
});
|
|
636
|
+
var import_shapeshift3 = require("@sapphire/shapeshift");
|
|
637
|
+
var import_v104 = require("discord-api-types/v10");
|
|
638
|
+
var textInputStyleValidator = import_shapeshift3.s.nativeEnum(import_v104.TextInputStyle);
|
|
639
|
+
var minLengthValidator = import_shapeshift3.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
640
|
+
var maxLengthValidator = import_shapeshift3.s.number.int.greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
641
|
+
var requiredValidator = import_shapeshift3.s.boolean;
|
|
642
|
+
var valueValidator = import_shapeshift3.s.string.lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
643
|
+
var placeholderValidator2 = import_shapeshift3.s.string.lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
644
|
+
var labelValidator = import_shapeshift3.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
645
|
+
function validateRequiredParameters(customId, style, label) {
|
|
646
|
+
customIdValidator.parse(customId);
|
|
647
|
+
textInputStyleValidator.parse(style);
|
|
648
|
+
labelValidator.parse(label);
|
|
649
|
+
}
|
|
650
|
+
__name(validateRequiredParameters, "validateRequiredParameters");
|
|
651
|
+
|
|
652
|
+
// src/components/textInput/TextInput.ts
|
|
653
|
+
var TextInputBuilder = class extends ComponentBuilder {
|
|
654
|
+
constructor(data) {
|
|
655
|
+
super({ type: import_v105.ComponentType.TextInput, ...data });
|
|
656
|
+
}
|
|
657
|
+
setCustomId(customId) {
|
|
658
|
+
this.data.custom_id = customIdValidator.parse(customId);
|
|
659
|
+
return this;
|
|
660
|
+
}
|
|
661
|
+
setLabel(label) {
|
|
662
|
+
this.data.label = labelValidator.parse(label);
|
|
663
|
+
return this;
|
|
664
|
+
}
|
|
665
|
+
setStyle(style) {
|
|
666
|
+
this.data.style = textInputStyleValidator.parse(style);
|
|
667
|
+
return this;
|
|
668
|
+
}
|
|
669
|
+
setMinLength(minLength) {
|
|
670
|
+
this.data.min_length = minLengthValidator.parse(minLength);
|
|
671
|
+
return this;
|
|
672
|
+
}
|
|
673
|
+
setMaxLength(maxLength) {
|
|
674
|
+
this.data.max_length = maxLengthValidator.parse(maxLength);
|
|
675
|
+
return this;
|
|
676
|
+
}
|
|
677
|
+
setPlaceholder(placeholder) {
|
|
678
|
+
this.data.placeholder = placeholderValidator2.parse(placeholder);
|
|
679
|
+
return this;
|
|
680
|
+
}
|
|
681
|
+
setValue(value) {
|
|
682
|
+
this.data.value = valueValidator.parse(value);
|
|
683
|
+
return this;
|
|
684
|
+
}
|
|
685
|
+
setRequired(required = true) {
|
|
686
|
+
this.data.required = requiredValidator.parse(required);
|
|
687
|
+
return this;
|
|
688
|
+
}
|
|
689
|
+
toJSON() {
|
|
690
|
+
validateRequiredParameters(this.data.custom_id, this.data.style, this.data.label);
|
|
691
|
+
return {
|
|
692
|
+
...this.data
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
equals(other) {
|
|
696
|
+
if (isJSONEncodable(other)) {
|
|
697
|
+
return (0, import_fast_deep_equal.default)(other.toJSON(), this.data);
|
|
698
|
+
}
|
|
699
|
+
return (0, import_fast_deep_equal.default)(other, this.data);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
__name(TextInputBuilder, "TextInputBuilder");
|
|
703
|
+
|
|
704
|
+
// src/components/Components.ts
|
|
705
|
+
function createComponentBuilder(data) {
|
|
706
|
+
if (data instanceof ComponentBuilder) {
|
|
707
|
+
return data;
|
|
708
|
+
}
|
|
709
|
+
switch (data.type) {
|
|
710
|
+
case import_v106.ComponentType.ActionRow:
|
|
711
|
+
return new ActionRowBuilder(data);
|
|
712
|
+
case import_v106.ComponentType.Button:
|
|
713
|
+
return new ButtonBuilder(data);
|
|
714
|
+
case import_v106.ComponentType.SelectMenu:
|
|
715
|
+
return new SelectMenuBuilder(data);
|
|
716
|
+
case import_v106.ComponentType.TextInput:
|
|
717
|
+
return new TextInputBuilder(data);
|
|
718
|
+
default:
|
|
719
|
+
throw new Error(`Cannot properly serialize component type: ${data.type}`);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
__name(createComponentBuilder, "createComponentBuilder");
|
|
723
|
+
|
|
724
|
+
// src/components/ActionRow.ts
|
|
725
|
+
var ActionRowBuilder = class extends ComponentBuilder {
|
|
726
|
+
components;
|
|
727
|
+
constructor({ components, ...data } = {}) {
|
|
728
|
+
super({ type: import_v107.ComponentType.ActionRow, ...data });
|
|
729
|
+
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
730
|
+
}
|
|
731
|
+
addComponents(...components) {
|
|
732
|
+
this.components.push(...normalizeArray(components));
|
|
733
|
+
return this;
|
|
734
|
+
}
|
|
735
|
+
setComponents(...components) {
|
|
736
|
+
this.components.splice(0, this.components.length, ...normalizeArray(components));
|
|
737
|
+
return this;
|
|
738
|
+
}
|
|
739
|
+
toJSON() {
|
|
740
|
+
return {
|
|
741
|
+
...this.data,
|
|
742
|
+
components: this.components.map((component) => component.toJSON())
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
__name(ActionRowBuilder, "ActionRowBuilder");
|
|
747
|
+
|
|
748
|
+
// src/interactions/modals/Assertions.ts
|
|
749
|
+
var Assertions_exports4 = {};
|
|
750
|
+
__export(Assertions_exports4, {
|
|
751
|
+
componentsValidator: () => componentsValidator,
|
|
752
|
+
titleValidator: () => titleValidator,
|
|
753
|
+
validateRequiredParameters: () => validateRequiredParameters2
|
|
754
|
+
});
|
|
755
|
+
var import_shapeshift4 = require("@sapphire/shapeshift");
|
|
756
|
+
var titleValidator = import_shapeshift4.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
757
|
+
var componentsValidator = import_shapeshift4.s.instance(ActionRowBuilder).array.lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);
|
|
758
|
+
function validateRequiredParameters2(customId, title, components) {
|
|
759
|
+
customIdValidator.parse(customId);
|
|
760
|
+
titleValidator.parse(title);
|
|
761
|
+
componentsValidator.parse(components);
|
|
762
|
+
}
|
|
763
|
+
__name(validateRequiredParameters2, "validateRequiredParameters");
|
|
764
|
+
|
|
765
|
+
// src/interactions/modals/Modal.ts
|
|
766
|
+
var ModalBuilder = class {
|
|
767
|
+
data;
|
|
768
|
+
components = [];
|
|
769
|
+
constructor({ components, ...data } = {}) {
|
|
770
|
+
this.data = { ...data };
|
|
771
|
+
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
772
|
+
}
|
|
773
|
+
setTitle(title) {
|
|
774
|
+
this.data.title = titleValidator.parse(title);
|
|
775
|
+
return this;
|
|
776
|
+
}
|
|
777
|
+
setCustomId(customId) {
|
|
778
|
+
this.data.custom_id = customIdValidator.parse(customId);
|
|
779
|
+
return this;
|
|
780
|
+
}
|
|
781
|
+
addComponents(...components) {
|
|
782
|
+
this.components.push(
|
|
783
|
+
...normalizeArray(components).map(
|
|
784
|
+
(component) => component instanceof ActionRowBuilder ? component : new ActionRowBuilder(component)
|
|
785
|
+
)
|
|
786
|
+
);
|
|
787
|
+
return this;
|
|
788
|
+
}
|
|
789
|
+
setComponents(...components) {
|
|
790
|
+
this.components.splice(0, this.components.length, ...normalizeArray(components));
|
|
791
|
+
return this;
|
|
792
|
+
}
|
|
793
|
+
toJSON() {
|
|
794
|
+
validateRequiredParameters2(this.data.custom_id, this.data.title, this.components);
|
|
795
|
+
return {
|
|
796
|
+
...this.data,
|
|
797
|
+
components: this.components.map((component) => component.toJSON())
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
__name(ModalBuilder, "ModalBuilder");
|
|
802
|
+
|
|
803
|
+
// src/interactions/slashCommands/Assertions.ts
|
|
804
|
+
var Assertions_exports5 = {};
|
|
805
|
+
__export(Assertions_exports5, {
|
|
806
|
+
assertReturnOfBuilder: () => assertReturnOfBuilder,
|
|
807
|
+
localizationMapPredicate: () => localizationMapPredicate,
|
|
808
|
+
validateChoicesLength: () => validateChoicesLength,
|
|
809
|
+
validateDMPermission: () => validateDMPermission,
|
|
810
|
+
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions,
|
|
811
|
+
validateDefaultPermission: () => validateDefaultPermission,
|
|
812
|
+
validateDescription: () => validateDescription,
|
|
813
|
+
validateLocale: () => validateLocale,
|
|
814
|
+
validateLocalizationMap: () => validateLocalizationMap,
|
|
815
|
+
validateMaxOptionsLength: () => validateMaxOptionsLength,
|
|
816
|
+
validateName: () => validateName,
|
|
817
|
+
validateRequired: () => validateRequired,
|
|
818
|
+
validateRequiredParameters: () => validateRequiredParameters3
|
|
819
|
+
});
|
|
820
|
+
var import_shapeshift5 = require("@sapphire/shapeshift");
|
|
821
|
+
var import_v108 = require("discord-api-types/v10");
|
|
822
|
+
var namePredicate = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled);
|
|
823
|
+
function validateName(name) {
|
|
824
|
+
namePredicate.parse(name);
|
|
825
|
+
}
|
|
826
|
+
__name(validateName, "validateName");
|
|
827
|
+
var descriptionPredicate2 = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
828
|
+
var localePredicate = import_shapeshift5.s.nativeEnum(import_v108.Locale);
|
|
829
|
+
function validateDescription(description) {
|
|
830
|
+
descriptionPredicate2.parse(description);
|
|
831
|
+
}
|
|
832
|
+
__name(validateDescription, "validateDescription");
|
|
833
|
+
var maxArrayLengthPredicate = import_shapeshift5.s.unknown.array.lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
834
|
+
function validateLocale(locale) {
|
|
835
|
+
return localePredicate.parse(locale);
|
|
836
|
+
}
|
|
837
|
+
__name(validateLocale, "validateLocale");
|
|
838
|
+
function validateMaxOptionsLength(options) {
|
|
839
|
+
maxArrayLengthPredicate.parse(options);
|
|
840
|
+
}
|
|
841
|
+
__name(validateMaxOptionsLength, "validateMaxOptionsLength");
|
|
842
|
+
function validateRequiredParameters3(name, description, options) {
|
|
843
|
+
validateName(name);
|
|
844
|
+
validateDescription(description);
|
|
845
|
+
validateMaxOptionsLength(options);
|
|
846
|
+
}
|
|
847
|
+
__name(validateRequiredParameters3, "validateRequiredParameters");
|
|
848
|
+
var booleanPredicate = import_shapeshift5.s.boolean;
|
|
849
|
+
function validateDefaultPermission(value) {
|
|
850
|
+
booleanPredicate.parse(value);
|
|
851
|
+
}
|
|
852
|
+
__name(validateDefaultPermission, "validateDefaultPermission");
|
|
853
|
+
function validateRequired(required) {
|
|
854
|
+
booleanPredicate.parse(required);
|
|
855
|
+
}
|
|
856
|
+
__name(validateRequired, "validateRequired");
|
|
857
|
+
var choicesLengthPredicate = import_shapeshift5.s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
858
|
+
function validateChoicesLength(amountAdding, choices) {
|
|
859
|
+
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
|
860
|
+
}
|
|
861
|
+
__name(validateChoicesLength, "validateChoicesLength");
|
|
862
|
+
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
863
|
+
import_shapeshift5.s.instance(ExpectedInstanceOf).parse(input);
|
|
864
|
+
}
|
|
865
|
+
__name(assertReturnOfBuilder, "assertReturnOfBuilder");
|
|
866
|
+
var localizationMapPredicate = import_shapeshift5.s.object(Object.fromEntries(Object.values(import_v108.Locale).map((locale) => [locale, import_shapeshift5.s.string.nullish]))).strict.nullish.setValidationEnabled(isValidationEnabled);
|
|
867
|
+
function validateLocalizationMap(value) {
|
|
868
|
+
localizationMapPredicate.parse(value);
|
|
869
|
+
}
|
|
870
|
+
__name(validateLocalizationMap, "validateLocalizationMap");
|
|
871
|
+
var dmPermissionPredicate = import_shapeshift5.s.boolean.nullish;
|
|
872
|
+
function validateDMPermission(value) {
|
|
873
|
+
dmPermissionPredicate.parse(value);
|
|
874
|
+
}
|
|
875
|
+
__name(validateDMPermission, "validateDMPermission");
|
|
876
|
+
var memberPermissionPredicate = import_shapeshift5.s.union(
|
|
877
|
+
import_shapeshift5.s.bigint.transform((value) => value.toString()),
|
|
878
|
+
import_shapeshift5.s.number.safeInt.transform((value) => value.toString()),
|
|
879
|
+
import_shapeshift5.s.string.regex(/^\d+$/)
|
|
880
|
+
).nullish;
|
|
881
|
+
function validateDefaultMemberPermissions(permissions) {
|
|
882
|
+
return memberPermissionPredicate.parse(permissions);
|
|
883
|
+
}
|
|
884
|
+
__name(validateDefaultMemberPermissions, "validateDefaultMemberPermissions");
|
|
885
|
+
|
|
886
|
+
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
887
|
+
var import_ts_mixer6 = require("ts-mixer");
|
|
888
|
+
|
|
889
|
+
// src/interactions/slashCommands/SlashCommandSubcommands.ts
|
|
890
|
+
var import_v1020 = require("discord-api-types/v10");
|
|
891
|
+
var import_ts_mixer5 = require("ts-mixer");
|
|
892
|
+
|
|
893
|
+
// src/interactions/slashCommands/mixins/NameAndDescription.ts
|
|
894
|
+
var SharedNameAndDescription = class {
|
|
895
|
+
name;
|
|
896
|
+
name_localizations;
|
|
897
|
+
description;
|
|
898
|
+
description_localizations;
|
|
899
|
+
setName(name) {
|
|
900
|
+
validateName(name);
|
|
901
|
+
Reflect.set(this, "name", name);
|
|
902
|
+
return this;
|
|
903
|
+
}
|
|
904
|
+
setDescription(description) {
|
|
905
|
+
validateDescription(description);
|
|
906
|
+
Reflect.set(this, "description", description);
|
|
907
|
+
return this;
|
|
908
|
+
}
|
|
909
|
+
setNameLocalization(locale, localizedName) {
|
|
910
|
+
if (!this.name_localizations) {
|
|
911
|
+
Reflect.set(this, "name_localizations", {});
|
|
912
|
+
}
|
|
913
|
+
const parsedLocale = validateLocale(locale);
|
|
914
|
+
if (localizedName === null) {
|
|
915
|
+
this.name_localizations[parsedLocale] = null;
|
|
916
|
+
return this;
|
|
917
|
+
}
|
|
918
|
+
validateName(localizedName);
|
|
919
|
+
this.name_localizations[parsedLocale] = localizedName;
|
|
920
|
+
return this;
|
|
921
|
+
}
|
|
922
|
+
setNameLocalizations(localizedNames) {
|
|
923
|
+
if (localizedNames === null) {
|
|
924
|
+
Reflect.set(this, "name_localizations", null);
|
|
925
|
+
return this;
|
|
926
|
+
}
|
|
927
|
+
Reflect.set(this, "name_localizations", {});
|
|
928
|
+
for (const args of Object.entries(localizedNames)) {
|
|
929
|
+
this.setNameLocalization(...args);
|
|
930
|
+
}
|
|
931
|
+
return this;
|
|
932
|
+
}
|
|
933
|
+
setDescriptionLocalization(locale, localizedDescription) {
|
|
934
|
+
if (!this.description_localizations) {
|
|
935
|
+
Reflect.set(this, "description_localizations", {});
|
|
936
|
+
}
|
|
937
|
+
const parsedLocale = validateLocale(locale);
|
|
938
|
+
if (localizedDescription === null) {
|
|
939
|
+
this.description_localizations[parsedLocale] = null;
|
|
940
|
+
return this;
|
|
941
|
+
}
|
|
942
|
+
validateDescription(localizedDescription);
|
|
943
|
+
this.description_localizations[parsedLocale] = localizedDescription;
|
|
944
|
+
return this;
|
|
945
|
+
}
|
|
946
|
+
setDescriptionLocalizations(localizedDescriptions) {
|
|
947
|
+
if (localizedDescriptions === null) {
|
|
948
|
+
Reflect.set(this, "description_localizations", null);
|
|
949
|
+
return this;
|
|
950
|
+
}
|
|
951
|
+
Reflect.set(this, "description_localizations", {});
|
|
952
|
+
for (const args of Object.entries(localizedDescriptions)) {
|
|
953
|
+
this.setDescriptionLocalization(...args);
|
|
954
|
+
}
|
|
955
|
+
return this;
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
__name(SharedNameAndDescription, "SharedNameAndDescription");
|
|
959
|
+
|
|
960
|
+
// src/interactions/slashCommands/options/attachment.ts
|
|
961
|
+
var import_v109 = require("discord-api-types/v10");
|
|
962
|
+
|
|
963
|
+
// src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts
|
|
964
|
+
var ApplicationCommandOptionBase = class extends SharedNameAndDescription {
|
|
965
|
+
required = false;
|
|
966
|
+
setRequired(required) {
|
|
967
|
+
validateRequired(required);
|
|
968
|
+
Reflect.set(this, "required", required);
|
|
969
|
+
return this;
|
|
970
|
+
}
|
|
971
|
+
runRequiredValidations() {
|
|
972
|
+
validateRequiredParameters3(this.name, this.description, []);
|
|
973
|
+
validateLocalizationMap(this.name_localizations);
|
|
974
|
+
validateLocalizationMap(this.description_localizations);
|
|
975
|
+
validateRequired(this.required);
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
__name(ApplicationCommandOptionBase, "ApplicationCommandOptionBase");
|
|
979
|
+
|
|
980
|
+
// src/interactions/slashCommands/options/attachment.ts
|
|
981
|
+
var SlashCommandAttachmentOption = class extends ApplicationCommandOptionBase {
|
|
982
|
+
type = import_v109.ApplicationCommandOptionType.Attachment;
|
|
983
|
+
toJSON() {
|
|
984
|
+
this.runRequiredValidations();
|
|
985
|
+
return { ...this };
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
__name(SlashCommandAttachmentOption, "SlashCommandAttachmentOption");
|
|
989
|
+
|
|
990
|
+
// src/interactions/slashCommands/options/boolean.ts
|
|
991
|
+
var import_v1010 = require("discord-api-types/v10");
|
|
992
|
+
var SlashCommandBooleanOption = class extends ApplicationCommandOptionBase {
|
|
993
|
+
type = import_v1010.ApplicationCommandOptionType.Boolean;
|
|
994
|
+
toJSON() {
|
|
995
|
+
this.runRequiredValidations();
|
|
996
|
+
return { ...this };
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
__name(SlashCommandBooleanOption, "SlashCommandBooleanOption");
|
|
1000
|
+
|
|
1001
|
+
// src/interactions/slashCommands/options/channel.ts
|
|
1002
|
+
var import_v1012 = require("discord-api-types/v10");
|
|
1003
|
+
var import_ts_mixer = require("ts-mixer");
|
|
1004
|
+
|
|
1005
|
+
// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
|
|
1006
|
+
var import_shapeshift6 = require("@sapphire/shapeshift");
|
|
1007
|
+
var import_v1011 = require("discord-api-types/v10");
|
|
1008
|
+
var allowedChannelTypes = [
|
|
1009
|
+
import_v1011.ChannelType.GuildText,
|
|
1010
|
+
import_v1011.ChannelType.GuildVoice,
|
|
1011
|
+
import_v1011.ChannelType.GuildCategory,
|
|
1012
|
+
import_v1011.ChannelType.GuildNews,
|
|
1013
|
+
import_v1011.ChannelType.GuildNewsThread,
|
|
1014
|
+
import_v1011.ChannelType.GuildPublicThread,
|
|
1015
|
+
import_v1011.ChannelType.GuildPrivateThread,
|
|
1016
|
+
import_v1011.ChannelType.GuildStageVoice
|
|
1017
|
+
];
|
|
1018
|
+
var channelTypesPredicate = import_shapeshift6.s.array(import_shapeshift6.s.union(...allowedChannelTypes.map((type) => import_shapeshift6.s.literal(type))));
|
|
1019
|
+
var ApplicationCommandOptionChannelTypesMixin = class {
|
|
1020
|
+
channel_types;
|
|
1021
|
+
addChannelTypes(...channelTypes) {
|
|
1022
|
+
if (this.channel_types === void 0) {
|
|
1023
|
+
Reflect.set(this, "channel_types", []);
|
|
1024
|
+
}
|
|
1025
|
+
this.channel_types.push(...channelTypesPredicate.parse(channelTypes));
|
|
1026
|
+
return this;
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
__name(ApplicationCommandOptionChannelTypesMixin, "ApplicationCommandOptionChannelTypesMixin");
|
|
1030
|
+
|
|
1031
|
+
// src/interactions/slashCommands/options/channel.ts
|
|
1032
|
+
var SlashCommandChannelOption = class extends ApplicationCommandOptionBase {
|
|
1033
|
+
type = import_v1012.ApplicationCommandOptionType.Channel;
|
|
1034
|
+
toJSON() {
|
|
1035
|
+
this.runRequiredValidations();
|
|
1036
|
+
return { ...this };
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
__name(SlashCommandChannelOption, "SlashCommandChannelOption");
|
|
1040
|
+
SlashCommandChannelOption = __decorateClass([
|
|
1041
|
+
(0, import_ts_mixer.mix)(ApplicationCommandOptionChannelTypesMixin)
|
|
1042
|
+
], SlashCommandChannelOption);
|
|
1043
|
+
|
|
1044
|
+
// src/interactions/slashCommands/options/integer.ts
|
|
1045
|
+
var import_shapeshift8 = require("@sapphire/shapeshift");
|
|
1046
|
+
var import_v1014 = require("discord-api-types/v10");
|
|
1047
|
+
var import_ts_mixer2 = require("ts-mixer");
|
|
1048
|
+
|
|
1049
|
+
// src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts
|
|
1050
|
+
var ApplicationCommandNumericOptionMinMaxValueMixin = class {
|
|
1051
|
+
max_value;
|
|
1052
|
+
min_value;
|
|
1053
|
+
};
|
|
1054
|
+
__name(ApplicationCommandNumericOptionMinMaxValueMixin, "ApplicationCommandNumericOptionMinMaxValueMixin");
|
|
1055
|
+
|
|
1056
|
+
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts
|
|
1057
|
+
var import_shapeshift7 = require("@sapphire/shapeshift");
|
|
1058
|
+
var import_v1013 = require("discord-api-types/v10");
|
|
1059
|
+
var stringPredicate = import_shapeshift7.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
1060
|
+
var numberPredicate = import_shapeshift7.s.number.greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);
|
|
1061
|
+
var choicesPredicate = import_shapeshift7.s.object({
|
|
1062
|
+
name: stringPredicate,
|
|
1063
|
+
name_localizations: localizationMapPredicate,
|
|
1064
|
+
value: import_shapeshift7.s.union(stringPredicate, numberPredicate)
|
|
1065
|
+
}).array;
|
|
1066
|
+
var booleanPredicate2 = import_shapeshift7.s.boolean;
|
|
1067
|
+
var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class {
|
|
1068
|
+
choices;
|
|
1069
|
+
autocomplete;
|
|
1070
|
+
type;
|
|
1071
|
+
addChoices(...choices) {
|
|
1072
|
+
if (choices.length > 0 && this.autocomplete) {
|
|
1073
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
1074
|
+
}
|
|
1075
|
+
choicesPredicate.parse(choices);
|
|
1076
|
+
if (this.choices === void 0) {
|
|
1077
|
+
Reflect.set(this, "choices", []);
|
|
1078
|
+
}
|
|
1079
|
+
validateChoicesLength(choices.length, this.choices);
|
|
1080
|
+
for (const { name, name_localizations, value } of choices) {
|
|
1081
|
+
if (this.type === import_v1013.ApplicationCommandOptionType.String) {
|
|
1082
|
+
stringPredicate.parse(value);
|
|
1083
|
+
} else {
|
|
1084
|
+
numberPredicate.parse(value);
|
|
1085
|
+
}
|
|
1086
|
+
this.choices.push({ name, name_localizations, value });
|
|
1087
|
+
}
|
|
1088
|
+
return this;
|
|
1089
|
+
}
|
|
1090
|
+
setChoices(...choices) {
|
|
1091
|
+
if (choices.length > 0 && this.autocomplete) {
|
|
1092
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
1093
|
+
}
|
|
1094
|
+
choicesPredicate.parse(choices);
|
|
1095
|
+
Reflect.set(this, "choices", []);
|
|
1096
|
+
this.addChoices(...choices);
|
|
1097
|
+
return this;
|
|
1098
|
+
}
|
|
1099
|
+
setAutocomplete(autocomplete) {
|
|
1100
|
+
booleanPredicate2.parse(autocomplete);
|
|
1101
|
+
if (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {
|
|
1102
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
1103
|
+
}
|
|
1104
|
+
Reflect.set(this, "autocomplete", autocomplete);
|
|
1105
|
+
return this;
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
__name(ApplicationCommandOptionWithChoicesAndAutocompleteMixin, "ApplicationCommandOptionWithChoicesAndAutocompleteMixin");
|
|
1109
|
+
|
|
1110
|
+
// src/interactions/slashCommands/options/integer.ts
|
|
1111
|
+
var numberValidator = import_shapeshift8.s.number.int;
|
|
1112
|
+
var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase {
|
|
1113
|
+
type = import_v1014.ApplicationCommandOptionType.Integer;
|
|
1114
|
+
setMaxValue(max) {
|
|
1115
|
+
numberValidator.parse(max);
|
|
1116
|
+
Reflect.set(this, "max_value", max);
|
|
1117
|
+
return this;
|
|
1118
|
+
}
|
|
1119
|
+
setMinValue(min) {
|
|
1120
|
+
numberValidator.parse(min);
|
|
1121
|
+
Reflect.set(this, "min_value", min);
|
|
1122
|
+
return this;
|
|
1123
|
+
}
|
|
1124
|
+
toJSON() {
|
|
1125
|
+
this.runRequiredValidations();
|
|
1126
|
+
if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {
|
|
1127
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
1128
|
+
}
|
|
1129
|
+
return { ...this };
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
__name(SlashCommandIntegerOption, "SlashCommandIntegerOption");
|
|
1133
|
+
SlashCommandIntegerOption = __decorateClass([
|
|
1134
|
+
(0, import_ts_mixer2.mix)(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin)
|
|
1135
|
+
], SlashCommandIntegerOption);
|
|
1136
|
+
|
|
1137
|
+
// src/interactions/slashCommands/options/mentionable.ts
|
|
1138
|
+
var import_v1015 = require("discord-api-types/v10");
|
|
1139
|
+
var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
1140
|
+
type = import_v1015.ApplicationCommandOptionType.Mentionable;
|
|
1141
|
+
toJSON() {
|
|
1142
|
+
this.runRequiredValidations();
|
|
1143
|
+
return { ...this };
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
__name(SlashCommandMentionableOption, "SlashCommandMentionableOption");
|
|
1147
|
+
|
|
1148
|
+
// src/interactions/slashCommands/options/number.ts
|
|
1149
|
+
var import_shapeshift9 = require("@sapphire/shapeshift");
|
|
1150
|
+
var import_v1016 = require("discord-api-types/v10");
|
|
1151
|
+
var import_ts_mixer3 = require("ts-mixer");
|
|
1152
|
+
var numberValidator2 = import_shapeshift9.s.number;
|
|
1153
|
+
var SlashCommandNumberOption = class extends ApplicationCommandOptionBase {
|
|
1154
|
+
type = import_v1016.ApplicationCommandOptionType.Number;
|
|
1155
|
+
setMaxValue(max) {
|
|
1156
|
+
numberValidator2.parse(max);
|
|
1157
|
+
Reflect.set(this, "max_value", max);
|
|
1158
|
+
return this;
|
|
1159
|
+
}
|
|
1160
|
+
setMinValue(min) {
|
|
1161
|
+
numberValidator2.parse(min);
|
|
1162
|
+
Reflect.set(this, "min_value", min);
|
|
1163
|
+
return this;
|
|
1164
|
+
}
|
|
1165
|
+
toJSON() {
|
|
1166
|
+
this.runRequiredValidations();
|
|
1167
|
+
if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {
|
|
1168
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
1169
|
+
}
|
|
1170
|
+
return { ...this };
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
__name(SlashCommandNumberOption, "SlashCommandNumberOption");
|
|
1174
|
+
SlashCommandNumberOption = __decorateClass([
|
|
1175
|
+
(0, import_ts_mixer3.mix)(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin)
|
|
1176
|
+
], SlashCommandNumberOption);
|
|
1177
|
+
|
|
1178
|
+
// src/interactions/slashCommands/options/role.ts
|
|
1179
|
+
var import_v1017 = require("discord-api-types/v10");
|
|
1180
|
+
var SlashCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
1181
|
+
type = import_v1017.ApplicationCommandOptionType.Role;
|
|
1182
|
+
toJSON() {
|
|
1183
|
+
this.runRequiredValidations();
|
|
1184
|
+
return { ...this };
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
__name(SlashCommandRoleOption, "SlashCommandRoleOption");
|
|
1188
|
+
|
|
1189
|
+
// src/interactions/slashCommands/options/string.ts
|
|
1190
|
+
var import_shapeshift10 = require("@sapphire/shapeshift");
|
|
1191
|
+
var import_v1018 = require("discord-api-types/v10");
|
|
1192
|
+
var import_ts_mixer4 = require("ts-mixer");
|
|
1193
|
+
var minLengthValidator2 = import_shapeshift10.s.number.greaterThanOrEqual(0).lessThanOrEqual(6e3);
|
|
1194
|
+
var maxLengthValidator2 = import_shapeshift10.s.number.greaterThanOrEqual(1).lessThanOrEqual(6e3);
|
|
1195
|
+
var SlashCommandStringOption = class extends ApplicationCommandOptionBase {
|
|
1196
|
+
type = import_v1018.ApplicationCommandOptionType.String;
|
|
1197
|
+
max_length;
|
|
1198
|
+
min_length;
|
|
1199
|
+
setMaxLength(max) {
|
|
1200
|
+
maxLengthValidator2.parse(max);
|
|
1201
|
+
Reflect.set(this, "max_length", max);
|
|
1202
|
+
return this;
|
|
1203
|
+
}
|
|
1204
|
+
setMinLength(min) {
|
|
1205
|
+
minLengthValidator2.parse(min);
|
|
1206
|
+
Reflect.set(this, "min_length", min);
|
|
1207
|
+
return this;
|
|
1208
|
+
}
|
|
1209
|
+
toJSON() {
|
|
1210
|
+
this.runRequiredValidations();
|
|
1211
|
+
if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {
|
|
1212
|
+
throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
|
|
1213
|
+
}
|
|
1214
|
+
return { ...this };
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
__name(SlashCommandStringOption, "SlashCommandStringOption");
|
|
1218
|
+
SlashCommandStringOption = __decorateClass([
|
|
1219
|
+
(0, import_ts_mixer4.mix)(ApplicationCommandOptionWithChoicesAndAutocompleteMixin)
|
|
1220
|
+
], SlashCommandStringOption);
|
|
1221
|
+
|
|
1222
|
+
// src/interactions/slashCommands/options/user.ts
|
|
1223
|
+
var import_v1019 = require("discord-api-types/v10");
|
|
1224
|
+
var SlashCommandUserOption = class extends ApplicationCommandOptionBase {
|
|
1225
|
+
type = import_v1019.ApplicationCommandOptionType.User;
|
|
1226
|
+
toJSON() {
|
|
1227
|
+
this.runRequiredValidations();
|
|
1228
|
+
return { ...this };
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
__name(SlashCommandUserOption, "SlashCommandUserOption");
|
|
1232
|
+
|
|
1233
|
+
// src/interactions/slashCommands/mixins/SharedSlashCommandOptions.ts
|
|
1234
|
+
var SharedSlashCommandOptions = class {
|
|
1235
|
+
options;
|
|
1236
|
+
addBooleanOption(input) {
|
|
1237
|
+
return this._sharedAddOptionMethod(input, SlashCommandBooleanOption);
|
|
1238
|
+
}
|
|
1239
|
+
addUserOption(input) {
|
|
1240
|
+
return this._sharedAddOptionMethod(input, SlashCommandUserOption);
|
|
1241
|
+
}
|
|
1242
|
+
addChannelOption(input) {
|
|
1243
|
+
return this._sharedAddOptionMethod(input, SlashCommandChannelOption);
|
|
1244
|
+
}
|
|
1245
|
+
addRoleOption(input) {
|
|
1246
|
+
return this._sharedAddOptionMethod(input, SlashCommandRoleOption);
|
|
1247
|
+
}
|
|
1248
|
+
addAttachmentOption(input) {
|
|
1249
|
+
return this._sharedAddOptionMethod(input, SlashCommandAttachmentOption);
|
|
1250
|
+
}
|
|
1251
|
+
addMentionableOption(input) {
|
|
1252
|
+
return this._sharedAddOptionMethod(input, SlashCommandMentionableOption);
|
|
1253
|
+
}
|
|
1254
|
+
addStringOption(input) {
|
|
1255
|
+
return this._sharedAddOptionMethod(input, SlashCommandStringOption);
|
|
1256
|
+
}
|
|
1257
|
+
addIntegerOption(input) {
|
|
1258
|
+
return this._sharedAddOptionMethod(input, SlashCommandIntegerOption);
|
|
1259
|
+
}
|
|
1260
|
+
addNumberOption(input) {
|
|
1261
|
+
return this._sharedAddOptionMethod(input, SlashCommandNumberOption);
|
|
1262
|
+
}
|
|
1263
|
+
_sharedAddOptionMethod(input, Instance) {
|
|
1264
|
+
const { options } = this;
|
|
1265
|
+
validateMaxOptionsLength(options);
|
|
1266
|
+
const result = typeof input === "function" ? input(new Instance()) : input;
|
|
1267
|
+
assertReturnOfBuilder(result, Instance);
|
|
1268
|
+
options.push(result);
|
|
1269
|
+
return this;
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
__name(SharedSlashCommandOptions, "SharedSlashCommandOptions");
|
|
1273
|
+
|
|
1274
|
+
// src/interactions/slashCommands/SlashCommandSubcommands.ts
|
|
1275
|
+
var SlashCommandSubcommandGroupBuilder = class {
|
|
1276
|
+
name = void 0;
|
|
1277
|
+
description = void 0;
|
|
1278
|
+
options = [];
|
|
1279
|
+
addSubcommand(input) {
|
|
1280
|
+
const { options } = this;
|
|
1281
|
+
validateMaxOptionsLength(options);
|
|
1282
|
+
const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input;
|
|
1283
|
+
assertReturnOfBuilder(result, SlashCommandSubcommandBuilder);
|
|
1284
|
+
options.push(result);
|
|
1285
|
+
return this;
|
|
1286
|
+
}
|
|
1287
|
+
toJSON() {
|
|
1288
|
+
validateRequiredParameters3(this.name, this.description, this.options);
|
|
1289
|
+
return {
|
|
1290
|
+
type: import_v1020.ApplicationCommandOptionType.SubcommandGroup,
|
|
1291
|
+
name: this.name,
|
|
1292
|
+
name_localizations: this.name_localizations,
|
|
1293
|
+
description: this.description,
|
|
1294
|
+
description_localizations: this.description_localizations,
|
|
1295
|
+
options: this.options.map((option) => option.toJSON())
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
__name(SlashCommandSubcommandGroupBuilder, "SlashCommandSubcommandGroupBuilder");
|
|
1300
|
+
SlashCommandSubcommandGroupBuilder = __decorateClass([
|
|
1301
|
+
(0, import_ts_mixer5.mix)(SharedNameAndDescription)
|
|
1302
|
+
], SlashCommandSubcommandGroupBuilder);
|
|
1303
|
+
var SlashCommandSubcommandBuilder = class {
|
|
1304
|
+
name = void 0;
|
|
1305
|
+
description = void 0;
|
|
1306
|
+
options = [];
|
|
1307
|
+
toJSON() {
|
|
1308
|
+
validateRequiredParameters3(this.name, this.description, this.options);
|
|
1309
|
+
return {
|
|
1310
|
+
type: import_v1020.ApplicationCommandOptionType.Subcommand,
|
|
1311
|
+
name: this.name,
|
|
1312
|
+
name_localizations: this.name_localizations,
|
|
1313
|
+
description: this.description,
|
|
1314
|
+
description_localizations: this.description_localizations,
|
|
1315
|
+
options: this.options.map((option) => option.toJSON())
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
__name(SlashCommandSubcommandBuilder, "SlashCommandSubcommandBuilder");
|
|
1320
|
+
SlashCommandSubcommandBuilder = __decorateClass([
|
|
1321
|
+
(0, import_ts_mixer5.mix)(SharedNameAndDescription, SharedSlashCommandOptions)
|
|
1322
|
+
], SlashCommandSubcommandBuilder);
|
|
1323
|
+
|
|
1324
|
+
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
1325
|
+
var SlashCommandBuilder = class {
|
|
1326
|
+
name = void 0;
|
|
1327
|
+
name_localizations;
|
|
1328
|
+
description = void 0;
|
|
1329
|
+
description_localizations;
|
|
1330
|
+
options = [];
|
|
1331
|
+
default_permission = void 0;
|
|
1332
|
+
default_member_permissions = void 0;
|
|
1333
|
+
dm_permission = void 0;
|
|
1334
|
+
toJSON() {
|
|
1335
|
+
validateRequiredParameters3(this.name, this.description, this.options);
|
|
1336
|
+
validateLocalizationMap(this.name_localizations);
|
|
1337
|
+
validateLocalizationMap(this.description_localizations);
|
|
1338
|
+
return {
|
|
1339
|
+
...this,
|
|
1340
|
+
options: this.options.map((option) => option.toJSON())
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
setDefaultPermission(value) {
|
|
1344
|
+
validateDefaultPermission(value);
|
|
1345
|
+
Reflect.set(this, "default_permission", value);
|
|
1346
|
+
return this;
|
|
1347
|
+
}
|
|
1348
|
+
setDefaultMemberPermissions(permissions) {
|
|
1349
|
+
const permissionValue = validateDefaultMemberPermissions(permissions);
|
|
1350
|
+
Reflect.set(this, "default_member_permissions", permissionValue);
|
|
1351
|
+
return this;
|
|
1352
|
+
}
|
|
1353
|
+
setDMPermission(enabled) {
|
|
1354
|
+
validateDMPermission(enabled);
|
|
1355
|
+
Reflect.set(this, "dm_permission", enabled);
|
|
1356
|
+
return this;
|
|
1357
|
+
}
|
|
1358
|
+
addSubcommandGroup(input) {
|
|
1359
|
+
const { options } = this;
|
|
1360
|
+
validateMaxOptionsLength(options);
|
|
1361
|
+
const result = typeof input === "function" ? input(new SlashCommandSubcommandGroupBuilder()) : input;
|
|
1362
|
+
assertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);
|
|
1363
|
+
options.push(result);
|
|
1364
|
+
return this;
|
|
1365
|
+
}
|
|
1366
|
+
addSubcommand(input) {
|
|
1367
|
+
const { options } = this;
|
|
1368
|
+
validateMaxOptionsLength(options);
|
|
1369
|
+
const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input;
|
|
1370
|
+
assertReturnOfBuilder(result, SlashCommandSubcommandBuilder);
|
|
1371
|
+
options.push(result);
|
|
1372
|
+
return this;
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
__name(SlashCommandBuilder, "SlashCommandBuilder");
|
|
1376
|
+
SlashCommandBuilder = __decorateClass([
|
|
1377
|
+
(0, import_ts_mixer6.mix)(SharedSlashCommandOptions, SharedNameAndDescription)
|
|
1378
|
+
], SlashCommandBuilder);
|
|
1379
|
+
|
|
1380
|
+
// src/interactions/contextMenuCommands/Assertions.ts
|
|
1381
|
+
var Assertions_exports6 = {};
|
|
1382
|
+
__export(Assertions_exports6, {
|
|
1383
|
+
validateDMPermission: () => validateDMPermission2,
|
|
1384
|
+
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions2,
|
|
1385
|
+
validateDefaultPermission: () => validateDefaultPermission2,
|
|
1386
|
+
validateName: () => validateName2,
|
|
1387
|
+
validateRequiredParameters: () => validateRequiredParameters4,
|
|
1388
|
+
validateType: () => validateType
|
|
1389
|
+
});
|
|
1390
|
+
var import_shapeshift11 = require("@sapphire/shapeshift");
|
|
1391
|
+
var import_v1021 = require("discord-api-types/v10");
|
|
1392
|
+
var namePredicate2 = import_shapeshift11.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^( *[\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+ *)+$/u).setValidationEnabled(isValidationEnabled);
|
|
1393
|
+
var typePredicate = import_shapeshift11.s.union(import_shapeshift11.s.literal(import_v1021.ApplicationCommandType.User), import_shapeshift11.s.literal(import_v1021.ApplicationCommandType.Message)).setValidationEnabled(isValidationEnabled);
|
|
1394
|
+
var booleanPredicate3 = import_shapeshift11.s.boolean;
|
|
1395
|
+
function validateDefaultPermission2(value) {
|
|
1396
|
+
booleanPredicate3.parse(value);
|
|
1397
|
+
}
|
|
1398
|
+
__name(validateDefaultPermission2, "validateDefaultPermission");
|
|
1399
|
+
function validateName2(name) {
|
|
1400
|
+
namePredicate2.parse(name);
|
|
1401
|
+
}
|
|
1402
|
+
__name(validateName2, "validateName");
|
|
1403
|
+
function validateType(type) {
|
|
1404
|
+
typePredicate.parse(type);
|
|
1405
|
+
}
|
|
1406
|
+
__name(validateType, "validateType");
|
|
1407
|
+
function validateRequiredParameters4(name, type) {
|
|
1408
|
+
validateName2(name);
|
|
1409
|
+
validateType(type);
|
|
1410
|
+
}
|
|
1411
|
+
__name(validateRequiredParameters4, "validateRequiredParameters");
|
|
1412
|
+
var dmPermissionPredicate2 = import_shapeshift11.s.boolean.nullish;
|
|
1413
|
+
function validateDMPermission2(value) {
|
|
1414
|
+
dmPermissionPredicate2.parse(value);
|
|
1415
|
+
}
|
|
1416
|
+
__name(validateDMPermission2, "validateDMPermission");
|
|
1417
|
+
var memberPermissionPredicate2 = import_shapeshift11.s.union(
|
|
1418
|
+
import_shapeshift11.s.bigint.transform((value) => value.toString()),
|
|
1419
|
+
import_shapeshift11.s.number.safeInt.transform((value) => value.toString()),
|
|
1420
|
+
import_shapeshift11.s.string.regex(/^\d+$/)
|
|
1421
|
+
).nullish;
|
|
1422
|
+
function validateDefaultMemberPermissions2(permissions) {
|
|
1423
|
+
return memberPermissionPredicate2.parse(permissions);
|
|
1424
|
+
}
|
|
1425
|
+
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions");
|
|
1426
|
+
|
|
1427
|
+
// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts
|
|
1428
|
+
var ContextMenuCommandBuilder = class {
|
|
1429
|
+
name = void 0;
|
|
1430
|
+
name_localizations;
|
|
1431
|
+
type = void 0;
|
|
1432
|
+
default_permission = void 0;
|
|
1433
|
+
default_member_permissions = void 0;
|
|
1434
|
+
dm_permission = void 0;
|
|
1435
|
+
setName(name) {
|
|
1436
|
+
validateName2(name);
|
|
1437
|
+
Reflect.set(this, "name", name);
|
|
1438
|
+
return this;
|
|
1439
|
+
}
|
|
1440
|
+
setType(type) {
|
|
1441
|
+
validateType(type);
|
|
1442
|
+
Reflect.set(this, "type", type);
|
|
1443
|
+
return this;
|
|
1444
|
+
}
|
|
1445
|
+
setDefaultPermission(value) {
|
|
1446
|
+
validateDefaultPermission2(value);
|
|
1447
|
+
Reflect.set(this, "default_permission", value);
|
|
1448
|
+
return this;
|
|
1449
|
+
}
|
|
1450
|
+
setDefaultMemberPermissions(permissions) {
|
|
1451
|
+
const permissionValue = validateDefaultMemberPermissions2(permissions);
|
|
1452
|
+
Reflect.set(this, "default_member_permissions", permissionValue);
|
|
1453
|
+
return this;
|
|
1454
|
+
}
|
|
1455
|
+
setDMPermission(enabled) {
|
|
1456
|
+
validateDMPermission2(enabled);
|
|
1457
|
+
Reflect.set(this, "dm_permission", enabled);
|
|
1458
|
+
return this;
|
|
1459
|
+
}
|
|
1460
|
+
setNameLocalization(locale, localizedName) {
|
|
1461
|
+
if (!this.name_localizations) {
|
|
1462
|
+
Reflect.set(this, "name_localizations", {});
|
|
1463
|
+
}
|
|
1464
|
+
const parsedLocale = validateLocale(locale);
|
|
1465
|
+
if (localizedName === null) {
|
|
1466
|
+
this.name_localizations[parsedLocale] = null;
|
|
1467
|
+
return this;
|
|
1468
|
+
}
|
|
1469
|
+
validateName2(localizedName);
|
|
1470
|
+
this.name_localizations[parsedLocale] = localizedName;
|
|
1471
|
+
return this;
|
|
1472
|
+
}
|
|
1473
|
+
setNameLocalizations(localizedNames) {
|
|
1474
|
+
if (localizedNames === null) {
|
|
1475
|
+
Reflect.set(this, "name_localizations", null);
|
|
1476
|
+
return this;
|
|
1477
|
+
}
|
|
1478
|
+
Reflect.set(this, "name_localizations", {});
|
|
1479
|
+
for (const args of Object.entries(localizedNames))
|
|
1480
|
+
this.setNameLocalization(...args);
|
|
1481
|
+
return this;
|
|
1482
|
+
}
|
|
1483
|
+
toJSON() {
|
|
1484
|
+
validateRequiredParameters4(this.name, this.type);
|
|
1485
|
+
validateLocalizationMap(this.name_localizations);
|
|
1486
|
+
return { ...this };
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
__name(ContextMenuCommandBuilder, "ContextMenuCommandBuilder");
|
|
1490
|
+
|
|
1491
|
+
// src/util/equatable.ts
|
|
1492
|
+
function isEquatable(maybeEquatable) {
|
|
1493
|
+
return maybeEquatable !== null && typeof maybeEquatable === "object" && "equals" in maybeEquatable;
|
|
1494
|
+
}
|
|
1495
|
+
__name(isEquatable, "isEquatable");
|
|
1496
|
+
|
|
1497
|
+
// src/util/componentUtil.ts
|
|
1498
|
+
function embedLength(data) {
|
|
1499
|
+
return (data.title?.length ?? 0) + (data.description?.length ?? 0) + (data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) + (data.footer?.text.length ?? 0) + (data.author?.name.length ?? 0);
|
|
1500
|
+
}
|
|
1501
|
+
__name(embedLength, "embedLength");
|
|
1502
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1503
|
+
0 && (module.exports = {
|
|
1504
|
+
ActionRowBuilder,
|
|
1505
|
+
ApplicationCommandNumericOptionMinMaxValueMixin,
|
|
1506
|
+
ApplicationCommandOptionBase,
|
|
1507
|
+
ApplicationCommandOptionChannelTypesMixin,
|
|
1508
|
+
ApplicationCommandOptionWithChoicesAndAutocompleteMixin,
|
|
1509
|
+
ButtonBuilder,
|
|
1510
|
+
ComponentAssertions,
|
|
1511
|
+
ComponentBuilder,
|
|
1512
|
+
ContextMenuCommandAssertions,
|
|
1513
|
+
ContextMenuCommandBuilder,
|
|
1514
|
+
EmbedAssertions,
|
|
1515
|
+
EmbedBuilder,
|
|
1516
|
+
Faces,
|
|
1517
|
+
ModalAssertions,
|
|
1518
|
+
ModalBuilder,
|
|
1519
|
+
SelectMenuBuilder,
|
|
1520
|
+
SelectMenuOptionBuilder,
|
|
1521
|
+
SharedNameAndDescription,
|
|
1522
|
+
SharedSlashCommandOptions,
|
|
1523
|
+
SlashCommandAssertions,
|
|
1524
|
+
SlashCommandAttachmentOption,
|
|
1525
|
+
SlashCommandBooleanOption,
|
|
1526
|
+
SlashCommandBuilder,
|
|
1527
|
+
SlashCommandChannelOption,
|
|
1528
|
+
SlashCommandIntegerOption,
|
|
1529
|
+
SlashCommandMentionableOption,
|
|
1530
|
+
SlashCommandNumberOption,
|
|
1531
|
+
SlashCommandRoleOption,
|
|
1532
|
+
SlashCommandStringOption,
|
|
1533
|
+
SlashCommandSubcommandBuilder,
|
|
1534
|
+
SlashCommandSubcommandGroupBuilder,
|
|
1535
|
+
SlashCommandUserOption,
|
|
1536
|
+
TextInputAssertions,
|
|
1537
|
+
TextInputBuilder,
|
|
1538
|
+
TimestampStyles,
|
|
1539
|
+
blockQuote,
|
|
1540
|
+
bold,
|
|
1541
|
+
channelLink,
|
|
1542
|
+
channelMention,
|
|
1543
|
+
chatInputApplicationCommandMention,
|
|
1544
|
+
codeBlock,
|
|
1545
|
+
createComponentBuilder,
|
|
1546
|
+
disableValidators,
|
|
1547
|
+
embedLength,
|
|
1548
|
+
enableValidators,
|
|
1549
|
+
formatEmoji,
|
|
1550
|
+
hideLinkEmbed,
|
|
1551
|
+
hyperlink,
|
|
1552
|
+
inlineCode,
|
|
1553
|
+
isEquatable,
|
|
1554
|
+
isJSONEncodable,
|
|
1555
|
+
isValidationEnabled,
|
|
1556
|
+
italic,
|
|
1557
|
+
messageLink,
|
|
1558
|
+
normalizeArray,
|
|
1559
|
+
quote,
|
|
1560
|
+
roleMention,
|
|
1561
|
+
spoiler,
|
|
1562
|
+
strikethrough,
|
|
1563
|
+
time,
|
|
1564
|
+
underscore,
|
|
1565
|
+
userMention
|
|
1566
|
+
});
|
|
1567
|
+
//# sourceMappingURL=index.js.map
|