trivious 2.1.6 → 2.1.7
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.
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ChatInputCommandInteraction, Interaction, CacheType, InteractionReplyOptions, InteractionEditReplyOptions, MessagePayload } from 'discord.js';
|
|
1
|
+
import { ChatInputCommandInteraction, Interaction, CacheType, InteractionReplyOptions, InteractionResponse, InteractionEditReplyOptions, Message, MessagePayload } from 'discord.js';
|
|
3
2
|
import { T as TriviousClient, S as SlashCommandData, b as CommandFlags } from '../../modules.types-BY9Ncpz7.js';
|
|
4
3
|
import '../client/client.types.js';
|
|
5
4
|
import '../permissions/permissions.types.js';
|
|
6
5
|
|
|
7
6
|
declare function interactionReply(options: {
|
|
8
7
|
interaction: Interaction<CacheType>;
|
|
9
|
-
replyPayload: InteractionReplyOptions
|
|
8
|
+
replyPayload: InteractionReplyOptions;
|
|
10
9
|
flags?: (CommandFlags | "FollowUp")[];
|
|
11
|
-
}): Promise<
|
|
10
|
+
}): Promise<InteractionResponse<boolean>>;
|
|
11
|
+
declare function interactionReply(options: {
|
|
12
|
+
interaction: Interaction<CacheType>;
|
|
13
|
+
replyPayload: InteractionEditReplyOptions;
|
|
14
|
+
flags?: (CommandFlags | "FollowUp")[];
|
|
15
|
+
}): Promise<Message<boolean>>;
|
|
16
|
+
declare function interactionReply(options: {
|
|
17
|
+
interaction: Interaction<CacheType>;
|
|
18
|
+
replyPayload: MessagePayload;
|
|
19
|
+
flags?: (CommandFlags | "FollowUp")[];
|
|
20
|
+
}): Promise<InteractionResponse<boolean> | Message<boolean>>;
|
|
12
21
|
declare function handleSlashCommand(client: TriviousClient, command: SlashCommandData, interaction: ChatInputCommandInteraction): Promise<void>;
|
|
13
22
|
|
|
14
23
|
export { handleSlashCommand, interactionReply };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/commands/methods.commands.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CAAA;AAC1D,IAAA,IAAI,CAAC,eAAA,EAAiB;AACrB,MAAA,MAAM,gBAAA,CAAiB;AAAA,QACtB,WAAA;AAAA,QACA,KAAA,EAAO,CAAC,gBAAgB,CAAA;AAAA,QACxB,YAAA,EAAc,EAAE,OAAA,EAAS,+DAAA;AAAgE,OACzF,CAAA;AACD,MAAA;AAAA,IACD;AAEA,IAAA,OAAO,MAAM,eAAA,CAAgB,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,EACzD;AACD","file":"methods.commands.js","sourcesContent":["import { CommandFlags, SlashCommandData, TriviousClient } from \"#typings\";\nimport {\n\tCacheType,\n\tChatInputCommandInteraction,\n\tInteraction,\n\tInteractionEditReplyOptions,\n\tInteractionReplyOptions,\n\tInteractionResponse,\n\tMessage,\n\tMessagePayload,\n} from \"discord.js\";\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: InteractionReplyOptions;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}): Promise<InteractionResponse<boolean>>;\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: InteractionEditReplyOptions;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}): Promise<Message<boolean>>;\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: MessagePayload;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}): Promise<InteractionResponse<boolean> | Message<boolean>>;\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: InteractionReplyOptions | InteractionEditReplyOptions | MessagePayload;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}) {\n\tconst { interaction, replyPayload, flags } = options;\n\tif (!(\"reply\" in interaction)) return;\n\n\tconst payload = replyPayload as InteractionReplyOptions;\n\tif (flags?.includes(\"EphemeralReply\")) payload.flags = [\"Ephemeral\"];\n\n\tif (interaction.deferred || interaction.replied) {\n\t\tif (flags?.includes(\"FollowUp\")) return await interaction.followUp(payload);\n\t\treturn await interaction.editReply(payload as InteractionEditReplyOptions);\n\t}\n\n\treturn await interaction.reply(payload);\n}\n\nexport async function handleSlashCommand(\n\tclient: TriviousClient,\n\tcommand: SlashCommandData,\n\tinteraction: ChatInputCommandInteraction\n) {\n\tconst { options } = interaction;\n\n\tif (command.flags?.includes(\"Cached\") && !interaction.inCachedGuild()) return;\n\tif (command.flags?.includes(\"ExpectModal\")) return;\n\tif (command.flags?.includes(\"DeferReply\")) {\n\t\tawait interactionReply({\n\t\t\tinteraction,\n\t\t\tflags: command.flags,\n\t\t\treplyPayload: { content: \"Processing command...\" },\n\t\t});\n\t}\n\n\tif (\"run\" in command && command.run) {\n\t\ttry {\n\t\t\tawait command.run(client, interaction);\n\t\t} catch (err: any) {\n\t\t\tconsole.error(err);\n\t\t}\n\t}\n\n\tconst subcommandGroup = options.getSubcommandGroup(false);\n\tconst subcommand = options.getSubcommand(false);\n\n\tif (subcommandGroup && command.subcommandGroups && subcommand) {\n\t\tconst foundGroup = command.subcommandGroups.get(subcommandGroup);\n\t\tif (!foundGroup) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: {\n\t\t\t\t\tcontent: \"Subcommand group is outdated, inactive, or does not have a handler!\",\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst foundSubcommand = foundGroup.subcommands.get(subcommand);\n\t\tif (!foundSubcommand) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: { content: \"Subcommand is outdated, inactive, or does not have a handler!\" },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\treturn await foundSubcommand.execute(client, interaction);\n\t} else if (subcommand && command.subcommands) {\n\t\tconst foundSubcommand = command.subcommands.get(subcommand);\n\t\tif (!foundSubcommand) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: { content: \"Subcommand is outdated, inactive, or does not have a handler!\" },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\treturn await foundSubcommand.execute(client, interaction);\n\t}\n}\n"]}
|