trivious 1.6.16 → 1.6.18
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/core/client/trivious.client.d.ts +1 -1
- package/dist/core/commands/methods.command.d.ts +1 -1
- package/dist/core/commands/methods.command.js +18 -13
- package/dist/core/commands/methods.command.js.map +1 -1
- package/dist/core/events/clientReady.d.ts +1 -1
- package/dist/core/events/interactionCreate.d.ts +1 -1
- package/dist/core/events/interactionCreate.js +0 -1
- package/dist/core/events/interactionCreate.js.map +1 -1
- package/dist/core/registry/command.registry.d.ts +1 -1
- package/dist/core/registry/component.registry.d.ts +1 -1
- package/dist/core/registry/event.registry.d.ts +1 -1
- package/dist/core/registry/index.d.ts +1 -1
- package/dist/core/registry/module.registry.d.ts +1 -1
- package/dist/{index-ddJZHFmz.d.ts → index-DbWA_10I.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/shared/typings/commands.d.ts +1 -1
- package/dist/shared/typings/components.d.ts +1 -1
- package/dist/shared/typings/events.d.ts +1 -1
- package/dist/shared/typings/index.d.ts +1 -1
- package/dist/shared/typings/module.d.ts +1 -1
- package/dist/shared/utility/components.utility.d.ts +1 -1
- package/dist/shared/utility/functions.d.ts +1 -1
- package/dist/shared/utility/permissions.utility.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { p as handleSlashCommand, o as interactionReply, v as verifyGuildPermission } from '../../index-
|
|
2
|
+
export { p as handleSlashCommand, o as interactionReply, v as verifyGuildPermission } from '../../index-DbWA_10I.js';
|
|
3
3
|
import '../../shared/typings/permissions.js';
|
|
4
4
|
import '../../shared/typings/registry.js';
|
|
5
5
|
import '../../shared/typings/client.js';
|
|
@@ -8,11 +8,18 @@ async function interactionReply(data) {
|
|
|
8
8
|
}
|
|
9
9
|
const ephemeral = flags?.includes("EphemeralReply");
|
|
10
10
|
const followUp = flags?.includes("FollowUp");
|
|
11
|
-
|
|
11
|
+
let newOptions = options;
|
|
12
|
+
if (flags?.includes("ClearAll")) {
|
|
13
|
+
newOptions.files = [];
|
|
14
|
+
newOptions.embeds = [];
|
|
15
|
+
newOptions.components = [];
|
|
16
|
+
newOptions.content = "";
|
|
17
|
+
newOptions = options;
|
|
18
|
+
}
|
|
12
19
|
if (ephemeral) newOptions.flags = ["Ephemeral"];
|
|
13
20
|
if (interaction.replied || interaction.deferred) {
|
|
14
21
|
if (followUp) await interaction.followUp(newOptions);
|
|
15
|
-
else await interaction.editReply(
|
|
22
|
+
else await interaction.editReply(newOptions);
|
|
16
23
|
} else {
|
|
17
24
|
await interaction.reply(newOptions);
|
|
18
25
|
}
|
|
@@ -44,20 +51,18 @@ async function handleSlashCommand(client, command, interaction) {
|
|
|
44
51
|
command.permission || PermissionLevel.USER,
|
|
45
52
|
true
|
|
46
53
|
);
|
|
54
|
+
if (command.flags?.includes("DeferReply")) {
|
|
55
|
+
await interactionReply({
|
|
56
|
+
flags: command.flags,
|
|
57
|
+
interaction,
|
|
58
|
+
options: { content: "Processing command..." }
|
|
59
|
+
});
|
|
60
|
+
}
|
|
47
61
|
if ("run" in command && command.run && hasPerm) {
|
|
48
62
|
await command.run(client, interaction);
|
|
49
63
|
}
|
|
50
64
|
if (!hasPerm) return;
|
|
51
|
-
if (!options.getSubcommand(false) || !("subcommands" in command))
|
|
52
|
-
if (command.flags?.includes("DeferReply")) {
|
|
53
|
-
await interactionReply({
|
|
54
|
-
flags: command.flags,
|
|
55
|
-
interaction,
|
|
56
|
-
options: { content: "Processing command..." }
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
65
|
+
if (!options.getSubcommand(false) || !("subcommands" in command)) return;
|
|
61
66
|
const subcommandName = options.getSubcommand();
|
|
62
67
|
const subcommand = command.subcommands.get(subcommandName);
|
|
63
68
|
if (!subcommand) {
|
|
@@ -72,7 +77,7 @@ async function handleSlashCommand(client, command, interaction) {
|
|
|
72
77
|
}
|
|
73
78
|
if (subcommand.flags?.includes("DeferReply") && !subcommand.flags.includes("ModalResponse")) {
|
|
74
79
|
await interactionReply({
|
|
75
|
-
flags:
|
|
80
|
+
flags: subcommand.flags,
|
|
76
81
|
interaction,
|
|
77
82
|
options: { content: "Processing command..." }
|
|
78
83
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/commands/methods.command.ts"],"names":[],"mappings":";;;AA6BA,eAAsB,iBAAiB,IAAA,EAIpC;AACF,EAAA,MAAM,EAAE,WAAA,EAAa,KAAA,EAAO,OAAA,EAAQ,GAAI,IAAA;AACxC,EAAA,IAAI,EAAE,WAAW,WAAA,CAAA,EAAc;AAC9B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,iCAAA,EAAoC,OAAO,WAAW,CAAA,CAAE,CAAA;AAAA,EACzE;AAEA,EAAA,MAAM,SAAA,GAAY,KAAA,EAAO,QAAA,CAAS,gBAAgB,CAAA;AAClD,EAAA,MAAM,QAAA,GAAW,KAAA,EAAO,QAAA,CAAS,UAAU,CAAA;AAE3C,EAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/core/commands/methods.command.ts"],"names":[],"mappings":";;;AA6BA,eAAsB,iBAAiB,IAAA,EAIpC;AACF,EAAA,MAAM,EAAE,WAAA,EAAa,KAAA,EAAO,OAAA,EAAQ,GAAI,IAAA;AACxC,EAAA,IAAI,EAAE,WAAW,WAAA,CAAA,EAAc;AAC9B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,iCAAA,EAAoC,OAAO,WAAW,CAAA,CAAE,CAAA;AAAA,EACzE;AAEA,EAAA,MAAM,SAAA,GAAY,KAAA,EAAO,QAAA,CAAS,gBAAgB,CAAA;AAClD,EAAA,MAAM,QAAA,GAAW,KAAA,EAAO,QAAA,CAAS,UAAU,CAAA;AAE3C,EAAA,IAAI,UAAA,GAAa,OAAA;AACjB,EAAA,IAAI,KAAA,EAAO,QAAA,CAA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GA,EAAA,IAAI,UAAA,CAAW,KAAA,EAAO,QAAA,CAAS,YAAY,CAAA,IAAK,CAAC,UAAA,CAAW,KAAA,CAAM,QAAA,CAAS,eAAe,CAAA,EAAG;AAC5F,IAAA,MAAM,gBAAA,CAAiB;AAAA,MACtB,OAAO,UAAA,CAAW,KAAA;AAAA,MAClB,WAAA;AAAA,MACA,OAAA,EAAS,EAAE,OAAA,EAAS,uBAAA;AAAwB,KAC5C,CAAA;AAAA,EACF;AAEA,EAAA,MAAM,UAAA,CAAW,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAC7C","file":"methods.command.js","sourcesContent":["import {\n\tCacheType,\n\tChatInputCommandInteraction,\n\tGuildMember,\n\tInteraction,\n\tInteractionEditReplyOptions,\n\tInteractionReplyOptions,\n\tMessagePayload,\n} from \"discord.js\";\nimport {\n\tCommand,\n\tCommandFlags,\n\tPermissionLevel,\n\tSlashCommand,\n\tSlashSubcommand,\n\tTriviousClient,\n} from \"src/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\n\n/**\n * Reply to a command, respecting whether it has been deferred or already replied to.\n *\n * @export\n * @async\n * @param {Command} command\n * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction\n * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options\n * @returns {*}\n */\nexport async function interactionReply(data: {\n\tflags?: (\"ClearAll\" | \"FollowUp\" | CommandFlags)[];\n\tinteraction: Interaction<CacheType>;\n\toptions: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions;\n}) {\n\tconst { interaction, flags, options } = data;\n\tif (!(\"reply\" in interaction)) {\n\t\tthrow new Error(`Cannot reply to interaction type ${typeof interaction}`);\n\t}\n\n\tconst ephemeral = flags?.includes(\"EphemeralReply\");\n\tconst followUp = flags?.includes(\"FollowUp\");\n\n\tlet newOptions = options as InteractionReplyOptions;\n\tif (flags?.includes(\"ClearAll\")) {\n\t\tnewOptions.files = [];\n\t\tnewOptions.embeds = [];\n\t\tnewOptions.components = [];\n\t\tnewOptions.content = \"\";\n\n\t\tnewOptions = options as InteractionReplyOptions;\n\t}\n\n\tif (ephemeral) newOptions.flags = [\"Ephemeral\"];\n\tif (interaction.replied || interaction.deferred) {\n\t\tif (followUp) await interaction.followUp(newOptions);\n\t\telse await interaction.editReply(newOptions as InteractionEditReplyOptions);\n\t} else {\n\t\tawait interaction.reply(newOptions);\n\t}\n}\n\n/**\n * Compare a permission level to the guild member's permission level.\n *\n * @export\n * @async\n * @param {TriviousClient} client\n * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction\n * @param {Command} command\n * @param {PermissionLevel} requiredPermission\n * @param {boolean} [doReply=true]\n * @returns {unknown}\n */\nexport async function verifyGuildPermission(\n\tclient: TriviousClient,\n\tinteraction: Interaction<CacheType>,\n\tcommand: Command,\n\trequiredPermission: PermissionLevel,\n\tdoReply: boolean = true\n) {\n\tif (!interaction.inGuild()) return true;\n\n\tif (command.flags && command.flags.includes(\"OwnerOnly\")) {\n\t\trequiredPermission = PermissionLevel.BOT_OWNER;\n\t}\n\n\tconst member = interaction.member as GuildMember;\n\tconst memberHasPermission = hasPermission(client, { permission: requiredPermission, member });\n\n\tif (!memberHasPermission && doReply) {\n\t\tawait interactionReply({\n\t\t\tflags: command.flags,\n\t\t\tinteraction,\n\t\t\toptions: {\n\t\t\t\tcontent: `You do not have permission to run this command, required permission: \\`${PermissionLevel[requiredPermission]}\\``,\n\t\t\t},\n\t\t});\n\t}\n\n\treturn memberHasPermission;\n}\n\n/**\n * Handle execution of a slash command.\n *\n * @export\n * @async\n * @param {TriviousClient} client\n * @param {(SlashCommand | SlashSubcommand)} command\n * @param {ChatInputCommandInteraction} interaction\n * @returns {*}\n */\nexport async function handleSlashCommand(\n\tclient: TriviousClient,\n\tcommand: SlashCommand,\n\tinteraction: ChatInputCommandInteraction\n) {\n\tconst { options } = interaction;\n\n\tconst hasPerm = await verifyGuildPermission(\n\t\tclient,\n\t\tinteraction,\n\t\tcommand,\n\t\tcommand.permission || PermissionLevel.USER,\n\t\ttrue\n\t);\n\n\tif (command.flags?.includes(\"DeferReply\")) {\n\t\tawait interactionReply({\n\t\t\tflags: command.flags,\n\t\t\tinteraction,\n\t\t\toptions: { content: \"Processing command...\" },\n\t\t});\n\t}\n\n\tif (\"run\" in command && command.run && hasPerm) {\n\t\tawait command.run(client, interaction);\n\t}\n\n\tif (!hasPerm) return;\n\n\t// skip subcommand processing and respect command flags\n\tif (!options.getSubcommand(false) || !(\"subcommands\" in command)) return;\n\n\tconst subcommandName = options.getSubcommand();\n\tconst subcommand = command.subcommands!.get(subcommandName) as SlashSubcommand | undefined;\n\n\tif (!subcommand) {\n\t\tawait interactionReply({\n\t\t\tflags: command.flags,\n\t\t\tinteraction,\n\t\t\toptions: {\n\t\t\t\tcontent: \"This subcommand no longer exists or is not registered.\",\n\t\t\t},\n\t\t});\n\t\treturn;\n\t}\n\n\t// respect subcommand flags over command flags\n\tif (subcommand.flags?.includes(\"DeferReply\") && !subcommand.flags.includes(\"ModalResponse\")) {\n\t\tawait interactionReply({\n\t\t\tflags: subcommand.flags,\n\t\t\tinteraction,\n\t\t\toptions: { content: \"Processing command...\" },\n\t\t});\n\t}\n\n\tawait subcommand.execute(client, interaction);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { T as TriviousClient } from '../../index-
|
|
2
|
+
import { T as TriviousClient } from '../../index-DbWA_10I.js';
|
|
3
3
|
import '../../shared/typings/permissions.js';
|
|
4
4
|
import '../../shared/typings/registry.js';
|
|
5
5
|
import '../../shared/typings/client.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
2
|
import { CacheType } from 'discord.js';
|
|
3
|
-
import { T as TriviousClient } from '../../index-
|
|
3
|
+
import { T as TriviousClient } from '../../index-DbWA_10I.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/registry.js';
|
|
6
6
|
import '../../shared/typings/client.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/events/interactionCreate.ts"],"names":["hasPermission"],"mappings":";;;;;;AA0BA,eAAe,gCAAA,CACd,MAAA,EACA,WAAA,EACA,UAAA,EACC;AACD,EAAA,IAAI,YAAY,KAAA,EAAO;AACtB,IAAA,MAAM,SAAS,WAAA,CAAY,MAAA;AAC3B,IAAA,MAAM,sBAAsB,aAAA,CAAc,MAAA,EAAQ,EAAE,UAAA,EAAY,QAAQ,CAAA;AACxE,IAAA,OAAO,mBAAA;AAAA,EACR;AAEA,EAAA,OAAO,KAAA;AACR;AAEA,IAAO,yBAAA,GAAQ;AAAA,EACd,IAAA,EAAM,mBAAA;AAAA,EACN,OAAA,EAAS,OAAO,MAAA,EAAQ,WAAA,KAAgB;AACvC,IAAA,IAAI,WAAA,CAAY,kBAAA,EAAmB,IAAK,WAAA,CAAY,sBAAqB,EAAG;AAC3E,MAAA,MAAM,EAAE,aAAY,GAAI,WAAA;AAExB,MAAA,MAAM,kBAAA,GAAqB,MAAA,CAAO,UAAA,CAAW,QAAA,CAAS,GAAA,EAAI;AAC1D,MAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,GAAA,CAAI,WAAW,CAAA;AAClD,MAAA,IAAI,CAAC,OAAA,EAAS;AACb,QAAA,MAAM,gBAAA,CAAiB;AAAA,UACtB,KAAA,EAAO,CAAC,gBAAgB,CAAA;AAAA,UACxB,WAAA;AAAA,UACA,OAAA,EAAS;AAAA,YACR,OAAA,EAAS,CAAA,yDAAA;AAAA;AACV,SACA,CAAA;AACD,QAAA;AAAA,MACD;AAEA,MAAA,MAAM,qBAAqB,OAAA,CAAQ,UAAA;AACnC,MAAA,MAAMA,iBAAgB,MAAM,qBAAA;AAAA,QAC3B,MAAA;AAAA,QACA,WAAA;AAAA,QACA,OAAA;AAAA,QACA,sBAAsB,eAAA,CAAgB;AAAA,OACvC;AACA,M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AA,MAAM,qBAAqB,SAAA,CAAU,UAAA;AACrC,MAAA,MAAMA,iBAAgB,MAAM,gCAAA;AAAA,QAC3B,MAAA;AAAA,QACA,WAAA;AAAA,QACA;AAAA,OACD;AACA,MAAA,IAAI,CAACA,cAAAA,EAAe;AAEpB,MAAA,MAAM,SAAA,CAAU,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,IAC5C;AAAA,EACD;AACD","file":"interactionCreate.js","sourcesContent":["import {\n\tButtonInteraction,\n\tCacheType,\n\tGuildMember,\n\tMessageContextMenuCommandInteraction,\n\tModalSubmitInteraction,\n\tUserContextMenuCommandInteraction,\n} from \"discord.js\";\nimport {\n\tComponentInteraction,\n\tComponentType,\n\tContextMenuCommand,\n\tEvent,\n\tPermissionLevel,\n\tSlashCommand,\n} from \"src/shared/typings/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\nimport {\n\thandleSlashCommand,\n\tinteractionReply,\n\tverifyGuildPermission,\n} from \"../commands/methods.command.js\";\nimport { ChatInputCommandInteraction } from \"src/index.js\";\nimport { deconstructCustomId } from \"src/shared/utility/components.utility.js\";\nimport TriviousClient from \"../client/trivious.client.js\";\n\nasync function validateComponentGuildPermission(\n\tclient: TriviousClient,\n\tinteraction: ComponentInteraction,\n\tpermission: PermissionLevel\n) {\n\tif (interaction.guild) {\n\t\tconst member = interaction.member as GuildMember;\n\t\tconst memberHasPermission = hasPermission(client, { permission, member });\n\t\treturn memberHasPermission;\n\t}\n\n\treturn false;\n}\n\nexport default {\n\tname: \"interactionCreate\",\n\texecute: async (client, interaction) => {\n\t\tif (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) {\n\t\t\tconst { commandName } = interaction;\n\n\t\t\tconst registeredCommands = client.registries.commands.get();\n\t\t\tconst command = registeredCommands.get(commandName);\n\t\t\tif (!command) {\n\t\t\t\tawait interactionReply({\n\t\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\t\tinteraction,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = command.permission;\n\t\t\tconst hasPermission = await verifyGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\tcommand,\n\t\t\t\trequiredPermission || PermissionLevel.USER\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tif (command.context === \"SlashCommand\" && \"data\" in command) {\n\t\t\t\tawait handleSlashCommand(\n\t\t\t\t\tclient,\n\t\t\t\t\tcommand as SlashCommand,\n\t\t\t\t\tinteraction as ChatInputCommandInteraction\n\t\t\t\t);\n\t\t\t} else if (command.context === \"ContextMenu\") {\n\t\t\t\tawait (command as ContextMenuCommand).execute(\n\t\t\t\t\tclient,\n\t\t\t\t\tinteraction as\n\t\t\t\t\t\t| UserContextMenuCommandInteraction<CacheType>\n\t\t\t\t\t\t| MessageContextMenuCommandInteraction<CacheType>\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {\n\t\t\tconst { compType, tags, data } = deconstructCustomId(interaction.customId);\n\n\t\t\tif (compType === ComponentType.Button && !(interaction instanceof ButtonInteraction)) return;\n\t\t\tif (compType === ComponentType.Modal && !(interaction instanceof ModalSubmitInteraction))\n\t\t\t\treturn;\n\n\t\t\tif (tags && tags.includes(\"awaited\")) return;\n\n\t\t\tconst registeredComponents = client.registries.components.get();\n\t\t\tconst component = registeredComponents.get(data);\n\t\t\tif (!component) {\n\t\t\t\tawait interactionReply({\n\t\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\t\tinteraction,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = component.permission;\n\t\t\tconst hasPermission = await validateComponentGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\trequiredPermission\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tawait component.execute(client, interaction);\n\t\t}\n\t},\n} satisfies Event<\"interactionCreate\">;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { C as default } from '../../index-
|
|
3
|
+
export { C as default } from '../../index-DbWA_10I.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/client.js';
|
|
6
6
|
import '../builders/util.builders.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { a as default } from '../../index-
|
|
3
|
+
export { a as default } from '../../index-DbWA_10I.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/client.js';
|
|
6
6
|
import '../builders/util.builders.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { E as default } from '../../index-
|
|
3
|
+
export { E as default } from '../../index-DbWA_10I.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/client.js';
|
|
6
6
|
import '../builders/util.builders.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TriviousClientOptions } from '../../shared/typings/client.js';
|
|
2
|
-
import { C as CommandRegistry, a as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, T as TriviousClient } from '../../index-
|
|
2
|
+
import { C as CommandRegistry, a as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, T as TriviousClient } from '../../index-DbWA_10I.js';
|
|
3
3
|
import 'discord.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/registry.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../../shared/typings/registry.js';
|
|
3
|
-
export { M as default } from '../../index-
|
|
3
|
+
export { M as default } from '../../index-DbWA_10I.js';
|
|
4
4
|
import '../../shared/typings/permissions.js';
|
|
5
5
|
import '../../shared/typings/client.js';
|
|
6
6
|
import '../builders/util.builders.js';
|
|
@@ -378,7 +378,7 @@ declare class TriviousClient extends Client {
|
|
|
378
378
|
* @returns {*}
|
|
379
379
|
*/
|
|
380
380
|
declare function interactionReply(data: {
|
|
381
|
-
flags?: ("FollowUp" | CommandFlags)[];
|
|
381
|
+
flags?: ("ClearAll" | "FollowUp" | CommandFlags)[];
|
|
382
382
|
interaction: Interaction<CacheType>;
|
|
383
383
|
options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions;
|
|
384
384
|
}): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { B as ButtonInteraction, t as ChatInputCommandInteraction, g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, C as CommandRegistry, b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, a as ComponentRegistry, e as ComponentType, i as ContextMenuCommand, x as ContextMenuCommandInteraction, f as CustomIdConstructOptions, m as Event, w as ModalSubmitInteraction, n as Module, S as SlashCommand, h as SlashSubcommand, u as StringSelectMenuInteraction, T as TriviousClient, r as constructCustomId, q as deconstructCustomId, s as getPermissionLevel, p as handleSlashCommand, o as interactionReply, v as verifyGuildPermission } from './index-
|
|
2
|
+
export { B as ButtonInteraction, t as ChatInputCommandInteraction, g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, C as CommandRegistry, b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, a as ComponentRegistry, e as ComponentType, i as ContextMenuCommand, x as ContextMenuCommandInteraction, f as CustomIdConstructOptions, m as Event, w as ModalSubmitInteraction, n as Module, S as SlashCommand, h as SlashSubcommand, u as StringSelectMenuInteraction, T as TriviousClient, r as constructCustomId, q as deconstructCustomId, s as getPermissionLevel, p as handleSlashCommand, o as interactionReply, v as verifyGuildPermission } from './index-DbWA_10I.js';
|
|
3
3
|
export { createActionRow, createEmbed } from './core/builders/util.builders.js';
|
|
4
4
|
export { PermissionLevel } from './shared/typings/permissions.js';
|
|
5
5
|
export { BaseRegistry } from './shared/typings/registry.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './permissions.js';
|
|
2
2
|
import 'discord.js';
|
|
3
|
-
export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, i as ContextMenuCommand, S as SlashCommand, h as SlashSubcommand } from '../../index-
|
|
3
|
+
export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, i as ContextMenuCommand, S as SlashCommand, h as SlashSubcommand } from '../../index-DbWA_10I.js';
|
|
4
4
|
import './registry.js';
|
|
5
5
|
import './client.js';
|
|
6
6
|
import '../../core/builders/util.builders.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import './permissions.js';
|
|
3
|
-
export { b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, e as ComponentType, f as CustomIdConstructOptions } from '../../index-
|
|
3
|
+
export { b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, e as ComponentType, f as CustomIdConstructOptions } from '../../index-DbWA_10I.js';
|
|
4
4
|
import './registry.js';
|
|
5
5
|
import './client.js';
|
|
6
6
|
import '../../core/builders/util.builders.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PermissionLevel } from './permissions.js';
|
|
2
2
|
export { BaseRegistry } from './registry.js';
|
|
3
|
-
export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, e as ComponentType, i as ContextMenuCommand, f as CustomIdConstructOptions, m as Event, n as Module, S as SlashCommand, h as SlashSubcommand } from '../../index-
|
|
3
|
+
export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, e as ComponentType, i as ContextMenuCommand, f as CustomIdConstructOptions, m as Event, n as Module, S as SlashCommand, h as SlashSubcommand } from '../../index-DbWA_10I.js';
|
|
4
4
|
export { TriviousClientOptions } from './client.js';
|
|
5
5
|
import 'discord.js';
|
|
6
6
|
import '../../core/builders/util.builders.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { r as constructCustomId, q as deconstructCustomId } from '../../index-
|
|
1
|
+
export { r as constructCustomId, q as deconstructCustomId } from '../../index-DbWA_10I.js';
|
|
2
2
|
import '../typings/permissions.js';
|
|
3
3
|
import '../typings/registry.js';
|
|
4
4
|
import 'discord.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TriviousClient } from '../../index-
|
|
1
|
+
import { T as TriviousClient } from '../../index-DbWA_10I.js';
|
|
2
2
|
import { PermissionLevel } from '../typings/permissions.js';
|
|
3
3
|
import { User, GuildMember, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
|
|
4
4
|
import '../typings/registry.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
2
|
import '../typings/permissions.js';
|
|
3
|
-
export { s as getPermissionLevel } from '../../index-
|
|
3
|
+
export { s as getPermissionLevel } from '../../index-DbWA_10I.js';
|
|
4
4
|
import '../typings/registry.js';
|
|
5
5
|
import '../typings/client.js';
|
|
6
6
|
import '../../core/builders/util.builders.js';
|