@buape/carbon 0.12.0 → 0.14.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 +8 -7
- package/dist/src/abstracts/BaseCommand.d.ts +4 -0
- package/dist/src/abstracts/BaseCommand.d.ts.map +1 -1
- package/dist/src/abstracts/BaseCommand.js +23 -0
- package/dist/src/abstracts/BaseCommand.js.map +1 -1
- package/dist/src/abstracts/BaseComponent.d.ts +2 -2
- package/dist/src/abstracts/BaseComponent.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.d.ts +1 -2
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -1
- package/dist/src/abstracts/BaseInteraction.d.ts +52 -0
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.js +44 -6
- package/dist/src/abstracts/BaseInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseModalComponent.d.ts +4 -3
- package/dist/src/abstracts/BaseModalComponent.d.ts.map +1 -1
- package/dist/src/abstracts/BaseModalComponent.js +1 -1
- package/dist/src/abstracts/BaseModalComponent.js.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +1 -2
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -1
- package/dist/src/adapters/bun/index.d.ts +6 -5
- package/dist/src/adapters/bun/index.d.ts.map +1 -1
- package/dist/src/adapters/bun/index.js +2 -2
- package/dist/src/adapters/bun/index.js.map +1 -1
- package/dist/src/adapters/fetch/index.d.ts +4 -3
- package/dist/src/adapters/fetch/index.d.ts.map +1 -1
- package/dist/src/adapters/fetch/index.js +7 -2
- package/dist/src/adapters/fetch/index.js.map +1 -1
- package/dist/src/adapters/node/index.d.ts +4 -3
- package/dist/src/adapters/node/index.d.ts.map +1 -1
- package/dist/src/adapters/node/index.js +2 -2
- package/dist/src/adapters/node/index.js.map +1 -1
- package/dist/src/classes/Client.d.ts +24 -4
- package/dist/src/classes/Client.d.ts.map +1 -1
- package/dist/src/classes/Client.js +64 -15
- package/dist/src/classes/Client.js.map +1 -1
- package/dist/src/classes/Listener.d.ts +15 -2
- package/dist/src/classes/Listener.d.ts.map +1 -1
- package/dist/src/classes/Listener.js +27 -6
- package/dist/src/classes/Listener.js.map +1 -1
- package/dist/src/classes/Modal.d.ts +2 -3
- package/dist/src/classes/Modal.d.ts.map +1 -1
- package/dist/src/classes/Modal.js.map +1 -1
- package/dist/src/classes/RequestClient.d.ts +18 -2
- package/dist/src/classes/RequestClient.d.ts.map +1 -1
- package/dist/src/classes/RequestClient.js +268 -68
- package/dist/src/classes/RequestClient.js.map +1 -1
- package/dist/src/classes/components/Button.d.ts.map +1 -1
- package/dist/src/classes/components/Button.js.map +1 -1
- package/dist/src/classes/components/Checkbox.d.ts +12 -0
- package/dist/src/classes/components/Checkbox.d.ts.map +1 -0
- package/dist/src/classes/components/Checkbox.js +20 -0
- package/dist/src/classes/components/Checkbox.js.map +1 -0
- package/dist/src/classes/components/CheckboxGroup.d.ts +24 -0
- package/dist/src/classes/components/CheckboxGroup.d.ts.map +1 -0
- package/dist/src/classes/components/CheckboxGroup.js +37 -0
- package/dist/src/classes/components/CheckboxGroup.js.map +1 -0
- package/dist/src/classes/components/Container.d.ts +6 -2
- package/dist/src/classes/components/Container.d.ts.map +1 -1
- package/dist/src/classes/components/Container.js +11 -0
- package/dist/src/classes/components/Container.js.map +1 -1
- package/dist/src/classes/components/File.d.ts +2 -2
- package/dist/src/classes/components/File.d.ts.map +1 -1
- package/dist/src/classes/components/File.js +4 -1
- package/dist/src/classes/components/File.js.map +1 -1
- package/dist/src/classes/components/FileUpload.d.ts +23 -0
- package/dist/src/classes/components/FileUpload.d.ts.map +1 -0
- package/dist/src/classes/components/FileUpload.js +36 -0
- package/dist/src/classes/components/FileUpload.js.map +1 -0
- package/dist/src/classes/components/Label.d.ts +10 -6
- package/dist/src/classes/components/Label.d.ts.map +1 -1
- package/dist/src/classes/components/Label.js +1 -2
- package/dist/src/classes/components/Label.js.map +1 -1
- package/dist/src/classes/components/MediaGallery.d.ts +8 -13
- package/dist/src/classes/components/MediaGallery.d.ts.map +1 -1
- package/dist/src/classes/components/MediaGallery.js +5 -0
- package/dist/src/classes/components/MediaGallery.js.map +1 -1
- package/dist/src/classes/components/RadioGroup.d.ts +24 -0
- package/dist/src/classes/components/RadioGroup.d.ts.map +1 -0
- package/dist/src/classes/components/RadioGroup.js +33 -0
- package/dist/src/classes/components/RadioGroup.js.map +1 -0
- package/dist/src/classes/components/Row.d.ts.map +1 -1
- package/dist/src/classes/components/Row.js +2 -3
- package/dist/src/classes/components/Row.js.map +1 -1
- package/dist/src/classes/components/Section.d.ts +4 -3
- package/dist/src/classes/components/Section.d.ts.map +1 -1
- package/dist/src/classes/components/Section.js +22 -0
- package/dist/src/classes/components/Section.js.map +1 -1
- package/dist/src/classes/components/TextDisplay.d.ts +2 -2
- package/dist/src/classes/components/TextDisplay.d.ts.map +1 -1
- package/dist/src/classes/components/TextDisplay.js +3 -0
- package/dist/src/classes/components/TextDisplay.js.map +1 -1
- package/dist/src/classes/components/TextInput.d.ts +0 -1
- package/dist/src/classes/components/TextInput.d.ts.map +1 -1
- package/dist/src/classes/components/TextInput.js +0 -1
- package/dist/src/classes/components/TextInput.js.map +1 -1
- package/dist/src/classes/components/Thumbnail.d.ts +3 -2
- package/dist/src/classes/components/Thumbnail.d.ts.map +1 -1
- package/dist/src/classes/components/Thumbnail.js +11 -0
- package/dist/src/classes/components/Thumbnail.js.map +1 -1
- package/dist/src/errors/DiscordError.d.ts.map +1 -1
- package/dist/src/errors/DiscordError.js.map +1 -1
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.d.ts +1 -1
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -1
- package/dist/src/internals/CommandInteraction.d.ts +4 -0
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -1
- package/dist/src/internals/CommandInteraction.js +32 -1
- package/dist/src/internals/CommandInteraction.js.map +1 -1
- package/dist/src/internals/ComponentHandler.d.ts +4 -10
- package/dist/src/internals/ComponentHandler.d.ts.map +1 -1
- package/dist/src/internals/ComponentHandler.js +46 -38
- package/dist/src/internals/ComponentHandler.js.map +1 -1
- package/dist/src/internals/EmojiHandler.d.ts.map +1 -1
- package/dist/src/internals/EmojiHandler.js +0 -1
- package/dist/src/internals/EmojiHandler.js.map +1 -1
- package/dist/src/internals/EventHandler.d.ts +13 -2
- package/dist/src/internals/EventHandler.d.ts.map +1 -1
- package/dist/src/internals/EventHandler.js +14 -11
- package/dist/src/internals/EventHandler.js.map +1 -1
- package/dist/src/internals/EventQueue.d.ts +59 -0
- package/dist/src/internals/EventQueue.d.ts.map +1 -0
- package/dist/src/internals/EventQueue.js +131 -0
- package/dist/src/internals/EventQueue.js.map +1 -0
- package/dist/src/internals/FieldsHandler.d.ts +4 -1
- package/dist/src/internals/FieldsHandler.d.ts.map +1 -1
- package/dist/src/internals/FieldsHandler.js +26 -3
- package/dist/src/internals/FieldsHandler.js.map +1 -1
- package/dist/src/internals/OptionsHandler.d.ts +12 -2
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -1
- package/dist/src/internals/OptionsHandler.js +31 -4
- package/dist/src/internals/OptionsHandler.js.map +1 -1
- package/dist/src/internals/TemporaryListenerManager.d.ts +20 -0
- package/dist/src/internals/TemporaryListenerManager.d.ts.map +1 -0
- package/dist/src/internals/TemporaryListenerManager.js +59 -0
- package/dist/src/internals/TemporaryListenerManager.js.map +1 -0
- package/dist/src/permissions.d.ts +1 -0
- package/dist/src/permissions.d.ts.map +1 -1
- package/dist/src/plugins/client-manager/ClientManager.d.ts +151 -0
- package/dist/src/plugins/client-manager/ClientManager.d.ts.map +1 -0
- package/dist/src/plugins/client-manager/ClientManager.js +253 -0
- package/dist/src/plugins/client-manager/ClientManager.js.map +1 -0
- package/dist/src/plugins/client-manager/index.d.ts +2 -0
- package/dist/src/plugins/client-manager/index.d.ts.map +1 -0
- package/dist/src/plugins/client-manager/index.js +2 -0
- package/dist/src/plugins/client-manager/index.js.map +1 -0
- package/dist/src/plugins/command-data/CommandDataPlugin.d.ts.map +1 -1
- package/dist/src/plugins/command-data/CommandDataPlugin.js +3 -6
- package/dist/src/plugins/command-data/CommandDataPlugin.js.map +1 -1
- package/dist/src/plugins/gateway/BabyCache.d.ts +16 -0
- package/dist/src/plugins/gateway/BabyCache.d.ts.map +1 -0
- package/dist/src/plugins/gateway/BabyCache.js +53 -0
- package/dist/src/plugins/gateway/BabyCache.js.map +1 -0
- package/dist/src/plugins/gateway/GatewayPlugin.d.ts +7 -2
- package/dist/src/plugins/gateway/GatewayPlugin.d.ts.map +1 -1
- package/dist/src/plugins/gateway/GatewayPlugin.js +137 -31
- package/dist/src/plugins/gateway/GatewayPlugin.js.map +1 -1
- package/dist/src/plugins/gateway/InteractionEventListener.d.ts +8 -0
- package/dist/src/plugins/gateway/InteractionEventListener.d.ts.map +1 -0
- package/dist/src/plugins/gateway/InteractionEventListener.js +9 -0
- package/dist/src/plugins/gateway/InteractionEventListener.js.map +1 -0
- package/dist/src/plugins/gateway/types.d.ts +5 -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/heartbeat.d.ts +1 -0
- package/dist/src/plugins/gateway/utils/heartbeat.d.ts.map +1 -1
- package/dist/src/plugins/gateway/utils/heartbeat.js +13 -8
- package/dist/src/plugins/gateway/utils/heartbeat.js.map +1 -1
- 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 +10 -6
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js.map +1 -1
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts +0 -1
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts.map +1 -1
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js +0 -4
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js.map +1 -1
- package/dist/src/plugins/gateway-forwarder/index.d.ts +1 -1
- package/dist/src/plugins/gateway-forwarder/index.d.ts.map +1 -1
- package/dist/src/plugins/gateway-forwarder/index.js +1 -1
- package/dist/src/plugins/gateway-forwarder/index.js.map +1 -1
- package/dist/src/plugins/paginator/GoToPageModal.d.ts +1 -1
- package/dist/src/plugins/paginator/GoToPageModal.d.ts.map +1 -1
- package/dist/src/plugins/paginator/GoToPageModal.js +2 -2
- package/dist/src/plugins/paginator/GoToPageModal.js.map +1 -1
- package/dist/src/plugins/paginator/Paginator.d.ts.map +1 -1
- package/dist/src/plugins/paginator/Paginator.js +1 -1
- package/dist/src/plugins/paginator/Paginator.js.map +1 -1
- package/dist/src/plugins/paginator/index.d.ts +2 -0
- package/dist/src/plugins/paginator/index.d.ts.map +1 -1
- package/dist/src/plugins/paginator/index.js +2 -0
- package/dist/src/plugins/paginator/index.js.map +1 -1
- package/dist/src/plugins/sharding/index.d.ts +1 -1
- package/dist/src/plugins/sharding/index.js +1 -1
- package/dist/src/plugins/voice/GuildDeleteListener.d.ts +7 -0
- package/dist/src/plugins/voice/GuildDeleteListener.d.ts.map +1 -0
- package/dist/src/plugins/voice/GuildDeleteListener.js +11 -0
- package/dist/src/plugins/voice/GuildDeleteListener.js.map +1 -0
- package/dist/src/plugins/voice/VoicePlugin.d.ts +15 -0
- package/dist/src/plugins/voice/VoicePlugin.d.ts.map +1 -0
- package/dist/src/plugins/voice/VoicePlugin.js +54 -0
- package/dist/src/plugins/voice/VoicePlugin.js.map +1 -0
- package/dist/src/plugins/voice/index.d.ts +2 -0
- package/dist/src/plugins/voice/index.d.ts.map +1 -0
- package/dist/src/plugins/voice/index.js +2 -0
- package/dist/src/plugins/voice/index.js.map +1 -0
- package/dist/src/structures/DmChannel.d.ts +4 -0
- package/dist/src/structures/DmChannel.d.ts.map +1 -1
- package/dist/src/structures/DmChannel.js +6 -0
- package/dist/src/structures/DmChannel.js.map +1 -1
- package/dist/src/structures/Emoji.d.ts +11 -0
- package/dist/src/structures/Emoji.d.ts.map +1 -1
- package/dist/src/structures/Emoji.js +20 -0
- package/dist/src/structures/Emoji.js.map +1 -1
- package/dist/src/structures/GroupDmChannel.d.ts +12 -1
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -1
- package/dist/src/structures/GroupDmChannel.js +19 -4
- package/dist/src/structures/GroupDmChannel.js.map +1 -1
- package/dist/src/structures/Guild.d.ts +70 -4
- package/dist/src/structures/Guild.d.ts.map +1 -1
- package/dist/src/structures/Guild.js +152 -21
- package/dist/src/structures/Guild.js.map +1 -1
- package/dist/src/structures/GuildMember.d.ts +18 -6
- package/dist/src/structures/GuildMember.d.ts.map +1 -1
- package/dist/src/structures/GuildMember.js +24 -9
- package/dist/src/structures/GuildMember.js.map +1 -1
- package/dist/src/structures/GuildScheduledEvent.d.ts +121 -0
- package/dist/src/structures/GuildScheduledEvent.d.ts.map +1 -0
- package/dist/src/structures/GuildScheduledEvent.js +228 -0
- package/dist/src/structures/GuildScheduledEvent.js.map +1 -0
- package/dist/src/structures/GuildThreadChannel.d.ts +1 -1
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -1
- package/dist/src/structures/Role.d.ts +33 -12
- package/dist/src/structures/Role.d.ts.map +1 -1
- package/dist/src/structures/Role.js +58 -24
- package/dist/src/structures/Role.js.map +1 -1
- package/dist/src/structures/ThreadMember.d.ts.map +1 -1
- package/dist/src/structures/ThreadMember.js +0 -1
- package/dist/src/structures/ThreadMember.js.map +1 -1
- package/dist/src/structures/User.d.ts +17 -5
- package/dist/src/structures/User.d.ts.map +1 -1
- package/dist/src/structures/User.js +28 -12
- package/dist/src/structures/User.js.map +1 -1
- package/dist/src/structures/Webhook.d.ts +40 -19
- package/dist/src/structures/Webhook.d.ts.map +1 -1
- package/dist/src/structures/Webhook.js +70 -30
- package/dist/src/structures/Webhook.js.map +1 -1
- package/dist/src/types/index.d.ts +55 -2
- 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 +13 -9
- package/dist/src/types/listeners.d.ts.map +1 -1
- package/dist/src/types/listeners.js +3 -1
- package/dist/src/types/listeners.js.map +1 -1
- package/dist/src/utils/LRUCache.d.ts +46 -0
- package/dist/src/utils/LRUCache.d.ts.map +1 -0
- package/dist/src/utils/LRUCache.js +78 -0
- package/dist/src/utils/LRUCache.js.map +1 -0
- package/dist/src/utils/cdn.d.ts +31 -0
- package/dist/src/utils/cdn.d.ts.map +1 -0
- package/dist/src/utils/cdn.js +18 -0
- package/dist/src/utils/cdn.js.map +1 -0
- package/dist/src/utils/customIdParser.d.ts.map +1 -1
- package/dist/src/utils/customIdParser.js +6 -2
- package/dist/src/utils/customIdParser.js.map +1 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/payload.d.ts.map +1 -1
- package/dist/src/utils/payload.js +2 -1
- package/dist/src/utils/payload.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/dist/src/classes/ClientWithCaching.d.ts +0 -51
- package/dist/src/classes/ClientWithCaching.d.ts.map +0 -1
- package/dist/src/classes/ClientWithCaching.js +0 -108
- package/dist/src/classes/ClientWithCaching.js.map +0 -1
- package/dist/src/classes/components/ModalChannelSelectMenu.d.ts +0 -62
- package/dist/src/classes/components/ModalChannelSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/components/ModalChannelSelectMenu.js +0 -73
- package/dist/src/classes/components/ModalChannelSelectMenu.js.map +0 -1
- package/dist/src/classes/components/ModalMentionableSelectMenu.d.ts +0 -58
- package/dist/src/classes/components/ModalMentionableSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/components/ModalMentionableSelectMenu.js +0 -68
- package/dist/src/classes/components/ModalMentionableSelectMenu.js.map +0 -1
- package/dist/src/classes/components/ModalRoleSelectMenu.d.ts +0 -58
- package/dist/src/classes/components/ModalRoleSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/components/ModalRoleSelectMenu.js +0 -68
- package/dist/src/classes/components/ModalRoleSelectMenu.js.map +0 -1
- package/dist/src/classes/components/ModalStringSelectMenu.d.ts +0 -58
- package/dist/src/classes/components/ModalStringSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/components/ModalStringSelectMenu.js +0 -64
- package/dist/src/classes/components/ModalStringSelectMenu.js.map +0 -1
- package/dist/src/classes/components/ModalUserSelectMenu.d.ts +0 -58
- package/dist/src/classes/components/ModalUserSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/components/ModalUserSelectMenu.js +0 -68
- package/dist/src/classes/components/ModalUserSelectMenu.js.map +0 -1
- package/dist/src/internals/Cache.d.ts +0 -76
- package/dist/src/internals/Cache.d.ts.map +0 -1
- package/dist/src/internals/Cache.js +0 -122
- package/dist/src/internals/Cache.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buape/carbon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"repository": "github:buape/carbon",
|
|
@@ -20,15 +20,16 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@types/node": "^
|
|
24
|
-
"discord-api-types": "0.38.
|
|
23
|
+
"@types/node": "^25.0.9",
|
|
24
|
+
"discord-api-types": "0.38.37"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@cloudflare/workers-types": "4.
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
27
|
+
"@cloudflare/workers-types": "4.20260120.0",
|
|
28
|
+
"@discordjs/voice": "0.19.0",
|
|
29
|
+
"@hono/node-server": "1.19.9",
|
|
30
|
+
"@types/bun": "1.3.6",
|
|
30
31
|
"@types/ws": "8.18.1",
|
|
31
|
-
"ws": "8.
|
|
32
|
+
"ws": "8.19.0"
|
|
32
33
|
},
|
|
33
34
|
"files": [
|
|
34
35
|
"dist",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { BaseCommand } from "../abstracts/BaseCommand.js";
|
|
2
|
-
import type { BaseListener } from "../abstracts/BaseListener.js";
|
|
3
|
-
import type { BaseMessageInteractiveComponent } from "../abstracts/BaseMessageInteractiveComponent.js";
|
|
4
|
-
import type { Plugin } from "../abstracts/Plugin.js";
|
|
5
|
-
import { Cache, type CacheOptions, type CacheTypes } from "../internals/Cache.js";
|
|
6
|
-
import { Client, type ClientOptions } from "./Client.js";
|
|
7
|
-
export type ClientWithCachingOptions = ClientOptions & ({
|
|
8
|
-
/**
|
|
9
|
-
* Options for the cache
|
|
10
|
-
*/
|
|
11
|
-
caching?: Partial<CacheOptions>;
|
|
12
|
-
} | {
|
|
13
|
-
/**
|
|
14
|
-
* A custom cache instance to use
|
|
15
|
-
*/
|
|
16
|
-
customCache: Cache<keyof CacheTypes, CacheTypes[keyof CacheTypes]>;
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* A variant of the Client that has caching built in
|
|
20
|
-
*/
|
|
21
|
-
export declare class ClientWithCaching extends Client {
|
|
22
|
-
cache: Cache<string, unknown>;
|
|
23
|
-
constructor(options: ClientWithCachingOptions, handlers: {
|
|
24
|
-
commands?: BaseCommand[];
|
|
25
|
-
listeners?: BaseListener[];
|
|
26
|
-
components?: BaseMessageInteractiveComponent[];
|
|
27
|
-
}, plugins?: Plugin[]);
|
|
28
|
-
isCaching(): this is ClientWithCaching;
|
|
29
|
-
static createCompositeKey(parts: (string | number)[]): string;
|
|
30
|
-
fetchUser(id: string, bypassCache?: boolean): ReturnType<typeof Client.prototype.fetchUser>;
|
|
31
|
-
fetchGuild(id: string, bypassCache?: boolean): ReturnType<typeof Client.prototype.fetchGuild>;
|
|
32
|
-
fetchChannel(id: string, bypassCache?: boolean): ReturnType<typeof Client.prototype.fetchChannel>;
|
|
33
|
-
fetchRole(guildId: string, id: string, bypassCache?: boolean): ReturnType<typeof Client.prototype.fetchRole>;
|
|
34
|
-
fetchMember(guildId: string, id: string, bypassCache?: boolean): ReturnType<typeof Client.prototype.fetchMember>;
|
|
35
|
-
fetchMessage(channelId: string, messageId: string, bypassCache?: boolean): ReturnType<typeof Client.prototype.fetchMessage>;
|
|
36
|
-
/**
|
|
37
|
-
* Purge the cache with optional filters
|
|
38
|
-
* @param options Options for purging the cache
|
|
39
|
-
*/
|
|
40
|
-
purgeCache(_options?: {
|
|
41
|
-
type?: keyof CacheTypes;
|
|
42
|
-
before?: number;
|
|
43
|
-
after?: number;
|
|
44
|
-
}): void;
|
|
45
|
-
/**
|
|
46
|
-
* Clear the entire cache or a specific type
|
|
47
|
-
* @param type Optional type to clear
|
|
48
|
-
*/
|
|
49
|
-
clearCache(_type?: keyof CacheTypes): void;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=ClientWithCaching.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientWithCaching.d.ts","sourceRoot":"","sources":["../../../src/classes/ClientWithCaching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAA;AAC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AC,YAAY,CAAC;IAapC,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,WAAW,UAAQ,GACjB,UAAU,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC;IAajC,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,WAAW,UAAQ,GACjB,UAAU,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;IAanC,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,WAAW,UAAQ,GACjB,UAAU,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC;IAiBnD;;;OAGG;IACH,UAAU,CACT,QAAQ,GAAE;QACT,IAAI,CAAC,EAAE,MAAM,UAAU,CAAA;QACvB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;KACT;IAMP;;;OAGG;IACH,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,UAAU;CAInC"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Cache } from "../internals/Cache.js";
|
|
2
|
-
import { Client } from "./Client.js";
|
|
3
|
-
/**
|
|
4
|
-
* A variant of the Client that has caching built in
|
|
5
|
-
*/
|
|
6
|
-
export class ClientWithCaching extends Client {
|
|
7
|
-
cache;
|
|
8
|
-
constructor(options, handlers, plugins = []) {
|
|
9
|
-
super(options, handlers, plugins);
|
|
10
|
-
this.cache =
|
|
11
|
-
"customCache" in options
|
|
12
|
-
? options.customCache
|
|
13
|
-
: new Cache(options.caching);
|
|
14
|
-
}
|
|
15
|
-
isCaching() {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
static createCompositeKey(parts) {
|
|
19
|
-
return parts.join(":");
|
|
20
|
-
}
|
|
21
|
-
async fetchUser(id, bypassCache = false) {
|
|
22
|
-
const key = `user:${id}`;
|
|
23
|
-
if (!bypassCache) {
|
|
24
|
-
const user = this.cache.get(key);
|
|
25
|
-
if (user)
|
|
26
|
-
return user;
|
|
27
|
-
}
|
|
28
|
-
const user = await super.fetchUser(id);
|
|
29
|
-
this.cache.set(key, user);
|
|
30
|
-
return user;
|
|
31
|
-
}
|
|
32
|
-
async fetchGuild(id, bypassCache = false) {
|
|
33
|
-
const key = `guild:${id}`;
|
|
34
|
-
if (!bypassCache) {
|
|
35
|
-
const guild = this.cache.get(key);
|
|
36
|
-
if (guild)
|
|
37
|
-
return guild;
|
|
38
|
-
}
|
|
39
|
-
const guild = await super.fetchGuild(id);
|
|
40
|
-
this.cache.set(key, guild);
|
|
41
|
-
return guild;
|
|
42
|
-
}
|
|
43
|
-
async fetchChannel(id, bypassCache = false) {
|
|
44
|
-
const key = `channel:${id}`;
|
|
45
|
-
if (!bypassCache) {
|
|
46
|
-
const channel = this.cache.get(key);
|
|
47
|
-
if (channel)
|
|
48
|
-
return channel;
|
|
49
|
-
}
|
|
50
|
-
const channel = await super.fetchChannel(id);
|
|
51
|
-
this.cache.set(key, channel);
|
|
52
|
-
return channel;
|
|
53
|
-
}
|
|
54
|
-
async fetchRole(guildId, id, bypassCache = false) {
|
|
55
|
-
const key = ClientWithCaching.createCompositeKey(["role", guildId, id]);
|
|
56
|
-
if (!bypassCache) {
|
|
57
|
-
const role = this.cache.get(key);
|
|
58
|
-
if (role)
|
|
59
|
-
return role;
|
|
60
|
-
}
|
|
61
|
-
const role = await super.fetchRole(guildId, id);
|
|
62
|
-
this.cache.set(key, role);
|
|
63
|
-
return role;
|
|
64
|
-
}
|
|
65
|
-
async fetchMember(guildId, id, bypassCache = false) {
|
|
66
|
-
const key = ClientWithCaching.createCompositeKey(["member", guildId, id]);
|
|
67
|
-
if (!bypassCache) {
|
|
68
|
-
const member = this.cache.get(key);
|
|
69
|
-
if (member)
|
|
70
|
-
return member;
|
|
71
|
-
}
|
|
72
|
-
const member = await super.fetchMember(guildId, id);
|
|
73
|
-
this.cache.set(key, member);
|
|
74
|
-
return member;
|
|
75
|
-
}
|
|
76
|
-
async fetchMessage(channelId, messageId, bypassCache = false) {
|
|
77
|
-
const key = ClientWithCaching.createCompositeKey([
|
|
78
|
-
"message",
|
|
79
|
-
channelId,
|
|
80
|
-
messageId
|
|
81
|
-
]);
|
|
82
|
-
if (!bypassCache) {
|
|
83
|
-
const message = this.cache.get(key);
|
|
84
|
-
if (message)
|
|
85
|
-
return message;
|
|
86
|
-
}
|
|
87
|
-
const message = await super.fetchMessage(channelId, messageId);
|
|
88
|
-
this.cache.set(key, message);
|
|
89
|
-
return message;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Purge the cache with optional filters
|
|
93
|
-
* @param options Options for purging the cache
|
|
94
|
-
*/
|
|
95
|
-
purgeCache(_options = {}) {
|
|
96
|
-
// TODO: Implement purgeCache on Cache class
|
|
97
|
-
// this.cache.purgeCache(options)
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Clear the entire cache or a specific type
|
|
101
|
-
* @param type Optional type to clear
|
|
102
|
-
*/
|
|
103
|
-
clearCache(_type) {
|
|
104
|
-
// TODO: Implement clearCache on Cache class
|
|
105
|
-
// this.cache.clearCache(type)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=ClientWithCaching.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientWithCaching.js","sourceRoot":"","sources":["../../../src/classes/ClientWithCaching.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,KAAK,EAGL,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAA;AAkBxD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IAC5C,KAAK,CAAwB;IAE7B,YACC,OAAiC,EACjC,QAIC,EACD,UAAoB,EAAE;QAEtB,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;QACjC,IAAI,CAAC,KA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G,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAErB,CAAA;YACZ,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAA;QAC1B,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QACnD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QAC3B,OAAO,MAAM,CAAA;IACd,CAAC;IAEQ,KAAK,CAAC,YAAY,CAC1B,SAAiB,EACjB,SAAiB,EACjB,WAAW,GAAG,KAAK;QAEnB,MAAM,GAAG,GAAG,iBAAiB,CAAC,kBAAkB,CAAC;YAChD,SAAS;YACT,SAAS;YACT,SAAS;SACT,CAAC,CAAA;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAEtB,CAAA;YACZ,IAAI,OAAO;gBAAE,OAAO,OAAO,CAAA;QAC5B,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAC9D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAC5B,OAAO,OAAO,CAAA;IACf,CAAC;IAED;;;OAGG;IACH,UAAU,CACT,WAII,EAAE;QAEN,4CAA4C;QAC5C,iCAAiC;IAClC,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,KAAwB;QAClC,4CAA4C;QAC5C,8BAA8B;IAC/B,CAAC;CACD"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { type APIChannelSelectComponent, ComponentType } from "discord-api-types/v10";
|
|
2
|
-
import { BaseModalComponent } from "../../abstracts/BaseModalComponent.js";
|
|
3
|
-
import type { ChannelSelectMenuInteraction } from "../../internals/ChannelSelectMenuInteraction.js";
|
|
4
|
-
import type { ComponentParserResult } from "../../types/index.js";
|
|
5
|
-
import type { ComponentData } from "../../types/index.js";
|
|
6
|
-
export declare abstract class ModalChannelSelectMenu extends BaseModalComponent {
|
|
7
|
-
readonly type: ComponentType.ChannelSelect;
|
|
8
|
-
readonly isV2 = false;
|
|
9
|
-
/**
|
|
10
|
-
* The custom ID of the component.
|
|
11
|
-
* If you want to provide a custom ID with additional data, you should either follow the default parser's format or implement your own custom parser.
|
|
12
|
-
*
|
|
13
|
-
* @see {@link customIdParser}
|
|
14
|
-
*/
|
|
15
|
-
abstract customId: string;
|
|
16
|
-
/**
|
|
17
|
-
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
18
|
-
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
19
|
-
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
20
|
-
*
|
|
21
|
-
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
22
|
-
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
23
|
-
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
24
|
-
*
|
|
25
|
-
* @param id - The custom ID of the component as received from an interaction event
|
|
26
|
-
* @returns The base key and the data object
|
|
27
|
-
*/
|
|
28
|
-
customIdParser: (id: string) => ComponentParserResult;
|
|
29
|
-
/**
|
|
30
|
-
* The minimum number of values that must be selected
|
|
31
|
-
*/
|
|
32
|
-
minValues?: number;
|
|
33
|
-
/**
|
|
34
|
-
* The maximum number of values that can be selected
|
|
35
|
-
*/
|
|
36
|
-
maxValues?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Whether this component is required (defaults to true in modals)
|
|
39
|
-
*/
|
|
40
|
-
required?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The placeholder text for the select menu
|
|
43
|
-
*/
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
/**
|
|
46
|
-
* The types of channels to include in the select menu
|
|
47
|
-
*/
|
|
48
|
-
channelTypes?: APIChannelSelectComponent["channel_types"];
|
|
49
|
-
/**
|
|
50
|
-
* Default values for the select menu
|
|
51
|
-
*/
|
|
52
|
-
defaultValues?: APIChannelSelectComponent["default_values"];
|
|
53
|
-
abstract run(interaction: ChannelSelectMenuInteraction, data: ComponentData): unknown | Promise<unknown>;
|
|
54
|
-
serialize: () => APIChannelSelectComponent;
|
|
55
|
-
/**
|
|
56
|
-
* The disabled field is not allowed on modal select components
|
|
57
|
-
* @throws Error when trying to set disabled to true
|
|
58
|
-
*/
|
|
59
|
-
set disabled(value: boolean | undefined);
|
|
60
|
-
get disabled(): boolean | undefined;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=ModalChannelSelectMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalChannelSelectMenu.d.ts","sourceRoot":"","sources":["../../../../src/classes/components/ModalChannelSelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,yBAAyB,EAC9B,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAA;AACnG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGzD,8BAAsB,sBAAuB,SAAQ,kBAAkB;IACtE,QAAQ,CAAC,IAAI,8BAAuC;IACpD,QAAQ,CAAC,IAAI,SAAQ;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,qBAAqB,CAAgB;IAErE;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAA;IAEzD;;OAEG;IACH,aAAa,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;IAE3D,QAAQ,CAAC,GAAG,CACX,WAAW,EAAE,4BAA4B,EACzC,IAAI,EAAE,aAAa,GACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAE7B,SAAS,QAAO,yBAAyB,CAiBxC;IAED;;;OAGG;IACH,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAMtC;IAED,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAElC;CACD"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from "discord-api-types/v10";
|
|
2
|
-
import { BaseModalComponent } from "../../abstracts/BaseModalComponent.js";
|
|
3
|
-
import { parseCustomId } from "../../utils/customIdParser.js";
|
|
4
|
-
export class ModalChannelSelectMenu extends BaseModalComponent {
|
|
5
|
-
type = ComponentType.ChannelSelect;
|
|
6
|
-
isV2 = false;
|
|
7
|
-
/**
|
|
8
|
-
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
9
|
-
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
10
|
-
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
11
|
-
*
|
|
12
|
-
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
13
|
-
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
14
|
-
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
15
|
-
*
|
|
16
|
-
* @param id - The custom ID of the component as received from an interaction event
|
|
17
|
-
* @returns The base key and the data object
|
|
18
|
-
*/
|
|
19
|
-
customIdParser = parseCustomId;
|
|
20
|
-
/**
|
|
21
|
-
* The minimum number of values that must be selected
|
|
22
|
-
*/
|
|
23
|
-
minValues;
|
|
24
|
-
/**
|
|
25
|
-
* The maximum number of values that can be selected
|
|
26
|
-
*/
|
|
27
|
-
maxValues;
|
|
28
|
-
/**
|
|
29
|
-
* Whether this component is required (defaults to true in modals)
|
|
30
|
-
*/
|
|
31
|
-
required;
|
|
32
|
-
/**
|
|
33
|
-
* The placeholder text for the select menu
|
|
34
|
-
*/
|
|
35
|
-
placeholder;
|
|
36
|
-
/**
|
|
37
|
-
* The types of channels to include in the select menu
|
|
38
|
-
*/
|
|
39
|
-
channelTypes;
|
|
40
|
-
/**
|
|
41
|
-
* Default values for the select menu
|
|
42
|
-
*/
|
|
43
|
-
defaultValues;
|
|
44
|
-
serialize = () => {
|
|
45
|
-
const data = {
|
|
46
|
-
type: this.type,
|
|
47
|
-
custom_id: this.customId,
|
|
48
|
-
placeholder: this.placeholder,
|
|
49
|
-
min_values: this.minValues,
|
|
50
|
-
max_values: this.maxValues,
|
|
51
|
-
channel_types: this.channelTypes,
|
|
52
|
-
default_values: this.defaultValues
|
|
53
|
-
};
|
|
54
|
-
// In modals, required defaults to true
|
|
55
|
-
if (this.required !== undefined) {
|
|
56
|
-
data.required = this.required;
|
|
57
|
-
}
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* The disabled field is not allowed on modal select components
|
|
62
|
-
* @throws Error when trying to set disabled to true
|
|
63
|
-
*/
|
|
64
|
-
set disabled(value) {
|
|
65
|
-
if (value === true) {
|
|
66
|
-
throw new Error("The 'disabled' field is not allowed on modal select components");
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
get disabled() {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=ModalChannelSelectMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalChannelSelectMenu.js","sourceRoot":"","sources":["../../../../src/classes/components/ModalChannelSelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAI1E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,MAAM,OAAgB,sBAAuB,SAAQ,kBAAkB;IAC7D,IAAI,GAAG,aAAa,CAAC,aAAsB,CAAA;IAC3C,IAAI,GAAG,KAAK,CAAA;IAUrB;;;;;;;;;;;OAWG;IACH,cAAc,GAA0C,aAAa,CAAA;IAErE;;OAEG;IACH,SAAS,CAAS;IAElB;;OAEG;IACH,SAAS,CAAS;IAElB;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,WAAW,CAAS;IAEpB;;OAEG;IACH,YAAY,CAA6C;IAEzD;;OAEG;IACH,aAAa,CAA8C;IAO3D,SAAS,GAAG,GAA8B,EAAE;QAC3C,MAAM,IAAI,GAA8B;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,aAAa,EAAE,IAAI,CAAC,YAAY;YAChC,cAAc,EAAE,IAAI,CAAC,aAAa;SAClC,CAAA;QAED,uCAAuC;QACvC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC,CAAA;IAED;;;OAGG;IACH,IAAI,QAAQ,CAAC,KAA0B;QACtC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACd,gEAAgE,CAChE,CAAA;QACF,CAAC;IACF,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,SAAS,CAAA;IACjB,CAAC;CACD"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { type APIMentionableSelectComponent, ComponentType } from "discord-api-types/v10";
|
|
2
|
-
import { BaseModalComponent } from "../../abstracts/BaseModalComponent.js";
|
|
3
|
-
import type { MentionableSelectMenuInteraction } from "../../internals/MentionableSelectMenuInteraction.js";
|
|
4
|
-
import type { ComponentParserResult } from "../../types/index.js";
|
|
5
|
-
import type { ComponentData } from "../../types/index.js";
|
|
6
|
-
export declare abstract class ModalMentionableSelectMenu extends BaseModalComponent {
|
|
7
|
-
readonly type: ComponentType.MentionableSelect;
|
|
8
|
-
readonly isV2 = false;
|
|
9
|
-
/**
|
|
10
|
-
* The custom ID of the component.
|
|
11
|
-
* If you want to provide a custom ID with additional data, you should either follow the default parser's format or implement your own custom parser.
|
|
12
|
-
*
|
|
13
|
-
* @see {@link customIdParser}
|
|
14
|
-
*/
|
|
15
|
-
abstract customId: string;
|
|
16
|
-
/**
|
|
17
|
-
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
18
|
-
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
19
|
-
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
20
|
-
*
|
|
21
|
-
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
22
|
-
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
23
|
-
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
24
|
-
*
|
|
25
|
-
* @param id - The custom ID of the component as received from an interaction event
|
|
26
|
-
* @returns The base key and the data object
|
|
27
|
-
*/
|
|
28
|
-
customIdParser: (id: string) => ComponentParserResult;
|
|
29
|
-
/**
|
|
30
|
-
* The minimum number of values that must be selected
|
|
31
|
-
*/
|
|
32
|
-
minValues?: number;
|
|
33
|
-
/**
|
|
34
|
-
* The maximum number of values that can be selected
|
|
35
|
-
*/
|
|
36
|
-
maxValues?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Whether this component is required (defaults to true in modals)
|
|
39
|
-
*/
|
|
40
|
-
required?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The placeholder text for the select menu
|
|
43
|
-
*/
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Default values for the select menu
|
|
47
|
-
*/
|
|
48
|
-
defaultValues?: APIMentionableSelectComponent["default_values"];
|
|
49
|
-
abstract run(interaction: MentionableSelectMenuInteraction, data: ComponentData): unknown | Promise<unknown>;
|
|
50
|
-
serialize: () => APIMentionableSelectComponent;
|
|
51
|
-
/**
|
|
52
|
-
* The disabled field is not allowed on modal select components
|
|
53
|
-
* @throws Error when trying to set disabled to true
|
|
54
|
-
*/
|
|
55
|
-
set disabled(value: boolean | undefined);
|
|
56
|
-
get disabled(): boolean | undefined;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=ModalMentionableSelectMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalMentionableSelectMenu.d.ts","sourceRoot":"","sources":["../../../../src/classes/components/ModalMentionableSelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,6BAA6B,EAClC,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAA;AAC3G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGzD,8BAAsB,0BAA2B,SAAQ,kBAAkB;IAC1E,QAAQ,CAAC,IAAI,kCAA2C;IACxD,QAAQ,CAAC,IAAI,SAAQ;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,qBAAqB,CAAgB;IAErE;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAA;IAE/D,QAAQ,CAAC,GAAG,CACX,WAAW,EAAE,gCAAgC,EAC7C,IAAI,EAAE,aAAa,GACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAE7B,SAAS,QAAO,6BAA6B,CAgB5C;IAED;;;OAGG;IACH,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAMtC;IAED,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAElC;CACD"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from "discord-api-types/v10";
|
|
2
|
-
import { BaseModalComponent } from "../../abstracts/BaseModalComponent.js";
|
|
3
|
-
import { parseCustomId } from "../../utils/customIdParser.js";
|
|
4
|
-
export class ModalMentionableSelectMenu extends BaseModalComponent {
|
|
5
|
-
type = ComponentType.MentionableSelect;
|
|
6
|
-
isV2 = false;
|
|
7
|
-
/**
|
|
8
|
-
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
9
|
-
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
10
|
-
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
11
|
-
*
|
|
12
|
-
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
13
|
-
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
14
|
-
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
15
|
-
*
|
|
16
|
-
* @param id - The custom ID of the component as received from an interaction event
|
|
17
|
-
* @returns The base key and the data object
|
|
18
|
-
*/
|
|
19
|
-
customIdParser = parseCustomId;
|
|
20
|
-
/**
|
|
21
|
-
* The minimum number of values that must be selected
|
|
22
|
-
*/
|
|
23
|
-
minValues;
|
|
24
|
-
/**
|
|
25
|
-
* The maximum number of values that can be selected
|
|
26
|
-
*/
|
|
27
|
-
maxValues;
|
|
28
|
-
/**
|
|
29
|
-
* Whether this component is required (defaults to true in modals)
|
|
30
|
-
*/
|
|
31
|
-
required;
|
|
32
|
-
/**
|
|
33
|
-
* The placeholder text for the select menu
|
|
34
|
-
*/
|
|
35
|
-
placeholder;
|
|
36
|
-
/**
|
|
37
|
-
* Default values for the select menu
|
|
38
|
-
*/
|
|
39
|
-
defaultValues;
|
|
40
|
-
serialize = () => {
|
|
41
|
-
const data = {
|
|
42
|
-
type: this.type,
|
|
43
|
-
custom_id: this.customId,
|
|
44
|
-
placeholder: this.placeholder,
|
|
45
|
-
min_values: this.minValues,
|
|
46
|
-
max_values: this.maxValues,
|
|
47
|
-
default_values: this.defaultValues
|
|
48
|
-
};
|
|
49
|
-
// In modals, required defaults to true
|
|
50
|
-
if (this.required !== undefined) {
|
|
51
|
-
data.required = this.required;
|
|
52
|
-
}
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* The disabled field is not allowed on modal select components
|
|
57
|
-
* @throws Error when trying to set disabled to true
|
|
58
|
-
*/
|
|
59
|
-
set disabled(value) {
|
|
60
|
-
if (value === true) {
|
|
61
|
-
throw new Error("The 'disabled' field is not allowed on modal select components");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
get disabled() {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=ModalMentionableSelectMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalMentionableSelectMenu.js","sourceRoot":"","sources":["../../../../src/classes/components/ModalMentionableSelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAI1E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,MAAM,OAAgB,0BAA2B,SAAQ,kBAAkB;IACjE,IAAI,GAAG,aAAa,CAAC,iBAA0B,CAAA;IAC/C,IAAI,GAAG,KAAK,CAAA;IAUrB;;;;;;;;;;;OAWG;IACH,cAAc,GAA0C,aAAa,CAAA;IAErE;;OAEG;IACH,SAAS,CAAS;IAElB;;OAEG;IACH,SAAS,CAAS;IAElB;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,WAAW,CAAS;IAEpB;;OAEG;IACH,aAAa,CAAkD;IAO/D,SAAS,GAAG,GAAkC,EAAE;QAC/C,MAAM,IAAI,GAAkC;YAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,cAAc,EAAE,IAAI,CAAC,aAAa;SAClC,CAAA;QAED,uCAAuC;QACvC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC,CAAA;IAED;;;OAGG;IACH,IAAI,QAAQ,CAAC,KAA0B;QACtC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACd,gEAAgE,CAChE,CAAA;QACF,CAAC;IACF,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,SAAS,CAAA;IACjB,CAAC;CACD"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { type APIRoleSelectComponent, ComponentType } from "discord-api-types/v10";
|
|
2
|
-
import { BaseModalComponent } from "../../abstracts/BaseModalComponent.js";
|
|
3
|
-
import type { RoleSelectMenuInteraction } from "../../internals/RoleSelectMenuInteraction.js";
|
|
4
|
-
import type { ComponentParserResult } from "../../types/index.js";
|
|
5
|
-
import type { ComponentData } from "../../types/index.js";
|
|
6
|
-
export declare abstract class ModalRoleSelectMenu extends BaseModalComponent {
|
|
7
|
-
readonly type: ComponentType.RoleSelect;
|
|
8
|
-
readonly isV2 = false;
|
|
9
|
-
/**
|
|
10
|
-
* The custom ID of the component.
|
|
11
|
-
* If you want to provide a custom ID with additional data, you should either follow the default parser's format or implement your own custom parser.
|
|
12
|
-
*
|
|
13
|
-
* @see {@link customIdParser}
|
|
14
|
-
*/
|
|
15
|
-
abstract customId: string;
|
|
16
|
-
/**
|
|
17
|
-
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
18
|
-
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
19
|
-
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
20
|
-
*
|
|
21
|
-
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
22
|
-
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
23
|
-
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
24
|
-
*
|
|
25
|
-
* @param id - The custom ID of the component as received from an interaction event
|
|
26
|
-
* @returns The base key and the data object
|
|
27
|
-
*/
|
|
28
|
-
customIdParser: (id: string) => ComponentParserResult;
|
|
29
|
-
/**
|
|
30
|
-
* The minimum number of values that must be selected
|
|
31
|
-
*/
|
|
32
|
-
minValues?: number;
|
|
33
|
-
/**
|
|
34
|
-
* The maximum number of values that can be selected
|
|
35
|
-
*/
|
|
36
|
-
maxValues?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Whether this component is required (defaults to true in modals)
|
|
39
|
-
*/
|
|
40
|
-
required?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The placeholder text for the select menu
|
|
43
|
-
*/
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Default values for the select menu
|
|
47
|
-
*/
|
|
48
|
-
defaultValues?: APIRoleSelectComponent["default_values"];
|
|
49
|
-
abstract run(interaction: RoleSelectMenuInteraction, data: ComponentData): unknown | Promise<unknown>;
|
|
50
|
-
serialize: () => APIRoleSelectComponent;
|
|
51
|
-
/**
|
|
52
|
-
* The disabled field is not allowed on modal select components
|
|
53
|
-
* @throws Error when trying to set disabled to true
|
|
54
|
-
*/
|
|
55
|
-
set disabled(value: boolean | undefined);
|
|
56
|
-
get disabled(): boolean | undefined;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=ModalRoleSelectMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalRoleSelectMenu.d.ts","sourceRoot":"","sources":["../../../../src/classes/components/ModalRoleSelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,sBAAsB,EAC3B,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AAC7F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGzD,8BAAsB,mBAAoB,SAAQ,kBAAkB;IACnE,QAAQ,CAAC,IAAI,2BAAoC;IACjD,QAAQ,CAAC,IAAI,SAAQ;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,qBAAqB,CAAgB;IAErE;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;IAExD,QAAQ,CAAC,GAAG,CACX,WAAW,EAAE,yBAAyB,EACtC,IAAI,EAAE,aAAa,GACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAE7B,SAAS,QAAO,sBAAsB,CAgBrC;IAED;;;OAGG;IACH,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAMtC;IAED,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAElC;CACD"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from "discord-api-types/v10";
|
|
2
|
-
import { BaseModalComponent } from "../../abstracts/BaseModalComponent.js";
|
|
3
|
-
import { parseCustomId } from "../../utils/customIdParser.js";
|
|
4
|
-
export class ModalRoleSelectMenu extends BaseModalComponent {
|
|
5
|
-
type = ComponentType.RoleSelect;
|
|
6
|
-
isV2 = false;
|
|
7
|
-
/**
|
|
8
|
-
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
9
|
-
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
10
|
-
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
11
|
-
*
|
|
12
|
-
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
13
|
-
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
14
|
-
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
15
|
-
*
|
|
16
|
-
* @param id - The custom ID of the component as received from an interaction event
|
|
17
|
-
* @returns The base key and the data object
|
|
18
|
-
*/
|
|
19
|
-
customIdParser = parseCustomId;
|
|
20
|
-
/**
|
|
21
|
-
* The minimum number of values that must be selected
|
|
22
|
-
*/
|
|
23
|
-
minValues;
|
|
24
|
-
/**
|
|
25
|
-
* The maximum number of values that can be selected
|
|
26
|
-
*/
|
|
27
|
-
maxValues;
|
|
28
|
-
/**
|
|
29
|
-
* Whether this component is required (defaults to true in modals)
|
|
30
|
-
*/
|
|
31
|
-
required;
|
|
32
|
-
/**
|
|
33
|
-
* The placeholder text for the select menu
|
|
34
|
-
*/
|
|
35
|
-
placeholder;
|
|
36
|
-
/**
|
|
37
|
-
* Default values for the select menu
|
|
38
|
-
*/
|
|
39
|
-
defaultValues;
|
|
40
|
-
serialize = () => {
|
|
41
|
-
const data = {
|
|
42
|
-
type: this.type,
|
|
43
|
-
custom_id: this.customId,
|
|
44
|
-
placeholder: this.placeholder,
|
|
45
|
-
min_values: this.minValues,
|
|
46
|
-
max_values: this.maxValues,
|
|
47
|
-
default_values: this.defaultValues
|
|
48
|
-
};
|
|
49
|
-
// In modals, required defaults to true
|
|
50
|
-
if (this.required !== undefined) {
|
|
51
|
-
data.required = this.required;
|
|
52
|
-
}
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* The disabled field is not allowed on modal select components
|
|
57
|
-
* @throws Error when trying to set disabled to true
|
|
58
|
-
*/
|
|
59
|
-
set disabled(value) {
|
|
60
|
-
if (value === true) {
|
|
61
|
-
throw new Error("The 'disabled' field is not allowed on modal select components");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
get disabled() {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=ModalRoleSelectMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalRoleSelectMenu.js","sourceRoot":"","sources":["../../../../src/classes/components/ModalRoleSelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAI1E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,MAAM,OAAgB,mBAAoB,SAAQ,kBAAkB;IAC1D,IAAI,GAAG,aAAa,CAAC,UAAmB,CAAA;IACxC,IAAI,GAAG,KAAK,CAAA;IAUrB;;;;;;;;;;;OAWG;IACH,cAAc,GAA0C,aAAa,CAAA;IAErE;;OAEG;IACH,SAAS,CAAS;IAElB;;OAEG;IACH,SAAS,CAAS;IAElB;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,WAAW,CAAS;IAEpB;;OAEG;IACH,aAAa,CAA2C;IAOxD,SAAS,GAAG,GAA2B,EAAE;QACxC,MAAM,IAAI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