@buape/carbon 0.8.0 → 0.10.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/package.json +7 -7
- package/dist/src/abstracts/AnySelectMenu.d.ts +2 -1
- package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -1
- package/dist/src/abstracts/AnySelectMenu.js +6 -0
- package/dist/src/abstracts/AnySelectMenu.js.map +1 -1
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +0 -1
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/AnySelectMenuInteraction.js +0 -2
- package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseChannel.d.ts +10 -1
- package/dist/src/abstracts/BaseChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseChannel.js +13 -0
- package/dist/src/abstracts/BaseChannel.js.map +1 -1
- package/dist/src/abstracts/BaseCommand.d.ts +18 -8
- package/dist/src/abstracts/BaseCommand.d.ts.map +1 -1
- package/dist/src/abstracts/BaseCommand.js +24 -7
- package/dist/src/abstracts/BaseCommand.js.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +0 -1
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.js +3 -3
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.d.ts +3 -2
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.js +5 -3
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.d.ts +45 -2
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.js +99 -14
- package/dist/src/abstracts/BaseInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseMessageInteractiveComponent.d.ts +18 -12
- package/dist/src/abstracts/BaseMessageInteractiveComponent.d.ts.map +1 -1
- package/dist/src/abstracts/BaseMessageInteractiveComponent.js +18 -18
- package/dist/src/abstracts/BaseMessageInteractiveComponent.js.map +1 -1
- package/dist/src/abstracts/BaseModalComponent.d.ts +16 -10
- package/dist/src/abstracts/BaseModalComponent.d.ts.map +1 -1
- package/dist/src/abstracts/BaseModalComponent.js +25 -17
- package/dist/src/abstracts/BaseModalComponent.js.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +11 -4
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.js +14 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -1
- package/dist/src/abstracts/Plugin.d.ts +1 -1
- package/dist/src/abstracts/Plugin.d.ts.map +1 -1
- package/dist/src/classes/Client.d.ts +32 -8
- package/dist/src/classes/Client.d.ts.map +1 -1
- package/dist/src/classes/Client.js +76 -17
- package/dist/src/classes/Client.js.map +1 -1
- package/dist/src/classes/ClientWithCaching.d.ts +51 -0
- package/dist/src/classes/ClientWithCaching.d.ts.map +1 -0
- package/dist/src/classes/ClientWithCaching.js +108 -0
- package/dist/src/classes/ClientWithCaching.js.map +1 -0
- package/dist/src/classes/Command.d.ts +10 -2
- package/dist/src/classes/Command.d.ts.map +1 -1
- package/dist/src/classes/Command.js +12 -1
- package/dist/src/classes/Command.js.map +1 -1
- package/dist/src/classes/Listener.d.ts +20 -0
- package/dist/src/classes/Listener.d.ts.map +1 -1
- package/dist/src/classes/Listener.js +116 -14
- package/dist/src/classes/Listener.js.map +1 -1
- package/dist/src/classes/Modal.d.ts +19 -2
- package/dist/src/classes/Modal.d.ts.map +1 -1
- package/dist/src/classes/Modal.js +14 -0
- package/dist/src/classes/Modal.js.map +1 -1
- package/dist/src/classes/RequestClient.d.ts +7 -5
- package/dist/src/classes/RequestClient.d.ts.map +1 -1
- package/dist/src/classes/RequestClient.js +28 -16
- package/dist/src/classes/RequestClient.js.map +1 -1
- package/dist/src/classes/components/Button.d.ts +3 -1
- package/dist/src/classes/components/Button.d.ts.map +1 -1
- package/dist/src/classes/components/Button.js +10 -1
- package/dist/src/classes/components/Button.js.map +1 -1
- package/dist/src/classes/components/ChannelSelectMenu.d.ts +2 -1
- package/dist/src/classes/components/ChannelSelectMenu.d.ts.map +1 -1
- package/dist/src/classes/components/ChannelSelectMenu.js +6 -0
- package/dist/src/classes/components/ChannelSelectMenu.js.map +1 -1
- package/dist/src/classes/components/Container.d.ts +0 -3
- package/dist/src/classes/components/Container.d.ts.map +1 -1
- package/dist/src/classes/components/Container.js +0 -3
- package/dist/src/classes/components/Container.js.map +1 -1
- package/dist/src/classes/components/MentionableSelectMenu.d.ts +2 -1
- package/dist/src/classes/components/MentionableSelectMenu.d.ts.map +1 -1
- package/dist/src/classes/components/MentionableSelectMenu.js +6 -0
- package/dist/src/classes/components/MentionableSelectMenu.js.map +1 -1
- package/dist/src/classes/components/RoleSelectMenu.d.ts +2 -1
- package/dist/src/classes/components/RoleSelectMenu.d.ts.map +1 -1
- package/dist/src/classes/components/RoleSelectMenu.js +6 -0
- package/dist/src/classes/components/RoleSelectMenu.js.map +1 -1
- package/dist/src/classes/components/StringSelectMenu.d.ts +2 -1
- package/dist/src/classes/components/StringSelectMenu.d.ts.map +1 -1
- package/dist/src/classes/components/StringSelectMenu.js +6 -0
- package/dist/src/classes/components/StringSelectMenu.js.map +1 -1
- package/dist/src/classes/components/UserSelectMenu.d.ts +2 -1
- package/dist/src/classes/components/UserSelectMenu.d.ts.map +1 -1
- package/dist/src/classes/components/UserSelectMenu.js +6 -0
- package/dist/src/classes/components/UserSelectMenu.js.map +1 -1
- package/dist/src/functions/enforceChoicesLimit.d.ts +3 -0
- package/dist/src/functions/enforceChoicesLimit.d.ts.map +1 -0
- package/dist/src/functions/enforceChoicesLimit.js +17 -0
- package/dist/src/functions/enforceChoicesLimit.js.map +1 -0
- package/dist/src/functions/errorsMapper.d.ts.map +1 -1
- package/dist/src/functions/errorsMapper.js +13 -1
- package/dist/src/functions/errorsMapper.js.map +1 -1
- package/dist/src/index.d.ts +8 -54
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.d.ts +9 -3
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.js +13 -3
- package/dist/src/internals/AutocompleteInteraction.js.map +1 -1
- package/dist/src/internals/ButtonInteraction.d.ts +0 -1
- package/dist/src/internals/ButtonInteraction.d.ts.map +1 -1
- package/dist/src/internals/ButtonInteraction.js +0 -2
- package/dist/src/internals/ButtonInteraction.js.map +1 -1
- package/dist/src/internals/Cache.d.ts +76 -0
- package/dist/src/internals/Cache.d.ts.map +1 -0
- package/dist/src/internals/Cache.js +122 -0
- package/dist/src/internals/Cache.js.map +1 -0
- package/dist/src/internals/CommandHandler.d.ts +2 -1
- package/dist/src/internals/CommandHandler.d.ts.map +1 -1
- package/dist/src/internals/CommandHandler.js +44 -13
- package/dist/src/internals/CommandHandler.js.map +1 -1
- package/dist/src/internals/CommandInteraction.d.ts +7 -1
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -1
- package/dist/src/internals/CommandInteraction.js +10 -4
- package/dist/src/internals/CommandInteraction.js.map +1 -1
- package/dist/src/internals/ComponentHandler.d.ts +5 -2
- package/dist/src/internals/ComponentHandler.d.ts.map +1 -1
- package/dist/src/internals/ComponentHandler.js +34 -10
- package/dist/src/internals/ComponentHandler.js.map +1 -1
- package/dist/src/internals/ModalHandler.d.ts +1 -1
- package/dist/src/internals/ModalHandler.d.ts.map +1 -1
- package/dist/src/internals/ModalHandler.js +6 -2
- package/dist/src/internals/ModalHandler.js.map +1 -1
- package/dist/src/internals/ModalInteraction.js +1 -1
- package/dist/src/internals/ModalInteraction.js.map +1 -1
- package/dist/src/internals/OptionsHandler.d.ts +13 -3
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -1
- package/dist/src/internals/OptionsHandler.js +51 -1
- package/dist/src/internals/OptionsHandler.js.map +1 -1
- package/dist/src/permissions.d.ts +54 -0
- package/dist/src/permissions.d.ts.map +1 -0
- package/dist/src/permissions.js +4 -0
- package/dist/src/permissions.js.map +1 -0
- package/dist/src/plugins/command-data/CommandDataPlugin.d.ts +16 -0
- package/dist/src/plugins/command-data/CommandDataPlugin.d.ts.map +1 -0
- package/dist/src/plugins/command-data/CommandDataPlugin.js +46 -0
- package/dist/src/plugins/command-data/CommandDataPlugin.js.map +1 -0
- package/dist/src/plugins/command-data/index.d.ts +2 -0
- package/dist/src/plugins/command-data/index.d.ts.map +1 -0
- package/dist/src/plugins/command-data/index.js +2 -0
- package/dist/src/plugins/command-data/index.js.map +1 -0
- package/dist/src/plugins/gateway/GatewayPlugin.d.ts +47 -3
- package/dist/src/plugins/gateway/GatewayPlugin.d.ts.map +1 -1
- package/dist/src/plugins/gateway/GatewayPlugin.js +169 -22
- package/dist/src/plugins/gateway/GatewayPlugin.js.map +1 -1
- package/dist/src/plugins/gateway/types.d.ts +58 -0
- package/dist/src/plugins/gateway/types.d.ts.map +1 -1
- package/dist/src/plugins/gateway/types.js.map +1 -1
- package/dist/src/plugins/gateway/utils/monitor.d.ts +2 -0
- package/dist/src/plugins/gateway/utils/monitor.d.ts.map +1 -1
- package/dist/src/plugins/gateway/utils/monitor.js +10 -1
- package/dist/src/plugins/gateway/utils/monitor.js.map +1 -1
- package/dist/src/plugins/gateway/utils/payload.d.ts +8 -5
- package/dist/src/plugins/gateway/utils/payload.d.ts.map +1 -1
- package/dist/src/plugins/gateway/utils/payload.js +20 -1
- package/dist/src/plugins/gateway/utils/payload.js.map +1 -1
- package/dist/src/plugins/gateway/utils/rateLimit.d.ts +41 -0
- package/dist/src/plugins/gateway/utils/rateLimit.d.ts.map +1 -0
- package/dist/src/plugins/gateway/utils/rateLimit.js +61 -0
- package/dist/src/plugins/gateway/utils/rateLimit.js.map +1 -0
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.d.ts +1 -1
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.d.ts.map +1 -1
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js +2 -2
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js.map +1 -1
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts +10 -0
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts.map +1 -0
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js +11 -0
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js.map +1 -0
- package/dist/src/plugins/gateway-forwarder/index.d.ts +1 -0
- package/dist/src/plugins/gateway-forwarder/index.d.ts.map +1 -1
- package/dist/src/plugins/gateway-forwarder/index.js +1 -0
- package/dist/src/plugins/gateway-forwarder/index.js.map +1 -1
- package/dist/src/plugins/paginator/GoToPageModal.d.ts +24 -0
- package/dist/src/plugins/paginator/GoToPageModal.d.ts.map +1 -0
- package/dist/src/plugins/paginator/GoToPageModal.js +50 -0
- package/dist/src/plugins/paginator/GoToPageModal.js.map +1 -0
- package/dist/src/plugins/paginator/Paginator.d.ts +53 -0
- package/dist/src/plugins/paginator/Paginator.d.ts.map +1 -0
- package/dist/src/plugins/paginator/Paginator.js +183 -0
- package/dist/src/plugins/paginator/Paginator.js.map +1 -0
- package/dist/src/plugins/paginator/index.d.ts +9 -0
- package/dist/src/plugins/paginator/index.d.ts.map +1 -0
- package/dist/src/plugins/paginator/index.js +9 -0
- package/dist/src/plugins/paginator/index.js.map +1 -0
- package/dist/src/plugins/sharding/ShardingPlugin.d.ts +3 -1
- package/dist/src/plugins/sharding/ShardingPlugin.d.ts.map +1 -1
- package/dist/src/plugins/sharding/ShardingPlugin.js +11 -2
- package/dist/src/plugins/sharding/ShardingPlugin.js.map +1 -1
- package/dist/src/structures/DmChannel.d.ts +3 -3
- package/dist/src/structures/DmChannel.d.ts.map +1 -1
- package/dist/src/structures/DmChannel.js +5 -3
- package/dist/src/structures/DmChannel.js.map +1 -1
- package/dist/src/structures/GroupDmChannel.d.ts +1 -1
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -1
- package/dist/src/structures/Guild.d.ts +184 -5
- package/dist/src/structures/Guild.d.ts.map +1 -1
- package/dist/src/structures/Guild.js +406 -12
- package/dist/src/structures/Guild.js.map +1 -1
- package/dist/src/structures/GuildCategoryChannel.d.ts +1 -1
- package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildForumChannel.d.ts +1 -1
- package/dist/src/structures/GuildForumChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildMember.d.ts +15 -12
- package/dist/src/structures/GuildMember.d.ts.map +1 -1
- package/dist/src/structures/GuildMember.js +78 -19
- package/dist/src/structures/GuildMember.js.map +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildTextChannel.d.ts +1 -1
- package/dist/src/structures/GuildTextChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildThreadChannel.d.ts +1 -1
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -1
- package/dist/src/structures/Message.d.ts +29 -10
- package/dist/src/structures/Message.d.ts.map +1 -1
- package/dist/src/structures/Message.js +82 -18
- package/dist/src/structures/Message.js.map +1 -1
- package/dist/src/structures/Poll.d.ts +25 -0
- package/dist/src/structures/Poll.d.ts.map +1 -0
- package/dist/src/structures/Poll.js +45 -0
- package/dist/src/structures/Poll.js.map +1 -0
- package/dist/src/structures/Role.d.ts +29 -12
- package/dist/src/structures/Role.d.ts.map +1 -1
- package/dist/src/structures/Role.js +48 -21
- package/dist/src/structures/Role.js.map +1 -1
- package/dist/src/structures/ThreadMember.d.ts +36 -0
- package/dist/src/structures/ThreadMember.d.ts.map +1 -0
- package/dist/src/structures/ThreadMember.js +72 -0
- package/dist/src/structures/ThreadMember.js.map +1 -0
- package/dist/src/structures/User.d.ts +7 -2
- package/dist/src/structures/User.d.ts.map +1 -1
- package/dist/src/structures/User.js +8 -1
- package/dist/src/structures/User.js.map +1 -1
- package/dist/src/structures/Webhook.d.ts +135 -0
- package/dist/src/structures/Webhook.d.ts.map +1 -0
- package/dist/src/structures/Webhook.js +239 -0
- package/dist/src/structures/Webhook.js.map +1 -0
- package/dist/src/types/index.d.ts +73 -8
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/listeners.d.ts +71 -44
- package/dist/src/types/listeners.d.ts.map +1 -1
- package/dist/src/types/listeners.js.map +1 -1
- package/dist/src/utils/customIdParser.d.ts +3 -0
- package/dist/src/utils/customIdParser.d.ts.map +1 -0
- package/dist/src/utils/customIdParser.js +17 -0
- package/dist/src/utils/customIdParser.js.map +1 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +4 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/payload.d.ts +4 -0
- package/dist/src/utils/payload.d.ts.map +1 -0
- package/dist/src/utils/payload.js +45 -0
- package/dist/src/utils/payload.js.map +1 -0
- package/dist/src/utils/verification.d.ts +4 -0
- package/dist/src/utils/verification.d.ts.map +1 -0
- package/dist/src/utils/verification.js +52 -0
- package/dist/src/utils/verification.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/dist/src/utils.d.ts +0 -9
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -93
- package/dist/src/utils.js.map +0 -1
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { type APIApplicationCommandAutocompleteInteraction, ApplicationCommandOptionType } from "discord-api-types/v10";
|
|
2
2
|
import { BaseInteraction, type InteractionDefaults } from "../abstracts/BaseInteraction.js";
|
|
3
3
|
import type { Client } from "../classes/Client.js";
|
|
4
|
+
import type { Command } from "../classes/Command.js";
|
|
4
5
|
import { OptionsHandler } from "./OptionsHandler.js";
|
|
5
6
|
export declare class AutocompleteInteraction extends BaseInteraction<APIApplicationCommandAutocompleteInteraction> {
|
|
6
7
|
/**
|
|
7
8
|
* This is the options of the commands, parsed from the interaction data.
|
|
8
9
|
*/
|
|
9
10
|
options: AutocompleteOptionsHandler;
|
|
10
|
-
constructor(client
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
constructor({ client, data, defaults, processingCommand }: {
|
|
12
|
+
client: Client;
|
|
13
|
+
data: APIApplicationCommandAutocompleteInteraction;
|
|
14
|
+
defaults: InteractionDefaults;
|
|
15
|
+
processingCommand?: Command;
|
|
16
|
+
});
|
|
17
|
+
defer(): Promise<never>;
|
|
18
|
+
reply(): Promise<never>;
|
|
13
19
|
/**
|
|
14
20
|
* Respond with the choices for an autocomplete interaction
|
|
15
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/AutocompleteInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,4CAA4C,EACjD,4BAA4B,EAK5B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,qBAAa,uBAAwB,SAAQ,eAAe,CAAC,4CAA4C,CAAC;IACzG;;OAEG;IACH,OAAO,EAAE,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"AutocompleteInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/AutocompleteInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,4CAA4C,EACjD,4BAA4B,EAK5B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,qBAAa,uBAAwB,SAAQ,eAAe,CAAC,4CAA4C,CAAC;IACzG;;OAEG;IACH,OAAO,EAAE,0BAA0B,CAAA;gBACvB,EACX,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,EAAE;QACF,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,4CAA4C,CAAA;QAClD,QAAQ,EAAE,mBAAmB,CAAA;QAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAC3B;IAiBc,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAIvB,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAItC;;OAEG;IACG,OAAO,CACZ,OAAO,EAAE;QACR;;WAEG;QACH,IAAI,EAAE,MAAM,CAAA;QACZ;;WAEG;QACH,KAAK,EAAE,MAAM,CAAA;KACb,EAAE;CAqBJ;AAED,qBAAa,0BAA2B,SAAQ,cAAc;IAC7D;;OAEG;IACH,UAAU;;;;;CAoBV"}
|
|
@@ -6,7 +6,7 @@ export class AutocompleteInteraction extends BaseInteraction {
|
|
|
6
6
|
* This is the options of the commands, parsed from the interaction data.
|
|
7
7
|
*/
|
|
8
8
|
options;
|
|
9
|
-
constructor(client, data, defaults) {
|
|
9
|
+
constructor({ client, data, defaults, processingCommand }) {
|
|
10
10
|
super(client, data, defaults);
|
|
11
11
|
if (data.type !== InteractionType.ApplicationCommandAutocomplete) {
|
|
12
12
|
throw new Error("Invalid interaction type was used to create this class");
|
|
@@ -14,7 +14,12 @@ export class AutocompleteInteraction extends BaseInteraction {
|
|
|
14
14
|
if (data.data.type !== ApplicationCommandType.ChatInput) {
|
|
15
15
|
throw new Error("Invalid command type was used to create this class");
|
|
16
16
|
}
|
|
17
|
-
this.options = new AutocompleteOptionsHandler(
|
|
17
|
+
this.options = new AutocompleteOptionsHandler({
|
|
18
|
+
client,
|
|
19
|
+
options: data.data.options ?? [],
|
|
20
|
+
interactionData: data.data,
|
|
21
|
+
definitions: processingCommand?.options ?? []
|
|
22
|
+
});
|
|
18
23
|
}
|
|
19
24
|
async defer() {
|
|
20
25
|
throw new Error("Defer is not available for autocomplete interactions");
|
|
@@ -26,11 +31,16 @@ export class AutocompleteInteraction extends BaseInteraction {
|
|
|
26
31
|
* Respond with the choices for an autocomplete interaction
|
|
27
32
|
*/
|
|
28
33
|
async respond(choices) {
|
|
34
|
+
let safeChoices = choices;
|
|
35
|
+
if (choices.length > 25) {
|
|
36
|
+
console.warn(`[Carbon] Autocomplete only supports up to 25 choices. Received ${choices.length}. Only the first 25 will be sent.`);
|
|
37
|
+
safeChoices = choices.slice(0, 25);
|
|
38
|
+
}
|
|
29
39
|
await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
|
|
30
40
|
body: {
|
|
31
41
|
type: InteractionResponseType.ApplicationCommandAutocompleteResult,
|
|
32
42
|
data: {
|
|
33
|
-
choices
|
|
43
|
+
choices: safeChoices
|
|
34
44
|
}
|
|
35
45
|
}
|
|
36
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteInteraction.js","sourceRoot":"","sources":["../../../src/internals/AutocompleteInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,4BAA4B,EAC5B,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EAEf,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"AutocompleteInteraction.js","sourceRoot":"","sources":["../../../src/internals/AutocompleteInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,4BAA4B,EAC5B,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EAEf,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,OAAO,uBAAwB,SAAQ,eAA6D;IACzG;;OAEG;IACH,OAAO,CAA4B;IACnC,YAAY,EACX,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,iBAAiB,EAMjB;QACA,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,8BAA8B,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,SAAS,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACtE,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,IAAI,0BAA0B,CAAC;YAC7C,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE;YAChC,eAAe,EAAE,IAAI,CAAC,IAAI;YAC1B,WAAW,EAAE,iBAAiB,EAAE,OAAO,IAAI,EAAE;SAC7C,CAAC,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,KAAK;QACnB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACxE,CAAC;IAEQ,KAAK,CAAC,KAAK;QACnB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACxE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAA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,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,4BAA4B,CAAC,OAAO;wBACtD,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;wBAC/B,CAAC,CAAC,IAAI,CAAA;QAEX,OAAO;YACN,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,KAAK;SACZ,CAAA;IACF,CAAC;CACD"}
|
|
@@ -3,7 +3,6 @@ import { BaseComponentInteraction } from "../abstracts/BaseComponentInteraction.
|
|
|
3
3
|
import type { InteractionDefaults } from "../abstracts/BaseInteraction.js";
|
|
4
4
|
import type { Client } from "../classes/Client.js";
|
|
5
5
|
export declare class ButtonInteraction extends BaseComponentInteraction {
|
|
6
|
-
customId: string;
|
|
7
6
|
constructor(client: Client, data: APIMessageComponentButtonInteraction, defaults: InteractionDefaults);
|
|
8
7
|
}
|
|
9
8
|
//# sourceMappingURL=ButtonInteraction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/ButtonInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ButtonInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/ButtonInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,oCAAoC,EAGzC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,qBAAa,iBAAkB,SAAQ,wBAAwB;gBAE7D,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,oCAAoC,EAC1C,QAAQ,EAAE,mBAAmB;CAY9B"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ComponentType, InteractionType } from "discord-api-types/v10";
|
|
2
2
|
import { BaseComponentInteraction } from "../abstracts/BaseComponentInteraction.js";
|
|
3
|
-
import { splitCustomId } from "../utils.js";
|
|
4
3
|
export class ButtonInteraction extends BaseComponentInteraction {
|
|
5
|
-
customId = splitCustomId(this.rawData.data.custom_id)[0];
|
|
6
4
|
constructor(client, data, defaults) {
|
|
7
5
|
super(client, data, defaults);
|
|
8
6
|
if (!data.data)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonInteraction.js","sourceRoot":"","sources":["../../../src/internals/ButtonInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ButtonInteraction.js","sourceRoot":"","sources":["../../../src/internals/ButtonInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EACb,eAAe,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAInF,MAAM,OAAO,iBAAkB,SAAQ,wBAAwB;IAC9D,YACC,MAAc,EACd,IAA0C,EAC1C,QAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI;YACb,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,aAAa,CAAC,MAAM,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACxE,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Client } from "../classes/Client.js";
|
|
2
|
+
import type { GuildMember } from "../structures/GuildMember.js";
|
|
3
|
+
import type { Webhook } from "../structures/Webhook.js";
|
|
4
|
+
export type CacheTypes = {
|
|
5
|
+
user: Awaited<ReturnType<typeof Client.prototype.fetchUser>>;
|
|
6
|
+
guild: Awaited<ReturnType<typeof Client.prototype.fetchGuild>>;
|
|
7
|
+
channel: Awaited<ReturnType<typeof Client.prototype.fetchChannel>>;
|
|
8
|
+
role: Awaited<ReturnType<typeof Client.prototype.fetchRole>>;
|
|
9
|
+
member: Awaited<ReturnType<typeof Client.prototype.fetchMember>>;
|
|
10
|
+
message: Awaited<ReturnType<typeof Client.prototype.fetchMessage>>;
|
|
11
|
+
voiceState: Awaited<ReturnType<typeof GuildMember.prototype.getVoiceState>>;
|
|
12
|
+
permissions: bigint[];
|
|
13
|
+
webhook: Webhook<false>;
|
|
14
|
+
};
|
|
15
|
+
export interface CacheEntry<V> {
|
|
16
|
+
value: V;
|
|
17
|
+
expiresAt?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CacheOptions {
|
|
20
|
+
defaultExpiry?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class Cache<K extends keyof CacheTypes | string, V = K extends keyof CacheTypes ? CacheTypes[K] : unknown> {
|
|
23
|
+
private cache;
|
|
24
|
+
private defaultExpiry;
|
|
25
|
+
constructor(options?: CacheOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Get a value from the cache
|
|
28
|
+
* @param key The key to get
|
|
29
|
+
* @returns The value if it exists and hasn't expired, undefined otherwise
|
|
30
|
+
*/
|
|
31
|
+
get(key: K): V | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Set a value in the cache
|
|
34
|
+
* @param key The key to set
|
|
35
|
+
* @param value The value to set
|
|
36
|
+
* @param expiresIn Optional time in milliseconds until the entry expires
|
|
37
|
+
*/
|
|
38
|
+
set(key: K, value: V, expiresIn?: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Delete a value from the cache
|
|
41
|
+
* @param key The key to delete
|
|
42
|
+
* @returns Whether the key was deleted
|
|
43
|
+
*/
|
|
44
|
+
delete(key: K): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all values of a specific type from the cache
|
|
47
|
+
* @param type The type to clear
|
|
48
|
+
*/
|
|
49
|
+
clearType(type: K): void;
|
|
50
|
+
/**
|
|
51
|
+
* Clear all values from the cache
|
|
52
|
+
*/
|
|
53
|
+
clear(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get the size of the cache
|
|
56
|
+
*/
|
|
57
|
+
get size(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Check if a key exists in the cache and hasn't expired
|
|
60
|
+
* @param key The key to check
|
|
61
|
+
*/
|
|
62
|
+
has(key: K): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Get all keys in the cache that haven't expired
|
|
65
|
+
*/
|
|
66
|
+
keys(): K[];
|
|
67
|
+
/**
|
|
68
|
+
* Get all values in the cache that haven't expired
|
|
69
|
+
*/
|
|
70
|
+
values(): V[];
|
|
71
|
+
/**
|
|
72
|
+
* Get all entries in the cache that haven't expired
|
|
73
|
+
*/
|
|
74
|
+
entries(): [K, V][];
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=Cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../src/internals/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAEvD,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;IAC5D,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,UA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,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAI9B;;;OAGG;IACI,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAQ/B;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;OAGG;IACI,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAY3B;;OAEG;IACI,IAAI,IAAI,CAAC,EAAE;IAYlB;;OAEG;IACI,MAAM,IAAI,CAAC,EAAE;IAYpB;;OAEG;IACI,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;CAW1B"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export class Cache {
|
|
2
|
+
cache = new Map();
|
|
3
|
+
defaultExpiry = 1000 * 60 * 60 * 24; // 1 day
|
|
4
|
+
constructor(options = {}) {
|
|
5
|
+
if (options.defaultExpiry) {
|
|
6
|
+
this.defaultExpiry = options.defaultExpiry;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get a value from the cache
|
|
11
|
+
* @param key The key to get
|
|
12
|
+
* @returns The value if it exists and hasn't expired, undefined otherwise
|
|
13
|
+
*/
|
|
14
|
+
get(key) {
|
|
15
|
+
const entry = this.cache.get(key);
|
|
16
|
+
if (!entry)
|
|
17
|
+
return undefined;
|
|
18
|
+
if (entry.expiresAt && entry.expiresAt < Date.now()) {
|
|
19
|
+
this.delete(key);
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return entry.value;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Set a value in the cache
|
|
26
|
+
* @param key The key to set
|
|
27
|
+
* @param value The value to set
|
|
28
|
+
* @param expiresIn Optional time in milliseconds until the entry expires
|
|
29
|
+
*/
|
|
30
|
+
set(key, value, expiresIn) {
|
|
31
|
+
const expiresAt = expiresIn ? Date.now() + expiresIn : this.defaultExpiry;
|
|
32
|
+
this.cache.set(key, { value, expiresAt });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Delete a value from the cache
|
|
36
|
+
* @param key The key to delete
|
|
37
|
+
* @returns Whether the key was deleted
|
|
38
|
+
*/
|
|
39
|
+
delete(key) {
|
|
40
|
+
return this.cache.delete(key);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Clear all values of a specific type from the cache
|
|
44
|
+
* @param type The type to clear
|
|
45
|
+
*/
|
|
46
|
+
clearType(type) {
|
|
47
|
+
for (const [key] of this.cache) {
|
|
48
|
+
if (key === type) {
|
|
49
|
+
this.delete(key);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Clear all values from the cache
|
|
55
|
+
*/
|
|
56
|
+
clear() {
|
|
57
|
+
this.cache.clear();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the size of the cache
|
|
61
|
+
*/
|
|
62
|
+
get size() {
|
|
63
|
+
return this.cache.size;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if a key exists in the cache and hasn't expired
|
|
67
|
+
* @param key The key to check
|
|
68
|
+
*/
|
|
69
|
+
has(key) {
|
|
70
|
+
const entry = this.cache.get(key);
|
|
71
|
+
if (!entry)
|
|
72
|
+
return false;
|
|
73
|
+
if (entry.expiresAt && entry.expiresAt < Date.now()) {
|
|
74
|
+
this.delete(key);
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get all keys in the cache that haven't expired
|
|
81
|
+
*/
|
|
82
|
+
keys() {
|
|
83
|
+
const keys = [];
|
|
84
|
+
for (const [key, entry] of this.cache) {
|
|
85
|
+
if (entry.expiresAt && entry.expiresAt < Date.now()) {
|
|
86
|
+
this.delete(key);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
keys.push(key);
|
|
90
|
+
}
|
|
91
|
+
return keys;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get all values in the cache that haven't expired
|
|
95
|
+
*/
|
|
96
|
+
values() {
|
|
97
|
+
const values = [];
|
|
98
|
+
for (const [key, entry] of this.cache) {
|
|
99
|
+
if (entry.expiresAt && entry.expiresAt < Date.now()) {
|
|
100
|
+
this.delete(key);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
values.push(entry.value);
|
|
104
|
+
}
|
|
105
|
+
return values;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get all entries in the cache that haven't expired
|
|
109
|
+
*/
|
|
110
|
+
entries() {
|
|
111
|
+
const entries = [];
|
|
112
|
+
for (const [key, entry] of this.cache) {
|
|
113
|
+
if (entry.expiresAt && entry.expiresAt < Date.now()) {
|
|
114
|
+
this.delete(key);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
entries.push([key, entry.value]);
|
|
118
|
+
}
|
|
119
|
+
return entries;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=Cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../src/internals/Cache.ts"],"names":[],"mappings":"AAyBA,MAAM,OAAO,KAAK;IAIT,KAAK,GAA0B,IAAI,GAAG,EAAE,CAAA;IACxC,aAAa,GAAW,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA,CAAC,QAAQ;IAE5D,YAAY,UAAwB,EAAE;QACrC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC3B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAA;QAC3C,CAAC;IACF,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,GAAM;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,CAAC,KAAK;YA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C,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;gBACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;gBAChB,SAAQ;YACT,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;QACjC,CAAC;QACD,OAAO,OAAO,CAAA;IACf,CAAC;CACD"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction } from "discord-api-types/v10";
|
|
2
2
|
import { Base } from "../abstracts/Base.js";
|
|
3
3
|
export declare class CommandHandler extends Base {
|
|
4
|
+
private getSubcommand;
|
|
4
5
|
private getCommand;
|
|
5
6
|
/**
|
|
6
7
|
* Handle a command interaction
|
|
7
8
|
* @internal
|
|
8
9
|
*/
|
|
9
|
-
handleCommandInteraction(rawInteraction: APIApplicationCommandInteraction): Promise<
|
|
10
|
+
handleCommandInteraction(rawInteraction: APIApplicationCommandInteraction): Promise<unknown>;
|
|
10
11
|
handleAutocompleteInteraction(rawInteraction: APIApplicationCommandAutocompleteInteraction): Promise<false | void>;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=CommandHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/CommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,4CAA4C,EACjD,KAAK,gCAAgC,EAIrC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"CommandHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/CommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,4CAA4C,EACjD,KAAK,gCAAgC,EAIrC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAQ3C,qBAAa,cAAe,SAAQ,IAAI;IACvC,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,UAAU;IA6DlB;;;OAGG;IACG,wBAAwB,CAC7B,cAAc,EAAE,gCAAgC;IAoC3C,6BAA6B,CAClC,cAAc,EAAE,4CAA4C;CAsB7D"}
|
|
@@ -6,6 +6,16 @@ import { CommandWithSubcommands } from "../classes/CommandWithSubcommands.js";
|
|
|
6
6
|
import { AutocompleteInteraction } from "./AutocompleteInteraction.js";
|
|
7
7
|
import { CommandInteraction } from "./CommandInteraction.js";
|
|
8
8
|
export class CommandHandler extends Base {
|
|
9
|
+
getSubcommand(command, rawInteraction) {
|
|
10
|
+
if (rawInteraction.data.type !== ApplicationCommandType.ChatInput) {
|
|
11
|
+
throw new Error("Subcommands must be used with ChatInput");
|
|
12
|
+
}
|
|
13
|
+
const data = rawInteraction.data;
|
|
14
|
+
const subcommand = command.subcommands.find((x) => x.name === data.options?.[0]?.name);
|
|
15
|
+
if (!subcommand)
|
|
16
|
+
throw new Error("Subcommand not found");
|
|
17
|
+
return subcommand;
|
|
18
|
+
}
|
|
9
19
|
getCommand(rawInteraction) {
|
|
10
20
|
let command = this.client.commands.find((x) => x.name === rawInteraction.data.name);
|
|
11
21
|
if (!command)
|
|
@@ -18,8 +28,14 @@ export class CommandHandler extends Base {
|
|
|
18
28
|
}
|
|
19
29
|
const data = rawInteraction.data;
|
|
20
30
|
const subcommandGroupName = data.options?.find((x) => x.type === ApplicationCommandOptionType.SubcommandGroup)?.name;
|
|
21
|
-
if (!subcommandGroupName)
|
|
22
|
-
|
|
31
|
+
if (!subcommandGroupName) {
|
|
32
|
+
try {
|
|
33
|
+
return this.getSubcommand(command, rawInteraction);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
throw new Error("No subcommand group name or subcommand found");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
23
39
|
const subcommandGroup = command.subcommandGroups.find((x) => x.name === subcommandGroupName);
|
|
24
40
|
if (!subcommandGroup)
|
|
25
41
|
throw new Error("Subcommand group not found");
|
|
@@ -32,14 +48,7 @@ export class CommandHandler extends Base {
|
|
|
32
48
|
return subcommand;
|
|
33
49
|
}
|
|
34
50
|
if (command instanceof CommandWithSubcommands) {
|
|
35
|
-
|
|
36
|
-
throw new Error("Subcommands must be used with ChatInput");
|
|
37
|
-
}
|
|
38
|
-
const data = rawInteraction.data;
|
|
39
|
-
const subcommand = command.subcommands.find((x) => x.name === data.options?.[0]?.name);
|
|
40
|
-
if (!subcommand)
|
|
41
|
-
throw new Error("Subcommand not found");
|
|
42
|
-
return subcommand;
|
|
51
|
+
return this.getSubcommand(command, rawInteraction);
|
|
43
52
|
}
|
|
44
53
|
if (command instanceof Command) {
|
|
45
54
|
return command;
|
|
@@ -54,14 +63,29 @@ export class CommandHandler extends Base {
|
|
|
54
63
|
const command = this.getCommand(rawInteraction);
|
|
55
64
|
if (!command)
|
|
56
65
|
return false;
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
if (command.components) {
|
|
67
|
+
for (const component of command.components) {
|
|
68
|
+
this.client.componentHandler.registerComponent(component);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const interaction = new CommandInteraction({
|
|
72
|
+
client: this.client,
|
|
73
|
+
data: rawInteraction,
|
|
74
|
+
defaults: {
|
|
75
|
+
ephemeral: command.ephemeral
|
|
76
|
+
},
|
|
77
|
+
processingCommand: command
|
|
59
78
|
});
|
|
60
79
|
try {
|
|
61
80
|
const command = this.getCommand(rawInteraction);
|
|
62
81
|
if (command.defer) {
|
|
63
82
|
await interaction.defer();
|
|
64
83
|
}
|
|
84
|
+
if (command.preCheck) {
|
|
85
|
+
const result = await command.preCheck(interaction);
|
|
86
|
+
if (!result)
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
65
89
|
return await command.run(interaction);
|
|
66
90
|
}
|
|
67
91
|
catch (e) {
|
|
@@ -74,7 +98,14 @@ export class CommandHandler extends Base {
|
|
|
74
98
|
const command = this.getCommand(rawInteraction);
|
|
75
99
|
if (!command)
|
|
76
100
|
return false;
|
|
77
|
-
const interaction = new AutocompleteInteraction(
|
|
101
|
+
const interaction = new AutocompleteInteraction({
|
|
102
|
+
client: this.client,
|
|
103
|
+
data: rawInteraction,
|
|
104
|
+
defaults: {
|
|
105
|
+
ephemeral: command.ephemeral
|
|
106
|
+
},
|
|
107
|
+
processingCommand: command
|
|
108
|
+
});
|
|
78
109
|
try {
|
|
79
110
|
const command = this.getCommand(rawInteraction);
|
|
80
111
|
return await command.autocomplete(interaction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandHandler.js","sourceRoot":"","sources":["../../../src/internals/CommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,4BAA4B,EAC5B,sBAAsB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"CommandHandler.js","sourceRoot":"","sources":["../../../src/internals/CommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,4BAA4B,EAC5B,sBAAsB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAA;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,OAAO,cAAe,SAAQ,IAAI;IAC/B,aAAa,CACpB,OAA+B,EAC/B,cAEmC;QAEnC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,SAAS,EAAE,CAAC;YAC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AAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACF,CAAC;IACD,KAAK,CAAC,6BAA6B,CAClC,cAA4D;QAE5D,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;QAC/C,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAA;QAE1B,MAAM,WAAW,GAAG,IAAI,uBAAuB,CAAC;YAC/C,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE;gBACT,SAAS,EAAE,OAAO,CAAC,SAAS;aAC5B;YACD,iBAAiB,EAAE,OAAO;SAC1B,CAAC,CAAA;QAEF,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;YAC/C,OAAO,MAAM,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAC/C,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,KAAK;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YAChD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACF,CAAC;CACD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type APIApplicationCommandInteraction } from "discord-api-types/v10";
|
|
2
2
|
import { BaseInteraction, type InteractionDefaults } from "../abstracts/BaseInteraction.js";
|
|
3
3
|
import type { Client } from "../classes/Client.js";
|
|
4
|
+
import type { Command } from "../classes/Command.js";
|
|
4
5
|
import { OptionsHandler } from "./OptionsHandler.js";
|
|
5
6
|
/**
|
|
6
7
|
* Represents a command interaction
|
|
@@ -11,6 +12,11 @@ export declare class CommandInteraction extends BaseInteraction<APIApplicationCo
|
|
|
11
12
|
* It will not have any options in it if the command is not a ChatInput command.
|
|
12
13
|
*/
|
|
13
14
|
options: OptionsHandler;
|
|
14
|
-
constructor(client
|
|
15
|
+
constructor({ client, data, defaults, processingCommand }: {
|
|
16
|
+
client: Client;
|
|
17
|
+
data: APIApplicationCommandInteraction;
|
|
18
|
+
defaults: InteractionDefaults;
|
|
19
|
+
processingCommand?: Command;
|
|
20
|
+
});
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=CommandInteraction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/CommandInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gCAAgC,
|
|
1
|
+
{"version":3,"file":"CommandInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/CommandInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gCAAgC,EAIrC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe,CAAC,gCAAgC,CAAC;IACxF;;;OAGG;IACH,OAAO,EAAE,cAAc,CAAA;gBACX,EACX,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,EAAE;QACF,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,gCAAgC,CAAA;QACtC,QAAQ,EAAE,mBAAmB,CAAA;QAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAC3B;CAgBD"}
|
|
@@ -10,14 +10,20 @@ export class CommandInteraction extends BaseInteraction {
|
|
|
10
10
|
* It will not have any options in it if the command is not a ChatInput command.
|
|
11
11
|
*/
|
|
12
12
|
options;
|
|
13
|
-
constructor(client, data, defaults) {
|
|
13
|
+
constructor({ client, data, defaults, processingCommand }) {
|
|
14
14
|
super(client, data, defaults);
|
|
15
15
|
if (data.type !== InteractionType.ApplicationCommand) {
|
|
16
16
|
throw new Error("Invalid interaction type was used to create this class");
|
|
17
17
|
}
|
|
18
|
-
this.options = new OptionsHandler(
|
|
19
|
-
|
|
20
|
-
:
|
|
18
|
+
this.options = new OptionsHandler({
|
|
19
|
+
client,
|
|
20
|
+
options: data.data.type === ApplicationCommandType.ChatInput
|
|
21
|
+
? (data.data.options ?? [])
|
|
22
|
+
: [],
|
|
23
|
+
interactionData: this.rawData
|
|
24
|
+
.data,
|
|
25
|
+
definitions: processingCommand?.options ?? []
|
|
26
|
+
});
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
//# sourceMappingURL=CommandInteraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandInteraction.js","sourceRoot":"","sources":["../../../src/internals/CommandInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CommandInteraction.js","sourceRoot":"","sources":["../../../src/internals/CommandInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,sBAAsB,EACtB,eAAe,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EAEf,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,eAAiD;IACxF;;;OAGG;IACH,OAAO,CAAgB;IACvB,YAAY,EACX,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,iBAAiB,EAMjB;QACA,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,kBAAkB,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC;YACjC,MAAM;YACN,OAAO,EACN,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,SAAS;gBAClD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;gBAC3B,CAAC,CAAC,EAAE;YACN,eAAe,EAAE,IAAI,CAAC,OAAO;iBAC3B,IAAqD;YACvD,WAAW,EAAE,iBAAiB,EAAE,OAAO,IAAI,EAAE;SAC7C,CAAC,CAAA;IACH,CAAC;CACD"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type APIMessageComponentInteraction, type APIMessageComponentInteractionData } from "discord-api-types/v10";
|
|
2
2
|
import { Base } from "../abstracts/Base.js";
|
|
3
3
|
import type { BaseMessageInteractiveComponent } from "../abstracts/BaseMessageInteractiveComponent.js";
|
|
4
4
|
export declare class ComponentHandler extends Base {
|
|
5
5
|
components: BaseMessageInteractiveComponent[];
|
|
6
|
+
oneOffComponents: Map<`${string}-${string}`, {
|
|
7
|
+
resolve: (data: APIMessageComponentInteractionData) => void;
|
|
8
|
+
}>;
|
|
6
9
|
/**
|
|
7
10
|
* Register a component with the handler
|
|
8
11
|
* @internal
|
|
@@ -12,6 +15,6 @@ export declare class ComponentHandler extends Base {
|
|
|
12
15
|
* Handle an interaction
|
|
13
16
|
* @internal
|
|
14
17
|
*/
|
|
15
|
-
handleInteraction(data: APIMessageComponentInteraction): Promise<
|
|
18
|
+
handleInteraction(data: APIMessageComponentInteraction): Promise<void>;
|
|
16
19
|
}
|
|
17
20
|
//# sourceMappingURL=ComponentHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/ComponentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ComponentHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/ComponentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EAKvC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAA;AActG,qBAAa,gBAAiB,SAAQ,IAAI;IACzC,UAAU,EAAE,+BAA+B,EAAE,CAAK;IAElD,gBAAgB,EAAE,GAAG,CACpB,GAAG,MAAM,IAAI,MAAM,EAAE,EACrB;QACC,OAAO,EAAE,CAAC,IAAI,EAAE,kCAAkC,KAAK,IAAI,CAAA;KAC3D,CACD,CAAY;IACb;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,+BAA+B;IAK5D;;;OAGG;IACG,iBAAiB,CAAC,IAAI,EAAE,8BAA8B;CA6F5D"}
|