@sapphire/plugin-subcommands 6.0.4-next.fe95a62.0 → 7.0.0-next.6e7a5bf
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/cjs/index.cjs +6 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +19 -3
- package/dist/cjs/lib/Subcommand.cjs +37 -52
- package/dist/cjs/lib/Subcommand.cjs.map +1 -1
- package/dist/cjs/lib/precondition-resolvers/subcommandCooldown.cjs +1 -1
- package/dist/cjs/lib/precondition-resolvers/subcommandCooldown.cjs.map +1 -1
- package/dist/cjs/lib/types/Enums.cjs +1 -1
- package/dist/cjs/lib/types/Enums.cjs.map +1 -1
- package/dist/cjs/lib/types/Events.cjs +3 -1
- package/dist/cjs/lib/types/Events.cjs.map +1 -1
- package/dist/cjs/lib/types/SubcommandMappings.cjs +1 -1
- package/dist/cjs/lib/types/SubcommandMappings.cjs.map +1 -1
- package/dist/cjs/listeners/PluginChatInputSubcommandError.cjs +1 -1
- package/dist/cjs/listeners/PluginChatInputSubcommandError.cjs.map +1 -1
- package/dist/cjs/listeners/PluginChatInputSubcommandNoMatch.cjs +21 -0
- package/dist/cjs/listeners/PluginChatInputSubcommandNoMatch.cjs.map +1 -0
- package/dist/cjs/listeners/PluginMessageSubcommandError.cjs +1 -1
- package/dist/cjs/listeners/PluginMessageSubcommandError.cjs.map +1 -1
- package/dist/cjs/listeners/PluginMessageSubcommandNoMatch.cjs +21 -0
- package/dist/cjs/listeners/PluginMessageSubcommandNoMatch.cjs.map +1 -0
- package/dist/cjs/listeners/PluginSubcommandMappingIsMissingChatInputCommandHandler.cjs +1 -1
- package/dist/cjs/listeners/PluginSubcommandMappingIsMissingChatInputCommandHandler.cjs.map +1 -1
- package/dist/cjs/listeners/PluginSubcommandMappingIsMissingMessageCommandHandler.cjs +1 -1
- package/dist/cjs/listeners/PluginSubcommandMappingIsMissingMessageCommandHandler.cjs.map +1 -1
- package/dist/cjs/listeners/_load.cjs +13 -1
- package/dist/cjs/listeners/_load.cjs.map +1 -1
- package/dist/cjs/preconditions/PluginSubcommandCooldown.cjs +5 -11
- package/dist/cjs/preconditions/PluginSubcommandCooldown.cjs.map +1 -1
- package/dist/cjs/preconditions/_load.cjs +1 -1
- package/dist/cjs/preconditions/_load.cjs.map +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/cjs/register.cjs.map +1 -1
- package/dist/esm/chunk-3IXKS7M5.mjs +14 -0
- package/dist/esm/chunk-3IXKS7M5.mjs.map +1 -0
- package/dist/esm/index.d.mts +19 -3
- package/dist/esm/index.mjs +4 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/lib/Subcommand.mjs +33 -38
- package/dist/esm/lib/Subcommand.mjs.map +1 -1
- package/dist/esm/lib/precondition-resolvers/subcommandCooldown.mjs +2 -2
- package/dist/esm/lib/precondition-resolvers/subcommandCooldown.mjs.map +1 -1
- package/dist/esm/lib/types/Enums.mjs +2 -2
- package/dist/esm/lib/types/Enums.mjs.map +1 -1
- package/dist/esm/lib/types/Events.mjs +4 -2
- package/dist/esm/lib/types/Events.mjs.map +1 -1
- package/dist/esm/lib/types/SubcommandMappings.mjs +1 -1
- package/dist/esm/lib/types/SubcommandMappings.mjs.map +1 -1
- package/dist/esm/listeners/PluginChatInputSubcommandError.mjs +2 -2
- package/dist/esm/listeners/PluginChatInputSubcommandError.mjs.map +1 -1
- package/dist/esm/listeners/PluginChatInputSubcommandNoMatch.mjs +18 -0
- package/dist/esm/listeners/PluginChatInputSubcommandNoMatch.mjs.map +1 -0
- package/dist/esm/listeners/PluginMessageSubcommandError.mjs +2 -2
- package/dist/esm/listeners/PluginMessageSubcommandError.mjs.map +1 -1
- package/dist/esm/listeners/PluginMessageSubcommandNoMatch.mjs +18 -0
- package/dist/esm/listeners/PluginMessageSubcommandNoMatch.mjs.map +1 -0
- package/dist/esm/listeners/PluginSubcommandMappingIsMissingChatInputCommandHandler.mjs +2 -2
- package/dist/esm/listeners/PluginSubcommandMappingIsMissingChatInputCommandHandler.mjs.map +1 -1
- package/dist/esm/listeners/PluginSubcommandMappingIsMissingMessageCommandHandler.mjs +2 -2
- package/dist/esm/listeners/PluginSubcommandMappingIsMissingMessageCommandHandler.mjs.map +1 -1
- package/dist/esm/listeners/_load.mjs +14 -2
- package/dist/esm/listeners/_load.mjs.map +1 -1
- package/dist/esm/preconditions/PluginSubcommandCooldown.mjs +5 -8
- package/dist/esm/preconditions/PluginSubcommandCooldown.mjs.map +1 -1
- package/dist/esm/preconditions/_load.mjs +2 -2
- package/dist/esm/preconditions/_load.mjs.map +1 -1
- package/dist/esm/register.mjs +2 -2
- package/dist/esm/register.mjs.map +1 -1
- package/package.json +8 -8
- package/dist/esm/chunk-K3DKV2RO.mjs +0 -24
- package/dist/esm/chunk-K3DKV2RO.mjs.map +0 -1
|
@@ -18,5 +18,5 @@ __name(_PluginListener, "PluginListener");
|
|
|
18
18
|
var PluginListener = _PluginListener;
|
|
19
19
|
|
|
20
20
|
exports.PluginListener = PluginListener;
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=PluginChatInputSubcommandError.cjs.map
|
|
22
22
|
//# sourceMappingURL=PluginChatInputSubcommandError.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/listeners/PluginChatInputSubcommandError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/listeners/PluginChatInputSubcommandError.ts"],"names":["Listener","SubcommandPluginEvents"],"mappings":";;;;;;;AAGO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAiE,CAAA;AAAA,EAC7F,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,iCAAA,CAAuB,0BAA0B,CAAA,CAAA;AAAA,GAC1E;AAAA,EAEgB,GAAA,CAAI,OAAgB,OAA0C,EAAA;AAC7E,IAAA,MAAM,EAAE,IAAA,EAAM,QAAS,EAAA,GAAI,OAAQ,CAAA,OAAA,CAAA;AACnC,IAAK,IAAA,CAAA,SAAA,CAAU,OAAO,KAAM,CAAA,CAAA,4CAAA,EAA+C,IAAI,CAAc,WAAA,EAAA,QAAA,CAAS,IAAI,CAAA,CAAA,CAAA,EAAK,KAAK,CAAA,CAAA;AAAA,GACrH;AACD,CAAA,CAAA;AATqG,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,CAAA;AAA9F,IAAM,cAAN,GAAA","file":"PluginChatInputSubcommandError.cjs","sourcesContent":["import { Listener } from '@sapphire/framework';\nimport { SubcommandPluginEvents, type ChatInputSubcommandErrorPayload } from '../lib/types/Events';\n\nexport class PluginListener extends Listener<typeof SubcommandPluginEvents.ChatInputSubcommandError> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: SubcommandPluginEvents.ChatInputSubcommandError });\n\t}\n\n\tpublic override run(error: unknown, context: ChatInputSubcommandErrorPayload) {\n\t\tconst { name, location } = context.command;\n\t\tthis.container.logger.error(`Encountered error on chat input subcommand \"${name}\" at path \"${location.full}\"`, error);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var framework = require('@sapphire/framework');
|
|
4
|
+
var Events_cjs = require('../lib/types/Events.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var _PluginListener = class _PluginListener extends framework.Listener {
|
|
9
|
+
constructor(context) {
|
|
10
|
+
super(context, { event: Events_cjs.SubcommandPluginEvents.ChatInputSubcommandNoMatch });
|
|
11
|
+
}
|
|
12
|
+
run(_interaction, context) {
|
|
13
|
+
this.container.logger.error(context.message);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
__name(_PluginListener, "PluginListener");
|
|
17
|
+
var PluginListener = _PluginListener;
|
|
18
|
+
|
|
19
|
+
exports.PluginListener = PluginListener;
|
|
20
|
+
//# sourceMappingURL=PluginChatInputSubcommandNoMatch.cjs.map
|
|
21
|
+
//# sourceMappingURL=PluginChatInputSubcommandNoMatch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/listeners/PluginChatInputSubcommandNoMatch.ts"],"names":["Listener","SubcommandPluginEvents"],"mappings":";;;;;;;AAGO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAmE,CAAA;AAAA,EAC/F,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,iCAAA,CAAuB,4BAA4B,CAAA,CAAA;AAAA,GAC5E;AAAA,EAEgB,GAAA,CAAI,cAA4C,OAA4C,EAAA;AAC3G,IAAA,IAAA,CAAK,SAAU,CAAA,MAAA,CAAO,KAAM,CAAA,OAAA,CAAQ,OAAO,CAAA,CAAA;AAAA,GAC5C;AACD,CAAA,CAAA;AARuG,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,CAAA;AAAhG,IAAM,cAAN,GAAA","file":"PluginChatInputSubcommandNoMatch.cjs","sourcesContent":["import { Listener, type ChatInputCommand } from '@sapphire/framework';\nimport { SubcommandPluginEvents, type ChatInputSubcommandNoMatchContext } from '../lib/types/Events';\n\nexport class PluginListener extends Listener<typeof SubcommandPluginEvents.ChatInputSubcommandNoMatch> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: SubcommandPluginEvents.ChatInputSubcommandNoMatch });\n\t}\n\n\tpublic override run(_interaction: ChatInputCommand.Interaction, context: ChatInputSubcommandNoMatchContext) {\n\t\tthis.container.logger.error(context.message);\n\t}\n}\n"]}
|
|
@@ -18,5 +18,5 @@ __name(_PluginListener, "PluginListener");
|
|
|
18
18
|
var PluginListener = _PluginListener;
|
|
19
19
|
|
|
20
20
|
exports.PluginListener = PluginListener;
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=PluginMessageSubcommandError.cjs.map
|
|
22
22
|
//# sourceMappingURL=PluginMessageSubcommandError.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/listeners/PluginMessageSubcommandError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/listeners/PluginMessageSubcommandError.ts"],"names":["Listener","SubcommandPluginEvents"],"mappings":";;;;;;;AAGO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAA+D,CAAA;AAAA,EAC3F,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,iCAAA,CAAuB,wBAAwB,CAAA,CAAA;AAAA,GACxE;AAAA,EAEgB,GAAA,CAAI,OAAgB,OAAwC,EAAA;AAC3E,IAAA,MAAM,EAAE,IAAA,EAAM,QAAS,EAAA,GAAI,OAAQ,CAAA,OAAA,CAAA;AACnC,IAAK,IAAA,CAAA,SAAA,CAAU,OAAO,KAAM,CAAA,CAAA,yCAAA,EAA4C,IAAI,CAAc,WAAA,EAAA,QAAA,CAAS,IAAI,CAAA,CAAA,CAAA,EAAK,KAAK,CAAA,CAAA;AAAA,GAClH;AACD,CAAA,CAAA;AATmG,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,CAAA;AAA5F,IAAM,cAAN,GAAA","file":"PluginMessageSubcommandError.cjs","sourcesContent":["import { Listener } from '@sapphire/framework';\nimport { SubcommandPluginEvents, type MessageSubcommandErrorPayload } from '../lib/types/Events';\n\nexport class PluginListener extends Listener<typeof SubcommandPluginEvents.MessageSubcommandError> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: SubcommandPluginEvents.MessageSubcommandError });\n\t}\n\n\tpublic override run(error: unknown, context: MessageSubcommandErrorPayload) {\n\t\tconst { name, location } = context.command;\n\t\tthis.container.logger.error(`Encountered error on message subcommand \"${name}\" at path \"${location.full}\"`, error);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var framework = require('@sapphire/framework');
|
|
4
|
+
var Events_cjs = require('../lib/types/Events.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var _PluginListener = class _PluginListener extends framework.Listener {
|
|
9
|
+
constructor(context) {
|
|
10
|
+
super(context, { event: Events_cjs.SubcommandPluginEvents.MessageSubcommandNoMatch });
|
|
11
|
+
}
|
|
12
|
+
run(_message, _args, context) {
|
|
13
|
+
this.container.logger.error(context.message);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
__name(_PluginListener, "PluginListener");
|
|
17
|
+
var PluginListener = _PluginListener;
|
|
18
|
+
|
|
19
|
+
exports.PluginListener = PluginListener;
|
|
20
|
+
//# sourceMappingURL=PluginMessageSubcommandNoMatch.cjs.map
|
|
21
|
+
//# sourceMappingURL=PluginMessageSubcommandNoMatch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/listeners/PluginMessageSubcommandNoMatch.ts"],"names":["Listener","SubcommandPluginEvents"],"mappings":";;;;;;;AAIO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAiE,CAAA;AAAA,EAC7F,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,iCAAA,CAAuB,0BAA0B,CAAA,CAAA;AAAA,GAC1E;AAAA,EAEgB,GAAA,CAAI,QAAmB,EAAA,KAAA,EAAa,OAA0C,EAAA;AAC7F,IAAA,IAAA,CAAK,SAAU,CAAA,MAAA,CAAO,KAAM,CAAA,OAAA,CAAQ,OAAO,CAAA,CAAA;AAAA,GAC5C;AACD,CAAA,CAAA;AARqG,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,CAAA;AAA9F,IAAM,cAAN,GAAA","file":"PluginMessageSubcommandNoMatch.cjs","sourcesContent":["import { Args, Listener } from '@sapphire/framework';\nimport type { Message } from 'discord.js';\nimport { SubcommandPluginEvents, type MessageSubcommandNoMatchContext } from '../lib/types/Events';\n\nexport class PluginListener extends Listener<typeof SubcommandPluginEvents.MessageSubcommandNoMatch> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: SubcommandPluginEvents.MessageSubcommandNoMatch });\n\t}\n\n\tpublic override run(_message: Message, _args: Args, context: MessageSubcommandNoMatchContext) {\n\t\tthis.container.logger.error(context.message);\n\t}\n}\n"]}
|
|
@@ -18,5 +18,5 @@ __name(_PluginListener, "PluginListener");
|
|
|
18
18
|
var PluginListener = _PluginListener;
|
|
19
19
|
|
|
20
20
|
exports.PluginListener = PluginListener;
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=PluginSubcommandMappingIsMissingChatInputCommandHandler.cjs.map
|
|
22
22
|
//# sourceMappingURL=PluginSubcommandMappingIsMissingChatInputCommandHandler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/listeners/PluginSubcommandMappingIsMissingChatInputCommandHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/listeners/PluginSubcommandMappingIsMissingChatInputCommandHandler.ts"],"names":["Listener","SubcommandPluginEvents"],"mappings":";;;;;;;AAIO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAA0F,CAAA;AAAA,EACtH,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,iCAAA,CAAuB,mDAAmD,CAAA,CAAA;AAAA,GACnG;AAAA,EAEgB,GAAA,CAAI,CAAiC,EAAA,UAAA,EAAqC,OAA0C,EAAA;AACnI,IAAA,MAAM,EAAE,IAAA,EAAM,QAAS,EAAA,GAAI,OAAQ,CAAA,OAAA,CAAA;AACnC,IAAK,IAAA,CAAA,SAAA,CAAU,OAAO,KAAM,CAAA,CAAA,wDAAA,EAA2D,IAAI,CAAS,MAAA,EAAA,QAAA,CAAS,IAAI,CAAA,CAAA,CAAA,EAAK,UAAU,CAAA,CAAA;AAAA,GACjI;AACD,CAAA,CAAA;AAT8H,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,CAAA;AAAvH,IAAM,cAAN,GAAA","file":"PluginSubcommandMappingIsMissingChatInputCommandHandler.cjs","sourcesContent":["import { Listener, type ChatInputCommand } from '@sapphire/framework';\nimport { SubcommandPluginEvents, type ChatInputSubcommandErrorPayload } from '../lib/types/Events';\nimport type { SubcommandMappingMethod } from '../lib/types/SubcommandMappings';\n\nexport class PluginListener extends Listener<typeof SubcommandPluginEvents.SubcommandMappingIsMissingChatInputCommandHandler> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: SubcommandPluginEvents.SubcommandMappingIsMissingChatInputCommandHandler });\n\t}\n\n\tpublic override run(_: ChatInputCommand.Interaction, subcommand: SubcommandMappingMethod, context: ChatInputSubcommandErrorPayload) {\n\t\tconst { name, location } = context.command;\n\t\tthis.container.logger.error(`Encountered a missing mapping on chat input subcommand \"${name}\" at \"${location.full}\"`, subcommand);\n\t}\n}\n"]}
|
|
@@ -18,5 +18,5 @@ __name(_PluginListener, "PluginListener");
|
|
|
18
18
|
var PluginListener = _PluginListener;
|
|
19
19
|
|
|
20
20
|
exports.PluginListener = PluginListener;
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=PluginSubcommandMappingIsMissingMessageCommandHandler.cjs.map
|
|
22
22
|
//# sourceMappingURL=PluginSubcommandMappingIsMissingMessageCommandHandler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/listeners/PluginSubcommandMappingIsMissingMessageCommandHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/listeners/PluginSubcommandMappingIsMissingMessageCommandHandler.ts"],"names":["Listener","SubcommandPluginEvents"],"mappings":";;;;;;;AAKO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAwF,CAAA;AAAA,EACpH,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,iCAAA,CAAuB,iDAAiD,CAAA,CAAA;AAAA,GACjG;AAAA,EAEgB,GAAA,CAAI,CAAY,EAAA,UAAA,EAAqC,OAAwC,EAAA;AAC5G,IAAA,MAAM,EAAE,IAAA,EAAM,QAAS,EAAA,GAAI,OAAQ,CAAA,OAAA,CAAA;AACnC,IAAK,IAAA,CAAA,SAAA,CAAU,OAAO,KAAM,CAAA,CAAA,qDAAA,EAAwD,IAAI,CAAS,MAAA,EAAA,QAAA,CAAS,IAAI,CAAA,CAAA,CAAA,EAAK,UAAU,CAAA,CAAA;AAAA,GAC9H;AACD,CAAA,CAAA;AAT4H,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,CAAA;AAArH,IAAM,cAAN,GAAA","file":"PluginSubcommandMappingIsMissingMessageCommandHandler.cjs","sourcesContent":["import { Listener } from '@sapphire/framework';\nimport type { Message } from 'discord.js';\nimport { SubcommandPluginEvents, type MessageSubcommandErrorPayload } from '../lib/types/Events';\nimport type { SubcommandMappingMethod } from '../lib/types/SubcommandMappings';\n\nexport class PluginListener extends Listener<typeof SubcommandPluginEvents.SubcommandMappingIsMissingMessageCommandHandler> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: SubcommandPluginEvents.SubcommandMappingIsMissingMessageCommandHandler });\n\t}\n\n\tpublic override run(_: Message, subcommand: SubcommandMappingMethod, context: MessageSubcommandErrorPayload) {\n\t\tconst { name, location } = context.command;\n\t\tthis.container.logger.error(`Encountered a missing mapping on message subcommand \"${name}\" at \"${location.full}\"`, subcommand);\n\t}\n}\n"]}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var pieces = require('@sapphire/pieces');
|
|
4
4
|
var PluginChatInputSubcommandError_cjs = require('./PluginChatInputSubcommandError.cjs');
|
|
5
|
+
var PluginChatInputSubcommandNoMatch_cjs = require('./PluginChatInputSubcommandNoMatch.cjs');
|
|
5
6
|
var PluginMessageSubcommandError_cjs = require('./PluginMessageSubcommandError.cjs');
|
|
7
|
+
var PluginMessageSubcommandNoMatch_cjs = require('./PluginMessageSubcommandNoMatch.cjs');
|
|
6
8
|
var PluginSubcommandMappingIsMissingChatInputCommandHandler_cjs = require('./PluginSubcommandMappingIsMissingChatInputCommandHandler.cjs');
|
|
7
9
|
var PluginSubcommandMappingIsMissingMessageCommandHandler_cjs = require('./PluginSubcommandMappingIsMissingMessageCommandHandler.cjs');
|
|
8
10
|
|
|
@@ -22,9 +24,19 @@ function loadListeners() {
|
|
|
22
24
|
piece: PluginSubcommandMappingIsMissingMessageCommandHandler_cjs.PluginListener,
|
|
23
25
|
store
|
|
24
26
|
});
|
|
27
|
+
void pieces.container.stores.loadPiece({
|
|
28
|
+
name: "PluginMessageSubcommandNoMatch",
|
|
29
|
+
piece: PluginMessageSubcommandNoMatch_cjs.PluginListener,
|
|
30
|
+
store
|
|
31
|
+
});
|
|
32
|
+
void pieces.container.stores.loadPiece({
|
|
33
|
+
name: "PluginChatInputSubcommandNoMatch",
|
|
34
|
+
piece: PluginChatInputSubcommandNoMatch_cjs.PluginListener,
|
|
35
|
+
store
|
|
36
|
+
});
|
|
25
37
|
}
|
|
26
38
|
__name(loadListeners, "loadListeners");
|
|
27
39
|
|
|
28
40
|
exports.loadListeners = loadListeners;
|
|
29
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=_load.cjs.map
|
|
30
42
|
//# sourceMappingURL=_load.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/listeners/_load.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../../../src/listeners/_load.ts"],"names":["container","PluginChatInputSubcommandError","PluginMessageSubcommandError","PluginSubcommandMappingIsMissingChatInputCommandHandler","PluginSubcommandMappingIsMissingMessageCommandHandler","PluginMessageSubcommandNoMatch","PluginChatInputSubcommandNoMatch"],"mappings":";;;;;;;;;;;;AAQO,SAAS,aAAgB,GAAA;AAC/B,EAAA,MAAM,KAAQ,GAAA,WAAA,CAAA;AACd,EAAK,KAAAA,gBAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,gCAAkC,EAAA,KAAA,EAAOC,iDAAgC,EAAA,KAAA,EAAO,CAAA,CAAA;AACxH,EAAK,KAAAD,gBAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,8BAAgC,EAAA,KAAA,EAAOE,+CAA8B,EAAA,KAAA,EAAO,CAAA,CAAA;AACpH,EAAK,KAAAF,gBAAA,CAAU,OAAO,SAAU,CAAA;AAAA,IAC/B,IAAM,EAAA,yDAAA;AAAA,IACN,KAAO,EAAAG,0EAAA;AAAA,IACP,KAAA;AAAA,GACA,CAAA,CAAA;AACD,EAAK,KAAAH,gBAAA,CAAU,OAAO,SAAU,CAAA;AAAA,IAC/B,IAAM,EAAA,uDAAA;AAAA,IACN,KAAO,EAAAI,wEAAA;AAAA,IACP,KAAA;AAAA,GACA,CAAA,CAAA;AACD,EAAK,KAAAJ,gBAAA,CAAU,OAAO,SAAU,CAAA;AAAA,IAC/B,IAAM,EAAA,gCAAA;AAAA,IACN,KAAO,EAAAK,iDAAA;AAAA,IACP,KAAA;AAAA,GACA,CAAA,CAAA;AACD,EAAK,KAAAL,gBAAA,CAAU,OAAO,SAAU,CAAA;AAAA,IAC/B,IAAM,EAAA,kCAAA;AAAA,IACN,KAAO,EAAAM,mDAAA;AAAA,IACP,KAAA;AAAA,GACA,CAAA,CAAA;AACF,CAAA;AAxBgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"_load.cjs","sourcesContent":["import { container } from '@sapphire/pieces';\nimport { PluginListener as PluginChatInputSubcommandError } from './PluginChatInputSubcommandError';\nimport { PluginListener as PluginChatInputSubcommandNoMatch } from './PluginChatInputSubcommandNoMatch';\nimport { PluginListener as PluginMessageSubcommandError } from './PluginMessageSubcommandError';\nimport { PluginListener as PluginMessageSubcommandNoMatch } from './PluginMessageSubcommandNoMatch';\nimport { PluginListener as PluginSubcommandMappingIsMissingChatInputCommandHandler } from './PluginSubcommandMappingIsMissingChatInputCommandHandler';\nimport { PluginListener as PluginSubcommandMappingIsMissingMessageCommandHandler } from './PluginSubcommandMappingIsMissingMessageCommandHandler';\n\nexport function loadListeners() {\n\tconst store = 'listeners' as const;\n\tvoid container.stores.loadPiece({ name: 'PluginChatInputSubcommandError', piece: PluginChatInputSubcommandError, store });\n\tvoid container.stores.loadPiece({ name: 'PluginMessageSubcommandError', piece: PluginMessageSubcommandError, store });\n\tvoid container.stores.loadPiece({\n\t\tname: 'PluginSubcommandMappingIsMissingChatInputCommandHandler',\n\t\tpiece: PluginSubcommandMappingIsMissingChatInputCommandHandler,\n\t\tstore\n\t});\n\tvoid container.stores.loadPiece({\n\t\tname: 'PluginSubcommandMappingIsMissingMessageCommandHandler',\n\t\tpiece: PluginSubcommandMappingIsMissingMessageCommandHandler,\n\t\tstore\n\t});\n\tvoid container.stores.loadPiece({\n\t\tname: 'PluginMessageSubcommandNoMatch',\n\t\tpiece: PluginMessageSubcommandNoMatch,\n\t\tstore\n\t});\n\tvoid container.stores.loadPiece({\n\t\tname: 'PluginChatInputSubcommandNoMatch',\n\t\tpiece: PluginChatInputSubcommandNoMatch,\n\t\tstore\n\t});\n}\n"]}
|
|
@@ -9,10 +9,7 @@ var Enums_cjs = require('../lib/types/Enums.cjs');
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
10
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
11
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
-
var __publicField = (obj, key, value) =>
|
|
13
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14
|
-
return value;
|
|
15
|
-
};
|
|
12
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
16
13
|
var _PluginPrecondition = class _PluginPrecondition extends framework.AllFlowsPrecondition {
|
|
17
14
|
constructor() {
|
|
18
15
|
super(...arguments);
|
|
@@ -31,12 +28,9 @@ var _PluginPrecondition = class _PluginPrecondition extends framework.AllFlowsPr
|
|
|
31
28
|
return this.sharedRun(interaction.user.id, subcommand, context, cooldownId, "context menu");
|
|
32
29
|
}
|
|
33
30
|
sharedRun(authorId, subcommand, context, cooldownId, commandType) {
|
|
34
|
-
if (context.external)
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
return this.ok();
|
|
38
|
-
if (context.filteredUsers?.includes(authorId))
|
|
39
|
-
return this.ok();
|
|
31
|
+
if (context.external) return this.ok();
|
|
32
|
+
if (!context.delay) return this.ok();
|
|
33
|
+
if (context.filteredUsers?.includes(authorId)) return this.ok();
|
|
40
34
|
const rateLimit = this.getManager(subcommand, context).acquire(cooldownId);
|
|
41
35
|
if (rateLimit.limited) {
|
|
42
36
|
const remaining = rateLimit.remainingTime;
|
|
@@ -92,5 +86,5 @@ __name(_PluginPrecondition, "PluginPrecondition");
|
|
|
92
86
|
var PluginPrecondition = _PluginPrecondition;
|
|
93
87
|
|
|
94
88
|
exports.PluginPrecondition = PluginPrecondition;
|
|
95
|
-
//# sourceMappingURL=
|
|
89
|
+
//# sourceMappingURL=PluginSubcommandCooldown.cjs.map
|
|
96
90
|
//# sourceMappingURL=PluginSubcommandCooldown.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/preconditions/PluginSubcommandCooldown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/preconditions/PluginSubcommandCooldown.ts"],"names":["AllFlowsPrecondition","time","TimestampStyles","SubcommandIdentifiers","BucketScope","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,EAEQ,UAAA,CAAW,YAAwB,OAAsD,EAAA;AAChG,IAAA,IAAI,OAAU,GAAA,IAAA,CAAK,iBAAkB,CAAA,GAAA,CAAI,UAAU,CAAA,CAAA;AACnD,IAAA,IAAI,CAAC,OAAS,EAAA;AACb,MAAA,OAAA,GAAU,IAAIC,2BAAA,CAAiB,OAAQ,CAAA,KAAA,EAAO,QAAQ,KAAK,CAAA,CAAA;AAC3D,MAAK,IAAA,CAAA,iBAAA,CAAkB,GAAI,CAAA,UAAA,EAAY,OAAO,CAAA,CAAA;AAAA,KAC/C;AACA,IAAO,OAAA,OAAA,CAAA;AAAA,GACR;AACD,CAAA,CAAA;AA1G6D,MAAA,CAAA,mBAAA,EAAA,oBAAA,CAAA,CAAA;AAAtD,IAAM,kBAAN,GAAA","file":"PluginSubcommandCooldown.cjs","sourcesContent":["import { AllFlowsPrecondition, BucketScope, Command, CorePreconditions } from '@sapphire/framework';\nimport { RateLimitManager } from '@sapphire/ratelimits';\nimport {\n\tTimestampStyles,\n\ttime,\n\ttype ChatInputCommandInteraction,\n\ttype CommandInteraction,\n\ttype ContextMenuCommandInteraction,\n\ttype Message\n} from 'discord.js';\nimport { Subcommand } from '../lib/Subcommand';\nimport { SubcommandIdentifiers } from '../lib/types/Enums';\n\n/**\n * The context for the subcommand cooldown precondition\n * @since 5.1.0\n */\nexport interface PluginSubcommandCooldownPreconditionContext extends CorePreconditions.CooldownContext {\n\t/** The name of the subcommand */\n\tsubcommandMethodName: string;\n\t/** The name of the subcommand group, if any */\n\tsubcommandGroupName?: string;\n}\n\n/**\n * The subcommand cooldown precondition. This differs from the cooldown precondition in framework by using a separate\n * bucket as well as resolving the id differently to ensure it is specific to a subcommand.\n * @since 5.1.0\n */\nexport class PluginPrecondition extends AllFlowsPrecondition {\n\tpublic subcommandBuckets = new WeakMap<Subcommand, RateLimitManager<string>>();\n\n\tpublic override messageRun(\n\t\tmessage: Message,\n\t\tsubcommand: Subcommand,\n\t\tcontext: PluginSubcommandCooldownPreconditionContext\n\t): AllFlowsPrecondition.Result {\n\t\tconst cooldownId = this.getIdFromMessage(message, context);\n\n\t\treturn this.sharedRun(message.author.id, subcommand, context, cooldownId, 'message');\n\t}\n\n\tpublic override chatInputRun(\n\t\tinteraction: ChatInputCommandInteraction,\n\t\tsubcommand: Subcommand,\n\t\tcontext: PluginSubcommandCooldownPreconditionContext\n\t): AllFlowsPrecondition.Result {\n\t\tconst cooldownId = this.getIdFromInteraction(interaction, context);\n\n\t\treturn this.sharedRun(interaction.user.id, subcommand, context, cooldownId, 'chat input');\n\t}\n\n\tpublic override contextMenuRun(\n\t\tinteraction: ContextMenuCommandInteraction,\n\t\tsubcommand: Command,\n\t\tcontext: PluginSubcommandCooldownPreconditionContext\n\t): AllFlowsPrecondition.Result {\n\t\tconst cooldownId = this.getIdFromInteraction(interaction, context);\n\n\t\treturn this.sharedRun(interaction.user.id, subcommand as Subcommand, context, cooldownId, 'context menu');\n\t}\n\n\tprivate sharedRun(\n\t\tauthorId: string,\n\t\tsubcommand: Subcommand,\n\t\tcontext: PluginSubcommandCooldownPreconditionContext,\n\t\tcooldownId: string,\n\t\tcommandType: string\n\t): AllFlowsPrecondition.Result {\n\t\t// If the subcommand it is testing for is not this one, return ok:\n\t\tif (context.external) return this.ok();\n\n\t\t// If there is no delay (undefined, null, 0), return ok:\n\t\tif (!context.delay) return this.ok();\n\n\t\t// If the user has provided any filtered users and the authorId is in that array, return ok:\n\t\tif (context.filteredUsers?.includes(authorId)) return this.ok();\n\n\t\tconst rateLimit = this.getManager(subcommand, context).acquire(cooldownId);\n\n\t\tif (rateLimit.limited) {\n\t\t\tconst remaining = rateLimit.remainingTime;\n\n\t\t\tconst nextAvailable = time(Math.floor(rateLimit.expires / 1000), TimestampStyles.RelativeTime);\n\t\t\treturn this.error({\n\t\t\t\tidentifier: SubcommandIdentifiers.SubcommandPreconditionCooldown,\n\t\t\t\tmessage: `There is a cooldown in effect for this ${commandType} subcommand. It'll be available ${nextAvailable}.`,\n\t\t\t\tcontext: { remaining }\n\t\t\t});\n\t\t}\n\n\t\trateLimit.consume();\n\t\treturn this.ok();\n\t}\n\n\tprivate getIdFromMessage(message: Message, context: PluginSubcommandCooldownPreconditionContext) {\n\t\tconst subcommandIdentifier = this.getSubcommandMappingName(context);\n\t\tswitch (context.scope) {\n\t\t\tcase BucketScope.Global:\n\t\t\t\treturn `global.${subcommandIdentifier}`;\n\t\t\tcase BucketScope.Channel:\n\t\t\t\treturn `${message.channelId}.${subcommandIdentifier}`;\n\t\t\tcase BucketScope.Guild:\n\t\t\t\treturn `${message.guildId}.${subcommandIdentifier}` ?? `${message.channelId}.${subcommandIdentifier}`;\n\t\t\tdefault:\n\t\t\t\treturn `${message.author.id}.${subcommandIdentifier}`;\n\t\t}\n\t}\n\n\tprivate getIdFromInteraction(interaction: CommandInteraction, context: PluginSubcommandCooldownPreconditionContext) {\n\t\tconst subcommandIdentifier = this.getSubcommandMappingName(context);\n\t\tswitch (context.scope) {\n\t\t\tcase BucketScope.Global:\n\t\t\t\treturn `global.${subcommandIdentifier}`;\n\t\t\tcase BucketScope.Channel:\n\t\t\t\treturn `${interaction.channelId}.${subcommandIdentifier}`;\n\t\t\tcase BucketScope.Guild:\n\t\t\t\treturn `${interaction.guildId}.${subcommandIdentifier}` ?? `${interaction.channelId}.${subcommandIdentifier}`;\n\t\t\tdefault:\n\t\t\t\treturn `${interaction.user.id}.${subcommandIdentifier}`;\n\t\t}\n\t}\n\n\tprivate getSubcommandMappingName(context: PluginSubcommandCooldownPreconditionContext) {\n\t\treturn context.subcommandGroupName ? `${context.subcommandGroupName}.${context.subcommandMethodName}` : context.subcommandMethodName;\n\t}\n\n\tprivate getManager(subcommand: Subcommand, context: PluginSubcommandCooldownPreconditionContext) {\n\t\tlet manager = this.subcommandBuckets.get(subcommand);\n\t\tif (!manager) {\n\t\t\tmanager = new RateLimitManager(context.delay, context.limit);\n\t\t\tthis.subcommandBuckets.set(subcommand, manager);\n\t\t}\n\t\treturn manager;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/preconditions/_load.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/preconditions/_load.ts"],"names":["container","PluginSubcommandCooldown"],"mappings":";;;;;;;AAGO,SAAS,iBAAoB,GAAA;AACnC,EAAA,MAAM,KAAQ,GAAA,eAAA,CAAA;AACd,EAAK,KAAAA,gBAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,0BAA4B,EAAA,KAAA,EAAOC,+CAA0B,EAAA,KAAA,EAAO,CAAA,CAAA;AAC7G,CAAA;AAHgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA","file":"_load.cjs","sourcesContent":["import { container } from '@sapphire/pieces';\nimport { PluginPrecondition as PluginSubcommandCooldown } from './PluginSubcommandCooldown';\n\nexport function loadPreconditions() {\n\tconst store = 'preconditions' as const;\n\tvoid container.stores.loadPiece({ name: 'PluginSubcommandCooldown', piece: PluginSubcommandCooldown, store });\n}\n"]}
|
package/dist/cjs/register.cjs
CHANGED
|
@@ -21,5 +21,5 @@ var SubcommandsPlugin = _SubcommandsPlugin;
|
|
|
21
21
|
framework.SapphireClient.plugins.registerPostInitializationHook(SubcommandsPlugin[framework.postInitialization], "Subcommand-PostInitialization");
|
|
22
22
|
|
|
23
23
|
exports.SubcommandsPlugin = SubcommandsPlugin;
|
|
24
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=register.cjs.map
|
|
25
25
|
//# sourceMappingURL=register.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/register.ts"],"names":["Plugin","postInitialization","loadPreconditions","loadListeners","SapphireClient"],"mappings":";;;;;;;AASO,IAAM,kBAAA,GAAN,MAAM,kBAAA,SAA0BA,gBAAO,CAAA;AAAA;AAAA;AAAA;AAAA,EAI7C,QAAeC,4BAAkB,CAAA,CAAwB,OAA8B,EAAA;AACtF,IAAkBC,2BAAA,EAAA,CAAA;AAElB,IAAI,IAAA,OAAA,CAAQ,iCAAiC,KAAO,EAAA;AACnD,MAAcC,uBAAA,EAAA,CAAA;AAAA,KACf;AAAA,GACD;AACD,CAAA,CAAA;AAX8C,MAAA,CAAA,kBAAA,EAAA,mBAAA,CAAA,CAAA;AAAvC,IAAM,iBAAN,GAAA,mBAAA;AAaPC,wBAAA,CAAe,OAAQ,CAAA,8BAAA,CAA+B,iBAAkB,CAAAH,4BAAkB,GAAG,+BAA+B,CAAA","file":"register.cjs","sourcesContent":["import './index';\n\nimport { Plugin, postInitialization, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, loadPreconditions } from './index';\n\n/**\n * @since 3.1.2\n */\nexport class SubcommandsPlugin extends Plugin {\n\t/**\n\t * @since 3.1.2\n\t */\n\tpublic static [postInitialization](this: SapphireClient, options: ClientOptions): void {\n\t\tloadPreconditions();\n\n\t\tif (options.loadSubcommandErrorListeners !== false) {\n\t\t\tloadListeners();\n\t\t}\n\t}\n}\n\nSapphireClient.plugins.registerPostInitializationHook(SubcommandsPlugin[postInitialization], 'Subcommand-PostInitialization');\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
9
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
11
|
+
|
|
12
|
+
export { __name, __privateAdd, __privateMethod, __publicField };
|
|
13
|
+
//# sourceMappingURL=chunk-3IXKS7M5.mjs.map
|
|
14
|
+
//# sourceMappingURL=chunk-3IXKS7M5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-3IXKS7M5.mjs"}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _sapphire_framework from '@sapphire/framework';
|
|
2
|
-
import { Command, Args, PreconditionContainerArray,
|
|
2
|
+
import { Command, Args, PreconditionContainerArray, MessageCommand, ChatInputCommand, CorePreconditions, AllFlowsPrecondition, BucketScope, UserError, ChatInputCommandContext, MessageCommandDeniedPayload, CooldownOptions } from '@sapphire/framework';
|
|
3
3
|
import { Message, CacheType, ChatInputCommandInteraction, ContextMenuCommandInteraction } from 'discord.js';
|
|
4
4
|
import { RateLimitManager } from '@sapphire/ratelimits';
|
|
5
5
|
|
|
@@ -137,7 +137,7 @@ declare class Subcommand<PreParseReturn extends Args = Args, Options extends Sub
|
|
|
137
137
|
* Whether this command has message-based subcommands or not
|
|
138
138
|
* @returns `true` if this command has message-based subcommands, otherwise `false`
|
|
139
139
|
*/
|
|
140
|
-
supportsMessageCommands():
|
|
140
|
+
supportsMessageCommands(): this is MessageCommand;
|
|
141
141
|
/**
|
|
142
142
|
* Whether this command has chat input subcommands or not
|
|
143
143
|
* @returns `true` if this command has chat input subcommands, otherwise `false`
|
|
@@ -250,10 +250,12 @@ declare const SubcommandPluginEvents: {
|
|
|
250
250
|
ChatInputSubcommandRun: "chatInputSubcommandRun";
|
|
251
251
|
ChatInputSubcommandSuccess: "chatInputSubcommandSuccess";
|
|
252
252
|
ChatInputSubcommandError: "chatInputSubcommandError";
|
|
253
|
+
ChatInputSubcommandNoMatch: "chatInputSubcommandNoMatch";
|
|
253
254
|
MessageSubcommandDenied: "messageSubcommandDenied";
|
|
254
255
|
MessageSubcommandRun: "messageSubcommandRun";
|
|
255
256
|
MessageSubcommandSuccess: "messageSubcommandSuccess";
|
|
256
257
|
MessageSubcommandError: "messageSubcommandError";
|
|
258
|
+
MessageSubcommandNoMatch: "messageSubcommandNoMatch";
|
|
257
259
|
SubcommandMappingIsMissingMessageCommandHandler: "subcommandMappingIsMissingMessageCommandHandler";
|
|
258
260
|
SubcommandMappingIsMissingChatInputCommandHandler: "subcommandMappingIsMissingChatInputCommandHandler";
|
|
259
261
|
};
|
|
@@ -263,9 +265,17 @@ declare enum SubcommandPluginIdentifiers {
|
|
|
263
265
|
SubcommandNotFound = "subcommandNotFound"
|
|
264
266
|
}
|
|
265
267
|
interface MessageSubcommandNoMatchContext extends MessageCommand.RunContext {
|
|
268
|
+
command: Subcommand;
|
|
269
|
+
identifier: SubcommandPluginIdentifiers.MessageSubcommandNoMatch;
|
|
270
|
+
message: string;
|
|
266
271
|
possibleSubcommandName: string | null;
|
|
267
272
|
possibleSubcommandGroupOrName: string | null;
|
|
268
273
|
}
|
|
274
|
+
interface ChatInputSubcommandNoMatchContext extends ChatInputCommandContext {
|
|
275
|
+
command: Subcommand;
|
|
276
|
+
identifier: SubcommandPluginIdentifiers.ChatInputSubcommandNoMatch;
|
|
277
|
+
message: string;
|
|
278
|
+
}
|
|
269
279
|
interface IMessageSubcommandPayload {
|
|
270
280
|
message: Message;
|
|
271
281
|
command: Subcommand;
|
|
@@ -315,6 +325,7 @@ declare module 'discord.js' {
|
|
|
315
325
|
payload: ChatInputSubcommandSuccessPayload
|
|
316
326
|
];
|
|
317
327
|
[SubcommandPluginEvents.ChatInputSubcommandError]: [error: unknown, payload: ChatInputSubcommandErrorPayload];
|
|
328
|
+
[SubcommandPluginEvents.ChatInputSubcommandNoMatch]: [interaction: ChatInputCommand.Interaction, context: ChatInputSubcommandNoMatchContext];
|
|
318
329
|
[SubcommandPluginEvents.MessageSubcommandDenied]: [error: UserError, payload: MessageSubcommandDeniedPayload];
|
|
319
330
|
[SubcommandPluginEvents.MessageSubcommandRun]: [
|
|
320
331
|
message: Message,
|
|
@@ -327,6 +338,7 @@ declare module 'discord.js' {
|
|
|
327
338
|
payload: MessageSubcommandSuccessPayload
|
|
328
339
|
];
|
|
329
340
|
[SubcommandPluginEvents.MessageSubcommandError]: [error: unknown, payload: MessageSubcommandErrorPayload];
|
|
341
|
+
[SubcommandPluginEvents.MessageSubcommandNoMatch]: [message: Message, args: Args, context: MessageSubcommandNoMatchContext];
|
|
330
342
|
[SubcommandPluginEvents.SubcommandMappingIsMissingMessageCommandHandler]: [
|
|
331
343
|
message: Message,
|
|
332
344
|
subcommand: SubcommandMappingMethod,
|
|
@@ -372,6 +384,8 @@ declare module '@sapphire/framework' {
|
|
|
372
384
|
/**
|
|
373
385
|
* The preconditions specific to subcommands
|
|
374
386
|
* @since 5.1.0
|
|
387
|
+
* @deprecated - This will be replaced with a regular top level export of {@link PluginSubcommandCooldown}
|
|
388
|
+
* in the next major version as opposed to a namespaced export.
|
|
375
389
|
*/
|
|
376
390
|
declare const SubcommandPreconditions: {
|
|
377
391
|
PluginSubcommandCooldown: typeof PluginPrecondition;
|
|
@@ -379,6 +393,8 @@ declare const SubcommandPreconditions: {
|
|
|
379
393
|
/**
|
|
380
394
|
* The preconditions specific to subcommands
|
|
381
395
|
* @since 5.1.0
|
|
396
|
+
* @deprecated - This will be replaced with a regular top level export of {@link PluginSubcommandCooldownPreconditionContext}
|
|
397
|
+
* in the next major version as opposed to a namespaced export.
|
|
382
398
|
*/
|
|
383
399
|
declare namespace SubcommandPreconditions {
|
|
384
400
|
/** The context for the subcommand cooldown precondition */
|
|
@@ -392,4 +408,4 @@ declare namespace SubcommandPreconditions {
|
|
|
392
408
|
*/
|
|
393
409
|
declare const version: string;
|
|
394
410
|
|
|
395
|
-
export { type ChatInputCommandSubcommandMappingMethod, type ChatInputSubcommandAcceptedPayload, type ChatInputSubcommandDeniedPayload, type ChatInputSubcommandErrorPayload, type ChatInputSubcommandRunPayload, type ChatInputSubcommandSuccessPayload, type IChatInputSubcommandPayload, type IMessageSubcommandPayload, type MessageSubcommandAcceptedPayload, type MessageSubcommandDeniedPayload, type MessageSubcommandErrorPayload, type MessageSubcommandMappingMethod, type MessageSubcommandNoMatchContext, type MessageSubcommandRunPayload, type MessageSubcommandSuccessPayload, Subcommand, SubcommandCommandPreConditions, SubcommandIdentifiers, type SubcommandMapping, type SubcommandMappingArray, type SubcommandMappingGroup, type SubcommandMappingMethod, type SubcommandOptions, SubcommandPluginEvents, SubcommandPluginIdentifiers, subcommandCooldown as SubcommandPreconditionResolvers, SubcommandPreconditions, loadListeners, loadPreconditions, version };
|
|
411
|
+
export { type ChatInputCommandSubcommandMappingMethod, type ChatInputSubcommandAcceptedPayload, type ChatInputSubcommandDeniedPayload, type ChatInputSubcommandErrorPayload, type ChatInputSubcommandNoMatchContext, type ChatInputSubcommandRunPayload, type ChatInputSubcommandSuccessPayload, type IChatInputSubcommandPayload, type IMessageSubcommandPayload, type MessageSubcommandAcceptedPayload, type MessageSubcommandDeniedPayload, type MessageSubcommandErrorPayload, type MessageSubcommandMappingMethod, type MessageSubcommandNoMatchContext, type MessageSubcommandRunPayload, type MessageSubcommandSuccessPayload, PluginPrecondition as PluginSubcommandCooldownPrecondition, type PluginSubcommandCooldownPreconditionContext, Subcommand, SubcommandCommandPreConditions, SubcommandIdentifiers, type SubcommandMapping, type SubcommandMappingArray, type SubcommandMappingGroup, type SubcommandMappingMethod, type SubcommandOptions, SubcommandPluginEvents, SubcommandPluginIdentifiers, subcommandCooldown as SubcommandPreconditionResolvers, SubcommandPreconditions, loadListeners, loadPreconditions, version };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import './chunk-
|
|
1
|
+
import './chunk-3IXKS7M5.mjs';
|
|
2
2
|
import { PluginPrecondition } from './preconditions/PluginSubcommandCooldown.mjs';
|
|
3
|
+
export { PluginPrecondition as PluginSubcommandCooldownPrecondition } from './preconditions/PluginSubcommandCooldown.mjs';
|
|
3
4
|
export * from './lib/Subcommand.mjs';
|
|
4
5
|
import * as subcommandCooldown_mjs from './lib/precondition-resolvers/subcommandCooldown.mjs';
|
|
5
6
|
export { subcommandCooldown_mjs as SubcommandPreconditionResolvers };
|
|
@@ -12,8 +13,8 @@ export { loadPreconditions } from './preconditions/_load.mjs';
|
|
|
12
13
|
var SubcommandPreconditions = {
|
|
13
14
|
PluginSubcommandCooldown: PluginPrecondition
|
|
14
15
|
};
|
|
15
|
-
var version = "
|
|
16
|
+
var version = "7.0.0-next.6e7a5bf";
|
|
16
17
|
|
|
17
18
|
export { SubcommandPreconditions, version };
|
|
18
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
19
20
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":["PluginSubcommandCooldown"],"mappings":";;;;;;;;;;;;AAoDO,IAAM,uBAA0B,GAAA;AAAA,4BACtCA,kBAAA;AACD,EAAA;AAoBO,IAAM,OAAkB,GAAA","file":"index.mjs","sourcesContent":["import type { CooldownOptions } from '@sapphire/framework';\nimport {\n\tPluginPrecondition as PluginSubcommandCooldown,\n\ttype PluginSubcommandCooldownPreconditionContext\n} from './preconditions/PluginSubcommandCooldown';\n\nexport * from './lib/Subcommand';\nexport * as SubcommandPreconditionResolvers from './lib/precondition-resolvers/subcommandCooldown';\nexport * from './lib/types/Enums';\nexport * from './lib/types/Events';\nexport * from './lib/types/SubcommandMappings';\nexport {\n\tPluginPrecondition as PluginSubcommandCooldownPrecondition,\n\ttype PluginSubcommandCooldownPreconditionContext\n} from './preconditions/PluginSubcommandCooldown';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadPreconditions } from './preconditions/_load';\n\ndeclare module 'discord.js' {\n\tinterface ClientOptions {\n\t\t/**\n\t\t * If Plugin-subcommand to load pre-included subcommand error event listeners that log any encountered errors to the {@link SapphireClient.logger} instance\n\t\t * @since 3.1.2\n\t\t * @default true\n\t\t */\n\t\tloadSubcommandErrorListeners?: boolean;\n\t\t/**\n\t\t * Sets the default cooldown time for all subcommands.\n\t\t * @remark This is separate from {@link ClientOptions.defaultCooldown} as it is only used for subcommands\n\t\t * @remark Note that for the `filteredCommands` option you have to provide it as\n\t\t * - For a subcommand without a group: `commandName.subcommandName` (e.g. `config.show`).\n\t\t * - For a subcommand with a group: `commandName.groupName.subcommandName` (e.g. `config.set.prefix`).\n\t\t * @since 5.1.0\n\t\t * @default \"No cooldown options\"\n\t\t */\n\t\tsubcommandDefaultCooldown?: CooldownOptions;\n\t}\n}\n\ndeclare module '@sapphire/framework' {\n\tinterface Preconditions {\n\t\tPluginSubcommandCooldown: SubcommandPreconditions.PluginSubcommandCooldownContext;\n\t}\n}\n\n/**\n * The preconditions specific to subcommands\n * @since 5.1.0\n * @deprecated - This will be replaced with a regular top level export of {@link PluginSubcommandCooldown}\n * in the next major version as opposed to a namespaced export.\n */\nexport const SubcommandPreconditions = {\n\tPluginSubcommandCooldown\n};\n\n/**\n * The preconditions specific to subcommands\n * @since 5.1.0\n * @deprecated - This will be replaced with a regular top level export of {@link PluginSubcommandCooldownPreconditionContext}\n * in the next major version as opposed to a namespaced export.\n */\nexport namespace SubcommandPreconditions {\n\t/** The context for the subcommand cooldown precondition */\n\texport type PluginSubcommandCooldownContext = PluginSubcommandCooldownPreconditionContext;\n}\n\n/**\n * The [@sapphire/plugin-subcommands](https://github.com/sapphiredev/plugins/blob/main/packages/subcommands) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '7.0.0-next.6e7a5bf';\n"]}
|