carbon-proxy 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/README.md +237 -0
- package/dist/package.json +43 -0
- package/dist/src/abstracts/AnySelectMenu.d.ts +40 -0
- package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -0
- package/dist/src/abstracts/AnySelectMenu.js +41 -0
- package/dist/src/abstracts/AnySelectMenu.js.map +1 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +12 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.js +19 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -0
- package/dist/src/abstracts/Base.d.ts +10 -0
- package/dist/src/abstracts/Base.d.ts.map +1 -0
- package/dist/src/abstracts/Base.js +11 -0
- package/dist/src/abstracts/Base.js.map +1 -0
- package/dist/src/abstracts/BaseChannel.d.ts +60 -0
- package/dist/src/abstracts/BaseChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseChannel.js +90 -0
- package/dist/src/abstracts/BaseChannel.js.map +1 -0
- package/dist/src/abstracts/BaseCommand.d.ts +77 -0
- package/dist/src/abstracts/BaseCommand.d.ts.map +1 -0
- package/dist/src/abstracts/BaseCommand.js +127 -0
- package/dist/src/abstracts/BaseCommand.js.map +1 -0
- package/dist/src/abstracts/BaseComponent.d.ts +20 -0
- package/dist/src/abstracts/BaseComponent.d.ts.map +1 -0
- package/dist/src/abstracts/BaseComponent.js +10 -0
- package/dist/src/abstracts/BaseComponent.js.map +1 -0
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +18 -0
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/BaseComponentInteraction.js +41 -0
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -0
- package/dist/src/abstracts/BaseGuildChannel.d.ts +61 -0
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseGuildChannel.js +125 -0
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -0
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts +53 -0
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseGuildTextChannel.js +89 -0
- package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -0
- package/dist/src/abstracts/BaseInteraction.d.ts +166 -0
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/BaseInteraction.js +274 -0
- package/dist/src/abstracts/BaseInteraction.js.map +1 -0
- package/dist/src/abstracts/BaseListener.d.ts +13 -0
- package/dist/src/abstracts/BaseListener.d.ts.map +1 -0
- package/dist/src/abstracts/BaseListener.js +8 -0
- package/dist/src/abstracts/BaseListener.js.map +1 -0
- package/dist/src/abstracts/BaseMessageInteractiveComponent.d.ts +41 -0
- package/dist/src/abstracts/BaseMessageInteractiveComponent.d.ts.map +1 -0
- package/dist/src/abstracts/BaseMessageInteractiveComponent.js +35 -0
- package/dist/src/abstracts/BaseMessageInteractiveComponent.js.map +1 -0
- package/dist/src/abstracts/BaseModalComponent.d.ts +9 -0
- package/dist/src/abstracts/BaseModalComponent.d.ts.map +1 -0
- package/dist/src/abstracts/BaseModalComponent.js +5 -0
- package/dist/src/abstracts/BaseModalComponent.js.map +1 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +58 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.js +102 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -0
- package/dist/src/abstracts/Plugin.d.ts +49 -0
- package/dist/src/abstracts/Plugin.d.ts.map +1 -0
- package/dist/src/abstracts/Plugin.js +6 -0
- package/dist/src/abstracts/Plugin.js.map +1 -0
- package/dist/src/adapters/bun/index.d.ts +13 -0
- package/dist/src/adapters/bun/index.d.ts.map +1 -0
- package/dist/src/adapters/bun/index.js +16 -0
- package/dist/src/adapters/bun/index.js.map +1 -0
- package/dist/src/adapters/fetch/index.d.ts +11 -0
- package/dist/src/adapters/fetch/index.d.ts.map +1 -0
- package/dist/src/adapters/fetch/index.js +50 -0
- package/dist/src/adapters/fetch/index.js.map +1 -0
- package/dist/src/adapters/node/index.d.ts +13 -0
- package/dist/src/adapters/node/index.d.ts.map +1 -0
- package/dist/src/adapters/node/index.js +17 -0
- package/dist/src/adapters/node/index.js.map +1 -0
- package/dist/src/classes/Client.d.ts +253 -0
- package/dist/src/classes/Client.d.ts.map +1 -0
- package/dist/src/classes/Client.js +419 -0
- package/dist/src/classes/Client.js.map +1 -0
- package/dist/src/classes/Command.d.ts +44 -0
- package/dist/src/classes/Command.d.ts.map +1 -0
- package/dist/src/classes/Command.js +53 -0
- package/dist/src/classes/Command.js.map +1 -0
- package/dist/src/classes/CommandWithSubcommandGroups.d.ts +22 -0
- package/dist/src/classes/CommandWithSubcommandGroups.d.ts.map +1 -0
- package/dist/src/classes/CommandWithSubcommandGroups.js +27 -0
- package/dist/src/classes/CommandWithSubcommandGroups.js.map +1 -0
- package/dist/src/classes/CommandWithSubcommands.d.ts +19 -0
- package/dist/src/classes/CommandWithSubcommands.d.ts.map +1 -0
- package/dist/src/classes/CommandWithSubcommands.js +19 -0
- package/dist/src/classes/CommandWithSubcommands.js.map +1 -0
- package/dist/src/classes/Embed.d.ts +61 -0
- package/dist/src/classes/Embed.d.ts.map +1 -0
- package/dist/src/classes/Embed.js +75 -0
- package/dist/src/classes/Embed.js.map +1 -0
- package/dist/src/classes/Listener.d.ts +392 -0
- package/dist/src/classes/Listener.d.ts.map +1 -0
- package/dist/src/classes/Listener.js +1034 -0
- package/dist/src/classes/Listener.js.map +1 -0
- package/dist/src/classes/Modal.d.ts +37 -0
- package/dist/src/classes/Modal.d.ts.map +1 -0
- package/dist/src/classes/Modal.js +28 -0
- package/dist/src/classes/Modal.js.map +1 -0
- package/dist/src/classes/RequestClient.d.ts +106 -0
- package/dist/src/classes/RequestClient.d.ts.map +1 -0
- package/dist/src/classes/RequestClient.js +451 -0
- package/dist/src/classes/RequestClient.js.map +1 -0
- package/dist/src/classes/components/Button.d.ts +52 -0
- package/dist/src/classes/components/Button.d.ts.map +1 -0
- package/dist/src/classes/components/Button.js +71 -0
- package/dist/src/classes/components/Button.js.map +1 -0
- package/dist/src/classes/components/ChannelSelectMenu.d.ts +17 -0
- package/dist/src/classes/components/ChannelSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/components/ChannelSelectMenu.js +22 -0
- package/dist/src/classes/components/ChannelSelectMenu.js.map +1 -0
- 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 +28 -0
- package/dist/src/classes/components/Container.d.ts.map +1 -0
- package/dist/src/classes/components/Container.js +38 -0
- package/dist/src/classes/components/Container.js.map +1 -0
- package/dist/src/classes/components/File.d.ts +21 -0
- package/dist/src/classes/components/File.d.ts.map +1 -0
- package/dist/src/classes/components/File.js +36 -0
- package/dist/src/classes/components/File.js.map +1 -0
- 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 +31 -0
- package/dist/src/classes/components/Label.d.ts.map +1 -0
- package/dist/src/classes/components/Label.js +35 -0
- package/dist/src/classes/components/Label.js.map +1 -0
- package/dist/src/classes/components/MediaGallery.d.ts +22 -0
- package/dist/src/classes/components/MediaGallery.d.ts.map +1 -0
- package/dist/src/classes/components/MediaGallery.js +32 -0
- package/dist/src/classes/components/MediaGallery.js.map +1 -0
- package/dist/src/classes/components/MentionableSelectMenu.d.ts +15 -0
- package/dist/src/classes/components/MentionableSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/components/MentionableSelectMenu.js +20 -0
- package/dist/src/classes/components/MentionableSelectMenu.js.map +1 -0
- 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/RoleSelectMenu.d.ts +15 -0
- package/dist/src/classes/components/RoleSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/components/RoleSelectMenu.js +20 -0
- package/dist/src/classes/components/RoleSelectMenu.js.map +1 -0
- package/dist/src/classes/components/Row.d.ts +28 -0
- package/dist/src/classes/components/Row.d.ts.map +1 -0
- package/dist/src/classes/components/Row.js +44 -0
- package/dist/src/classes/components/Row.js.map +1 -0
- package/dist/src/classes/components/Section.d.ts +23 -0
- package/dist/src/classes/components/Section.d.ts.map +1 -0
- package/dist/src/classes/components/Section.js +37 -0
- package/dist/src/classes/components/Section.js.map +1 -0
- package/dist/src/classes/components/Separator.d.ts +22 -0
- package/dist/src/classes/components/Separator.d.ts.map +1 -0
- package/dist/src/classes/components/Separator.js +33 -0
- package/dist/src/classes/components/Separator.js.map +1 -0
- package/dist/src/classes/components/StringSelectMenu.d.ts +15 -0
- package/dist/src/classes/components/StringSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/components/StringSelectMenu.js +19 -0
- package/dist/src/classes/components/StringSelectMenu.js.map +1 -0
- package/dist/src/classes/components/TextDisplay.d.ts +10 -0
- package/dist/src/classes/components/TextDisplay.d.ts.map +1 -0
- package/dist/src/classes/components/TextDisplay.js +22 -0
- package/dist/src/classes/components/TextDisplay.js.map +1 -0
- package/dist/src/classes/components/TextInput.d.ts +53 -0
- package/dist/src/classes/components/TextInput.d.ts.map +1 -0
- package/dist/src/classes/components/TextInput.js +57 -0
- package/dist/src/classes/components/TextInput.js.map +1 -0
- package/dist/src/classes/components/Thumbnail.d.ts +14 -0
- package/dist/src/classes/components/Thumbnail.d.ts.map +1 -0
- package/dist/src/classes/components/Thumbnail.js +27 -0
- package/dist/src/classes/components/Thumbnail.js.map +1 -0
- package/dist/src/classes/components/UserSelectMenu.d.ts +15 -0
- package/dist/src/classes/components/UserSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/components/UserSelectMenu.js +20 -0
- package/dist/src/classes/components/UserSelectMenu.js.map +1 -0
- package/dist/src/errors/BaseError.d.ts +3 -0
- package/dist/src/errors/BaseError.d.ts.map +1 -0
- package/dist/src/errors/BaseError.js +3 -0
- package/dist/src/errors/BaseError.js.map +1 -0
- package/dist/src/errors/DiscordError.d.ts +25 -0
- package/dist/src/errors/DiscordError.d.ts.map +1 -0
- package/dist/src/errors/DiscordError.js +31 -0
- package/dist/src/errors/DiscordError.js.map +1 -0
- package/dist/src/errors/RatelimitError.d.ts +15 -0
- package/dist/src/errors/RatelimitError.d.ts.map +1 -0
- package/dist/src/errors/RatelimitError.js +18 -0
- package/dist/src/errors/RatelimitError.js.map +1 -0
- package/dist/src/functions/channelFactory.d.ts +14 -0
- package/dist/src/functions/channelFactory.d.ts.map +1 -0
- package/dist/src/functions/channelFactory.js +39 -0
- package/dist/src/functions/channelFactory.js.map +1 -0
- 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 +14 -0
- package/dist/src/functions/errorsMapper.d.ts.map +1 -0
- package/dist/src/functions/errorsMapper.js +46 -0
- package/dist/src/functions/errorsMapper.js.map +1 -0
- package/dist/src/index.d.ts +93 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +100 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internals/AutocompleteInteraction.d.ts +43 -0
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -0
- package/dist/src/internals/AutocompleteInteraction.js +73 -0
- package/dist/src/internals/AutocompleteInteraction.js.map +1 -0
- package/dist/src/internals/ButtonInteraction.d.ts +8 -0
- package/dist/src/internals/ButtonInteraction.d.ts.map +1 -0
- package/dist/src/internals/ButtonInteraction.js +16 -0
- package/dist/src/internals/ButtonInteraction.js.map +1 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.d.ts +8 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.js +11 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/CommandHandler.d.ts +13 -0
- package/dist/src/internals/CommandHandler.d.ts.map +1 -0
- package/dist/src/internals/CommandHandler.js +143 -0
- package/dist/src/internals/CommandHandler.js.map +1 -0
- package/dist/src/internals/CommandInteraction.d.ts +26 -0
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -0
- package/dist/src/internals/CommandInteraction.js +60 -0
- package/dist/src/internals/CommandInteraction.js.map +1 -0
- package/dist/src/internals/ComponentHandler.d.ts +14 -0
- package/dist/src/internals/ComponentHandler.d.ts.map +1 -0
- package/dist/src/internals/ComponentHandler.js +183 -0
- package/dist/src/internals/ComponentHandler.js.map +1 -0
- package/dist/src/internals/EmojiHandler.d.ts +19 -0
- package/dist/src/internals/EmojiHandler.d.ts.map +1 -0
- package/dist/src/internals/EmojiHandler.js +34 -0
- package/dist/src/internals/EmojiHandler.js.map +1 -0
- package/dist/src/internals/EventHandler.d.ts +22 -0
- package/dist/src/internals/EventHandler.d.ts.map +1 -0
- package/dist/src/internals/EventHandler.js +23 -0
- package/dist/src/internals/EventHandler.js.map +1 -0
- 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 +68 -0
- package/dist/src/internals/FieldsHandler.d.ts.map +1 -0
- package/dist/src/internals/FieldsHandler.js +146 -0
- package/dist/src/internals/FieldsHandler.js.map +1 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.js +15 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/ModalHandler.d.ts +17 -0
- package/dist/src/internals/ModalHandler.d.ts.map +1 -0
- package/dist/src/internals/ModalHandler.js +35 -0
- package/dist/src/internals/ModalHandler.js.map +1 -0
- package/dist/src/internals/ModalInteraction.d.ts +21 -0
- package/dist/src/internals/ModalInteraction.d.ts.map +1 -0
- package/dist/src/internals/ModalInteraction.js +41 -0
- package/dist/src/internals/ModalInteraction.js.map +1 -0
- package/dist/src/internals/OptionsHandler.d.ts +108 -0
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -0
- package/dist/src/internals/OptionsHandler.js +237 -0
- package/dist/src/internals/OptionsHandler.js.map +1 -0
- package/dist/src/internals/RoleSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/RoleSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/RoleSelectMenuInteraction.js +14 -0
- package/dist/src/internals/RoleSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/StringSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/StringSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/StringSelectMenuInteraction.js +14 -0
- package/dist/src/internals/StringSelectMenuInteraction.js.map +1 -0
- 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/internals/UserSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/UserSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/UserSelectMenuInteraction.js +14 -0
- package/dist/src/internals/UserSelectMenuInteraction.js.map +1 -0
- package/dist/src/permissions.d.ts +56 -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/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 +16 -0
- package/dist/src/plugins/command-data/CommandDataPlugin.d.ts.map +1 -0
- package/dist/src/plugins/command-data/CommandDataPlugin.js +43 -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/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 +90 -0
- package/dist/src/plugins/gateway/GatewayPlugin.d.ts.map +1 -0
- package/dist/src/plugins/gateway/GatewayPlugin.js +516 -0
- package/dist/src/plugins/gateway/GatewayPlugin.js.map +1 -0
- 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/index.d.ts +7 -0
- package/dist/src/plugins/gateway/index.d.ts.map +1 -0
- package/dist/src/plugins/gateway/index.js +7 -0
- package/dist/src/plugins/gateway/index.js.map +1 -0
- package/dist/src/plugins/gateway/types.d.ts +130 -0
- package/dist/src/plugins/gateway/types.d.ts.map +1 -0
- package/dist/src/plugins/gateway/types.js +5 -0
- package/dist/src/plugins/gateway/types.js.map +1 -0
- package/dist/src/plugins/gateway/utils/heartbeat.d.ts +18 -0
- package/dist/src/plugins/gateway/utils/heartbeat.d.ts.map +1 -0
- package/dist/src/plugins/gateway/utils/heartbeat.js +33 -0
- package/dist/src/plugins/gateway/utils/heartbeat.js.map +1 -0
- package/dist/src/plugins/gateway/utils/monitor.d.ts +37 -0
- package/dist/src/plugins/gateway/utils/monitor.d.ts.map +1 -0
- package/dist/src/plugins/gateway/utils/monitor.js +88 -0
- package/dist/src/plugins/gateway/utils/monitor.js.map +1 -0
- package/dist/src/plugins/gateway/utils/payload.d.ts +24 -0
- package/dist/src/plugins/gateway/utils/payload.d.ts.map +1 -0
- package/dist/src/plugins/gateway/utils/payload.js +65 -0
- package/dist/src/plugins/gateway/utils/payload.js.map +1 -0
- 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 +30 -0
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.d.ts.map +1 -0
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js +80 -0
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js.map +1 -0
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts +9 -0
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts.map +1 -0
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js +7 -0
- package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js.map +1 -0
- package/dist/src/plugins/gateway-forwarder/index.d.ts +4 -0
- package/dist/src/plugins/gateway-forwarder/index.d.ts.map +1 -0
- package/dist/src/plugins/gateway-forwarder/index.js +4 -0
- package/dist/src/plugins/gateway-forwarder/index.js.map +1 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.d.ts +70 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.js +211 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.js.map +1 -0
- package/dist/src/plugins/linked-roles/index.d.ts +3 -0
- package/dist/src/plugins/linked-roles/index.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/index.js +3 -0
- package/dist/src/plugins/linked-roles/index.js.map +1 -0
- package/dist/src/plugins/linked-roles/types.d.ts +94 -0
- package/dist/src/plugins/linked-roles/types.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/types.js +39 -0
- package/dist/src/plugins/linked-roles/types.js.map +1 -0
- package/dist/src/plugins/paginator/GoToPageModal.d.ts +18 -0
- package/dist/src/plugins/paginator/GoToPageModal.d.ts.map +1 -0
- package/dist/src/plugins/paginator/GoToPageModal.js +56 -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 +11 -0
- package/dist/src/plugins/paginator/index.d.ts.map +1 -0
- package/dist/src/plugins/paginator/index.js +11 -0
- package/dist/src/plugins/paginator/index.js.map +1 -0
- package/dist/src/plugins/sharding/ShardingPlugin.d.ts +44 -0
- package/dist/src/plugins/sharding/ShardingPlugin.d.ts.map +1 -0
- package/dist/src/plugins/sharding/ShardingPlugin.js +119 -0
- package/dist/src/plugins/sharding/ShardingPlugin.js.map +1 -0
- package/dist/src/plugins/sharding/index.d.ts +3 -0
- package/dist/src/plugins/sharding/index.d.ts.map +1 -0
- package/dist/src/plugins/sharding/index.js +3 -0
- package/dist/src/plugins/sharding/index.js.map +1 -0
- 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 +58 -0
- package/dist/src/plugins/voice/VoicePlugin.js.map +1 -0
- package/dist/src/plugins/voice/VoiceServerUpdateListener.d.ts +10 -0
- package/dist/src/plugins/voice/VoiceServerUpdateListener.d.ts.map +1 -0
- package/dist/src/plugins/voice/VoiceServerUpdateListener.js +16 -0
- package/dist/src/plugins/voice/VoiceServerUpdateListener.js.map +1 -0
- package/dist/src/plugins/voice/VoiceStateUpdateListener.d.ts +10 -0
- package/dist/src/plugins/voice/VoiceStateUpdateListener.d.ts.map +1 -0
- package/dist/src/plugins/voice/VoiceStateUpdateListener.js +21 -0
- package/dist/src/plugins/voice/VoiceStateUpdateListener.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 +22 -0
- package/dist/src/structures/DmChannel.d.ts.map +1 -0
- package/dist/src/structures/DmChannel.js +33 -0
- package/dist/src/structures/DmChannel.js.map +1 -0
- package/dist/src/structures/Emoji.d.ts +75 -0
- package/dist/src/structures/Emoji.d.ts.map +1 -0
- package/dist/src/structures/Emoji.js +156 -0
- package/dist/src/structures/Emoji.js.map +1 -0
- package/dist/src/structures/GroupDmChannel.d.ts +75 -0
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -0
- package/dist/src/structures/GroupDmChannel.js +131 -0
- package/dist/src/structures/GroupDmChannel.js.map +1 -0
- package/dist/src/structures/Guild.d.ts +338 -0
- package/dist/src/structures/Guild.d.ts.map +1 -0
- package/dist/src/structures/Guild.js +715 -0
- package/dist/src/structures/Guild.js.map +1 -0
- package/dist/src/structures/GuildAnnouncementChannel.d.ts +21 -0
- package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildAnnouncementChannel.js +35 -0
- package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -0
- package/dist/src/structures/GuildCategoryChannel.d.ts +23 -0
- package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildCategoryChannel.js +34 -0
- package/dist/src/structures/GuildCategoryChannel.js.map +1 -0
- package/dist/src/structures/GuildForumChannel.d.ts +14 -0
- package/dist/src/structures/GuildForumChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildForumChannel.js +15 -0
- package/dist/src/structures/GuildForumChannel.js.map +1 -0
- package/dist/src/structures/GuildMediaChannel.d.ts +9 -0
- package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildMediaChannel.js +7 -0
- package/dist/src/structures/GuildMediaChannel.js.map +1 -0
- package/dist/src/structures/GuildMember.d.ts +145 -0
- package/dist/src/structures/GuildMember.d.ts.map +1 -0
- package/dist/src/structures/GuildMember.js +320 -0
- package/dist/src/structures/GuildMember.js.map +1 -0
- 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/GuildStageOrVoiceChannel.d.ts +40 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.js +63 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -0
- package/dist/src/structures/GuildTextChannel.d.ts +24 -0
- package/dist/src/structures/GuildTextChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildTextChannel.js +41 -0
- package/dist/src/structures/GuildTextChannel.js.map +1 -0
- package/dist/src/structures/GuildThreadChannel.d.ts +90 -0
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildThreadChannel.js +165 -0
- package/dist/src/structures/GuildThreadChannel.js.map +1 -0
- package/dist/src/structures/Message.d.ts +174 -0
- package/dist/src/structures/Message.d.ts.map +1 -0
- package/dist/src/structures/Message.js +417 -0
- package/dist/src/structures/Message.js.map +1 -0
- package/dist/src/structures/Poll.d.ts +29 -0
- package/dist/src/structures/Poll.d.ts.map +1 -0
- package/dist/src/structures/Poll.js +51 -0
- package/dist/src/structures/Poll.js.map +1 -0
- package/dist/src/structures/Role.d.ts +151 -0
- package/dist/src/structures/Role.d.ts.map +1 -0
- package/dist/src/structures/Role.js +291 -0
- package/dist/src/structures/Role.js.map +1 -0
- package/dist/src/structures/ThreadMember.d.ts +40 -0
- package/dist/src/structures/ThreadMember.d.ts.map +1 -0
- package/dist/src/structures/ThreadMember.js +79 -0
- package/dist/src/structures/ThreadMember.js.map +1 -0
- package/dist/src/structures/User.d.ts +104 -0
- package/dist/src/structures/User.d.ts.map +1 -0
- package/dist/src/structures/User.js +199 -0
- package/dist/src/structures/User.js.map +1 -0
- package/dist/src/structures/Webhook.d.ts +160 -0
- package/dist/src/structures/Webhook.d.ts.map +1 -0
- package/dist/src/structures/Webhook.js +287 -0
- package/dist/src/structures/Webhook.js.map +1 -0
- package/dist/src/types/index.d.ts +199 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +2 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/listeners.d.ts +579 -0
- package/dist/src/types/listeners.d.ts.map +1 -0
- package/dist/src/types/listeners.js +14 -0
- package/dist/src/types/listeners.js.map +1 -0
- 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 +3 -0
- package/dist/src/utils/customIdParser.d.ts.map +1 -0
- package/dist/src/utils/customIdParser.js +38 -0
- package/dist/src/utils/customIdParser.js.map +1 -0
- package/dist/src/utils/index.d.ts +6 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +6 -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 +61 -0
- package/dist/src/utils/payload.js.map +1 -0
- package/dist/src/utils/proxy.d.ts +27 -0
- package/dist/src/utils/proxy.d.ts.map +1 -0
- package/dist/src/utils/proxy.js +135 -0
- package/dist/src/utils/proxy.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 -0
- package/package.json +43 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { ApplicationCommandOptionType, ApplicationCommandType } from "discord-api-types/v10";
|
|
2
|
+
import { Base } from "../abstracts/Base.js";
|
|
3
|
+
import { Command } from "../classes/Command.js";
|
|
4
|
+
import { CommandWithSubcommandGroups } from "../classes/CommandWithSubcommandGroups.js";
|
|
5
|
+
import { CommandWithSubcommands } from "../classes/CommandWithSubcommands.js";
|
|
6
|
+
import { AutocompleteInteraction } from "./AutocompleteInteraction.js";
|
|
7
|
+
import { CommandInteraction } from "./CommandInteraction.js";
|
|
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
|
+
}
|
|
19
|
+
getCommand(rawInteraction) {
|
|
20
|
+
let command = this.client.commands.find((x) => x.name === rawInteraction.data.name);
|
|
21
|
+
if (!command)
|
|
22
|
+
command = this.client.commands.find((x) => x.name === "*");
|
|
23
|
+
if (!command)
|
|
24
|
+
throw new Error("Command not found");
|
|
25
|
+
if (command instanceof CommandWithSubcommandGroups) {
|
|
26
|
+
if (rawInteraction.data.type !== ApplicationCommandType.ChatInput) {
|
|
27
|
+
throw new Error("Subcommand groups must be used with ChatInput");
|
|
28
|
+
}
|
|
29
|
+
const data = rawInteraction.data;
|
|
30
|
+
const subcommandGroupName = data.options?.find((x) => x.type === ApplicationCommandOptionType.SubcommandGroup)?.name;
|
|
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
|
+
}
|
|
39
|
+
const subcommandGroup = command.subcommandGroups.find((x) => x.name === subcommandGroupName);
|
|
40
|
+
if (!subcommandGroup)
|
|
41
|
+
throw new Error("Subcommand group not found");
|
|
42
|
+
const subcommandName = (data.options?.find((x) => x.type === ApplicationCommandOptionType.SubcommandGroup)).options?.find((x) => x.type === ApplicationCommandOptionType.Subcommand)?.name;
|
|
43
|
+
if (!subcommandName)
|
|
44
|
+
throw new Error("No subcommand name");
|
|
45
|
+
const subcommand = subcommandGroup.subcommands.find((x) => x.name === subcommandName);
|
|
46
|
+
if (!subcommand)
|
|
47
|
+
throw new Error("Subcommand not found");
|
|
48
|
+
return subcommand;
|
|
49
|
+
}
|
|
50
|
+
if (command instanceof CommandWithSubcommands) {
|
|
51
|
+
return this.getSubcommand(command, rawInteraction);
|
|
52
|
+
}
|
|
53
|
+
if (command instanceof Command) {
|
|
54
|
+
return command;
|
|
55
|
+
}
|
|
56
|
+
throw new Error("Command is not a valid command type");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Handle a command interaction
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
async handleCommandInteraction(rawInteraction) {
|
|
63
|
+
const command = this.getCommand(rawInteraction);
|
|
64
|
+
if (!command)
|
|
65
|
+
return false;
|
|
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: typeof command.ephemeral === "function"
|
|
76
|
+
? false // Will be resolved later after interaction is created
|
|
77
|
+
: command.ephemeral
|
|
78
|
+
},
|
|
79
|
+
processingCommand: command
|
|
80
|
+
});
|
|
81
|
+
try {
|
|
82
|
+
const command = this.getCommand(rawInteraction);
|
|
83
|
+
// Resolve ephemeral setting if it's a function
|
|
84
|
+
if (typeof command.ephemeral === "function") {
|
|
85
|
+
interaction.setDefaultEphemeral(command.ephemeral(interaction));
|
|
86
|
+
}
|
|
87
|
+
// Resolve defer setting if it's a function
|
|
88
|
+
const shouldDefer = typeof command.defer === "function"
|
|
89
|
+
? command.defer(interaction)
|
|
90
|
+
: command.defer;
|
|
91
|
+
if (shouldDefer) {
|
|
92
|
+
await interaction.defer();
|
|
93
|
+
}
|
|
94
|
+
if (command.preCheck) {
|
|
95
|
+
const result = await command.preCheck(interaction);
|
|
96
|
+
if (!result)
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return await command.run(interaction);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
if (e instanceof Error)
|
|
103
|
+
console.error(e.message);
|
|
104
|
+
console.error(e);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async handleAutocompleteInteraction(rawInteraction) {
|
|
108
|
+
const command = this.getCommand(rawInteraction);
|
|
109
|
+
if (!command)
|
|
110
|
+
return false;
|
|
111
|
+
const interaction = new AutocompleteInteraction({
|
|
112
|
+
client: this.client,
|
|
113
|
+
data: rawInteraction,
|
|
114
|
+
defaults: {
|
|
115
|
+
ephemeral: typeof command.ephemeral === "function"
|
|
116
|
+
? false // Autocomplete interactions don't use ephemeral typically, but resolve for consistency
|
|
117
|
+
: command.ephemeral
|
|
118
|
+
},
|
|
119
|
+
processingCommand: command
|
|
120
|
+
});
|
|
121
|
+
try {
|
|
122
|
+
const command = this.getCommand(rawInteraction);
|
|
123
|
+
// Check if the focused option has its own autocomplete function
|
|
124
|
+
const focusedOption = interaction.options.getFocused();
|
|
125
|
+
if (focusedOption && command.options) {
|
|
126
|
+
const optionDefinition = command.options.find((opt) => opt.name === focusedOption.name);
|
|
127
|
+
if (optionDefinition &&
|
|
128
|
+
"autocomplete" in optionDefinition &&
|
|
129
|
+
typeof optionDefinition.autocomplete === "function") {
|
|
130
|
+
return await optionDefinition.autocomplete(interaction);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Fall back to command-level autocomplete
|
|
134
|
+
return await command.autocomplete(interaction);
|
|
135
|
+
}
|
|
136
|
+
catch (e) {
|
|
137
|
+
if (e instanceof Error)
|
|
138
|
+
console.error(e.message);
|
|
139
|
+
console.error(e);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=CommandHandler.js.map
|
|
@@ -0,0 +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;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;YACnE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;QAC3D,CAAC;QACD,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAA;QAChC,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAC1C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CACzC,CAAA;QACD,IAAI,CAAC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AAM,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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type APIApplicationCommandInteraction } from "discord-api-types/v10";
|
|
2
|
+
import { BaseInteraction, type InteractionDefaults } from "../abstracts/BaseInteraction.js";
|
|
3
|
+
import type { Client } from "../classes/Client.js";
|
|
4
|
+
import type { Command } from "../classes/Command.js";
|
|
5
|
+
import { Message } from "../structures/Message.js";
|
|
6
|
+
import { User } from "../structures/User.js";
|
|
7
|
+
import { OptionsHandler } from "./OptionsHandler.js";
|
|
8
|
+
/**
|
|
9
|
+
* Represents a command interaction
|
|
10
|
+
*/
|
|
11
|
+
export declare class CommandInteraction extends BaseInteraction<APIApplicationCommandInteraction> {
|
|
12
|
+
/**
|
|
13
|
+
* This is the options of the commands, parsed from the interaction data.
|
|
14
|
+
* It will not have any options in it if the command is not a ChatInput command.
|
|
15
|
+
*/
|
|
16
|
+
options: OptionsHandler;
|
|
17
|
+
constructor({ client, data, defaults, processingCommand }: {
|
|
18
|
+
client: Client;
|
|
19
|
+
data: APIApplicationCommandInteraction;
|
|
20
|
+
defaults: InteractionDefaults;
|
|
21
|
+
processingCommand?: Command;
|
|
22
|
+
});
|
|
23
|
+
get targetMessage(): Message<false> | null;
|
|
24
|
+
get targetUser(): User<false> | null;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=CommandInteraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,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;IAkBD,IAAI,aAAa,0BAiBhB;IAED,IAAI,UAAU,uBAiBb;CACD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ApplicationCommandType, InteractionType } from "discord-api-types/v10";
|
|
2
|
+
import { BaseInteraction } from "../abstracts/BaseInteraction.js";
|
|
3
|
+
import { Message } from "../structures/Message.js";
|
|
4
|
+
import { User } from "../structures/User.js";
|
|
5
|
+
import { OptionsHandler } from "./OptionsHandler.js";
|
|
6
|
+
/**
|
|
7
|
+
* Represents a command interaction
|
|
8
|
+
*/
|
|
9
|
+
export class CommandInteraction extends BaseInteraction {
|
|
10
|
+
/**
|
|
11
|
+
* This is the options of the commands, parsed from the interaction data.
|
|
12
|
+
* It will not have any options in it if the command is not a ChatInput command.
|
|
13
|
+
*/
|
|
14
|
+
options;
|
|
15
|
+
constructor({ client, data, defaults, processingCommand }) {
|
|
16
|
+
super(client, data, defaults);
|
|
17
|
+
if (data.type !== InteractionType.ApplicationCommand) {
|
|
18
|
+
throw new Error("Invalid interaction type was used to create this class");
|
|
19
|
+
}
|
|
20
|
+
this.options = new OptionsHandler({
|
|
21
|
+
client,
|
|
22
|
+
options: data.data.type === ApplicationCommandType.ChatInput
|
|
23
|
+
? (data.data.options ?? [])
|
|
24
|
+
: [],
|
|
25
|
+
interactionData: this.rawData
|
|
26
|
+
.data,
|
|
27
|
+
definitions: processingCommand?.options ?? [],
|
|
28
|
+
guildId: data.guild_id
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
get targetMessage() {
|
|
32
|
+
const interactionData = this.rawData.data;
|
|
33
|
+
if (interactionData.type !== ApplicationCommandType.Message ||
|
|
34
|
+
!("resolved" in interactionData)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const { target_id: targetId, resolved } = interactionData;
|
|
38
|
+
if (!resolved?.messages)
|
|
39
|
+
return null;
|
|
40
|
+
const rawMessage = targetId
|
|
41
|
+
? resolved.messages[targetId]
|
|
42
|
+
: Object.values(resolved.messages)[0];
|
|
43
|
+
return rawMessage ? new Message(this.client, rawMessage) : null;
|
|
44
|
+
}
|
|
45
|
+
get targetUser() {
|
|
46
|
+
const interactionData = this.rawData.data;
|
|
47
|
+
if (interactionData.type !== ApplicationCommandType.User ||
|
|
48
|
+
!("resolved" in interactionData)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const { target_id: targetId, resolved } = interactionData;
|
|
52
|
+
if (!resolved?.users)
|
|
53
|
+
return null;
|
|
54
|
+
const rawUser = targetId
|
|
55
|
+
? resolved.users[targetId]
|
|
56
|
+
: Object.values(resolved.users)[0];
|
|
57
|
+
return rawUser ? new User(this.client, rawUser) : null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=CommandInteraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandInte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
+
import { type APIMessageComponentInteraction, type APIMessageComponentInteractionData, type ComponentType } from "discord-api-types/v10";
|
|
2
|
+
import { Base } from "../abstracts/Base.js";
|
|
3
|
+
import type { BaseMessageInteractiveComponent } from "../abstracts/BaseMessageInteractiveComponent.js";
|
|
4
|
+
export declare class ComponentHandler extends Base {
|
|
5
|
+
private componentCache;
|
|
6
|
+
oneOffComponents: Map<`${string}-${string}`, {
|
|
7
|
+
resolve: (data: APIMessageComponentInteractionData) => void;
|
|
8
|
+
}>;
|
|
9
|
+
registerComponent(component: BaseMessageInteractiveComponent): void;
|
|
10
|
+
hasComponentWithKey(key: string): boolean;
|
|
11
|
+
findComponent(customId: string, componentType: ComponentType): BaseMessageInteractiveComponent | undefined;
|
|
12
|
+
handleInteraction(data: APIMessageComponentInteraction): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ComponentHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/ComponentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EAEvC,KAAK,aAAa,EAIlB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAA;AAetG,qBAAa,gBAAiB,SAAQ,IAAI;IACzC,OAAO,CAAC,cAAc,CAGd;IAER,gBAAgB,EAAE,GAAG,CACpB,GAAG,MAAM,IAAI,MAAM,EAAE,EACrB;QACC,OAAO,EAAE,CAAC,IAAI,EAAE,kCAAkC,KAAK,IAAI,CAAA;KAC3D,CACD,CAAY;IAEb,iBAAiB,CAAC,SAAS,EAAE,+BAA+B;IAM5D,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAUzC,aAAa,CACZ,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,aAAa,GAC1B,+BAA+B,GAAG,SAAS;IAmBxC,iBAAiB,CAAC,IAAI,EAAE,8BAA8B;CAiM5D"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { InteractionResponseType, Routes } from "discord-api-types/v10";
|
|
2
|
+
import { Base } from "../abstracts/Base.js";
|
|
3
|
+
import { Button } from "../classes/components/Button.js";
|
|
4
|
+
import { ChannelSelectMenu } from "../classes/components/ChannelSelectMenu.js";
|
|
5
|
+
import { MentionableSelectMenu } from "../classes/components/MentionableSelectMenu.js";
|
|
6
|
+
import { RoleSelectMenu } from "../classes/components/RoleSelectMenu.js";
|
|
7
|
+
import { StringSelectMenu } from "../classes/components/StringSelectMenu.js";
|
|
8
|
+
import { UserSelectMenu } from "../classes/components/UserSelectMenu.js";
|
|
9
|
+
import { LRUCache } from "../utils/LRUCache.js";
|
|
10
|
+
import { ButtonInteraction } from "./ButtonInteraction.js";
|
|
11
|
+
import { ChannelSelectMenuInteraction } from "./ChannelSelectMenuInteraction.js";
|
|
12
|
+
import { MentionableSelectMenuInteraction } from "./MentionableSelectMenuInteraction.js";
|
|
13
|
+
import { RoleSelectMenuInteraction } from "./RoleSelectMenuInteraction.js";
|
|
14
|
+
import { StringSelectMenuInteraction } from "./StringSelectMenuInteraction.js";
|
|
15
|
+
import { UserSelectMenuInteraction } from "./UserSelectMenuInteraction.js";
|
|
16
|
+
export class ComponentHandler extends Base {
|
|
17
|
+
componentCache = new LRUCache(10000);
|
|
18
|
+
oneOffComponents = new Map();
|
|
19
|
+
registerComponent(component) {
|
|
20
|
+
if (!this.componentCache.has(component.customId)) {
|
|
21
|
+
this.componentCache.set(component.customId, component);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
hasComponentWithKey(key) {
|
|
25
|
+
for (const component of this.componentCache.values()) {
|
|
26
|
+
const componentKey = component.customIdParser(component.customId).key;
|
|
27
|
+
if (componentKey === key) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
findComponent(customId, componentType) {
|
|
34
|
+
for (const component of this.componentCache.values()) {
|
|
35
|
+
const componentKey = component.customIdParser(component.customId).key;
|
|
36
|
+
const interactionKey = component.customIdParser(customId).key;
|
|
37
|
+
if (componentKey === interactionKey && component.type === componentType) {
|
|
38
|
+
return component;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const component of this.componentCache.values()) {
|
|
42
|
+
const componentKey = component.customIdParser(component.customId).key;
|
|
43
|
+
if (componentKey === "*" && component.type === componentType) {
|
|
44
|
+
return component;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
async handleInteraction(data) {
|
|
50
|
+
const oneOffComponent = this.oneOffComponents.get(`${data.message.id}-${data.message.channel_id}`);
|
|
51
|
+
if (oneOffComponent) {
|
|
52
|
+
oneOffComponent.resolve(data.data);
|
|
53
|
+
this.oneOffComponents.delete(`${data.message.id}-${data.message.channel_id}`);
|
|
54
|
+
await this.client.rest
|
|
55
|
+
.post(Routes.interactionCallback(data.id, data.token), {
|
|
56
|
+
body: {
|
|
57
|
+
type: InteractionResponseType.DeferredMessageUpdate
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.catch(() => {
|
|
61
|
+
console.warn(`Failed to acknowledge one-off component interaction for message ${data.message.id}`);
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const component = this.findComponent(data.data.custom_id, data.data.component_type);
|
|
66
|
+
if (!component) {
|
|
67
|
+
throw new Error(`Unknown component with type ${data.data.component_type} and custom ID ${data.data.custom_id} was received, did you forget to register the component? See https://carbon.buape.com/concepts/component-registration for more information.`);
|
|
68
|
+
}
|
|
69
|
+
const parsed = component.customIdParser(data.data.custom_id);
|
|
70
|
+
if (component instanceof Button) {
|
|
71
|
+
const interaction = new ButtonInteraction(this.client, data, {
|
|
72
|
+
ephemeral: typeof component.ephemeral === "function"
|
|
73
|
+
? false
|
|
74
|
+
: component.ephemeral
|
|
75
|
+
});
|
|
76
|
+
// Resolve ephemeral setting if it's a function
|
|
77
|
+
if (typeof component.ephemeral === "function") {
|
|
78
|
+
interaction.setDefaultEphemeral(component.ephemeral(interaction));
|
|
79
|
+
}
|
|
80
|
+
// Resolve defer setting if it's a function
|
|
81
|
+
const shouldDefer = typeof component.defer === "function"
|
|
82
|
+
? component.defer(interaction)
|
|
83
|
+
: component.defer;
|
|
84
|
+
if (shouldDefer)
|
|
85
|
+
await interaction.defer();
|
|
86
|
+
await component.run(interaction, parsed.data);
|
|
87
|
+
}
|
|
88
|
+
else if (component instanceof RoleSelectMenu) {
|
|
89
|
+
const interaction = new RoleSelectMenuInteraction(this.client, data, {
|
|
90
|
+
ephemeral: typeof component.ephemeral === "function"
|
|
91
|
+
? false
|
|
92
|
+
: component.ephemeral
|
|
93
|
+
});
|
|
94
|
+
// Resolve ephemeral setting if it's a function
|
|
95
|
+
if (typeof component.ephemeral === "function") {
|
|
96
|
+
interaction.setDefaultEphemeral(component.ephemeral(interaction));
|
|
97
|
+
}
|
|
98
|
+
// Resolve defer setting if it's a function
|
|
99
|
+
const shouldDefer = typeof component.defer === "function"
|
|
100
|
+
? component.defer(interaction)
|
|
101
|
+
: component.defer;
|
|
102
|
+
if (shouldDefer)
|
|
103
|
+
await interaction.defer();
|
|
104
|
+
await component.run(interaction, parsed.data);
|
|
105
|
+
}
|
|
106
|
+
else if (component instanceof ChannelSelectMenu) {
|
|
107
|
+
const interaction = new ChannelSelectMenuInteraction(this.client, data, {
|
|
108
|
+
ephemeral: typeof component.ephemeral === "function"
|
|
109
|
+
? false
|
|
110
|
+
: component.ephemeral
|
|
111
|
+
});
|
|
112
|
+
// Resolve ephemeral setting if it's a function
|
|
113
|
+
if (typeof component.ephemeral === "function") {
|
|
114
|
+
interaction.setDefaultEphemeral(component.ephemeral(interaction));
|
|
115
|
+
}
|
|
116
|
+
// Resolve defer setting if it's a function
|
|
117
|
+
const shouldDefer = typeof component.defer === "function"
|
|
118
|
+
? component.defer(interaction)
|
|
119
|
+
: component.defer;
|
|
120
|
+
if (shouldDefer)
|
|
121
|
+
await interaction.defer();
|
|
122
|
+
await component.run(interaction, parsed.data);
|
|
123
|
+
}
|
|
124
|
+
else if (component instanceof MentionableSelectMenu) {
|
|
125
|
+
const interaction = new MentionableSelectMenuInteraction(this.client, data, {
|
|
126
|
+
ephemeral: typeof component.ephemeral === "function"
|
|
127
|
+
? false
|
|
128
|
+
: component.ephemeral
|
|
129
|
+
});
|
|
130
|
+
// Resolve ephemeral setting if it's a function
|
|
131
|
+
if (typeof component.ephemeral === "function") {
|
|
132
|
+
interaction.setDefaultEphemeral(component.ephemeral(interaction));
|
|
133
|
+
}
|
|
134
|
+
// Resolve defer setting if it's a function
|
|
135
|
+
const shouldDefer = typeof component.defer === "function"
|
|
136
|
+
? component.defer(interaction)
|
|
137
|
+
: component.defer;
|
|
138
|
+
if (shouldDefer)
|
|
139
|
+
await interaction.defer();
|
|
140
|
+
await component.run(interaction, parsed.data);
|
|
141
|
+
}
|
|
142
|
+
else if (component instanceof StringSelectMenu) {
|
|
143
|
+
const interaction = new StringSelectMenuInteraction(this.client, data, {
|
|
144
|
+
ephemeral: typeof component.ephemeral === "function"
|
|
145
|
+
? false
|
|
146
|
+
: component.ephemeral
|
|
147
|
+
});
|
|
148
|
+
// Resolve ephemeral setting if it's a function
|
|
149
|
+
if (typeof component.ephemeral === "function") {
|
|
150
|
+
interaction.setDefaultEphemeral(component.ephemeral(interaction));
|
|
151
|
+
}
|
|
152
|
+
// Resolve defer setting if it's a function
|
|
153
|
+
const shouldDefer = typeof component.defer === "function"
|
|
154
|
+
? component.defer(interaction)
|
|
155
|
+
: component.defer;
|
|
156
|
+
if (shouldDefer)
|
|
157
|
+
await interaction.defer();
|
|
158
|
+
await component.run(interaction, parsed.data);
|
|
159
|
+
}
|
|
160
|
+
else if (component instanceof UserSelectMenu) {
|
|
161
|
+
const interaction = new UserSelectMenuInteraction(this.client, data, {
|
|
162
|
+
ephemeral: typeof component.ephemeral === "function"
|
|
163
|
+
? false
|
|
164
|
+
: component.ephemeral
|
|
165
|
+
});
|
|
166
|
+
// Resolve ephemeral setting if it's a function
|
|
167
|
+
if (typeof component.ephemeral === "function") {
|
|
168
|
+
interaction.setDefaultEphemeral(component.ephemeral(interaction));
|
|
169
|
+
}
|
|
170
|
+
// Resolve defer setting if it's a function
|
|
171
|
+
const shouldDefer = typeof component.defer === "function"
|
|
172
|
+
? component.defer(interaction)
|
|
173
|
+
: component.defer;
|
|
174
|
+
if (shouldDefer)
|
|
175
|
+
await interaction.defer();
|
|
176
|
+
await component.run(interaction, parsed.data);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
throw new Error(`Unknown component with type ${data.data.component_type} and custom ID ${data.data.custom_id}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=ComponentHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentHandler.js","sourceRoot":"","sources":["../../../src/internals/ComponentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,uBAAuB,EAEvB,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAA;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/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AAS,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QAC9C,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACd,+BAA+B,IAAI,CAAC,IAAI,CAAC,cAAc,kBAAkB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAC9F,CAAA;QACF,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Base } from "../abstracts/Base.js";
|
|
2
|
+
import { ApplicationEmoji } from "../structures/Emoji.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class is specifically used for application emojis that you manage from the Discord Developer Portal
|
|
5
|
+
*/
|
|
6
|
+
export declare class EmojiHandler extends Base {
|
|
7
|
+
list(): Promise<ApplicationEmoji[]>;
|
|
8
|
+
get(id: string): Promise<ApplicationEmoji>;
|
|
9
|
+
getByName(name: string): Promise<ApplicationEmoji | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Upload a new emoji to the application
|
|
12
|
+
* @param name The name of the emoji
|
|
13
|
+
* @param image The image of the emoji in base64 format
|
|
14
|
+
* @returns The created ApplicationEmoji
|
|
15
|
+
*/
|
|
16
|
+
create(name: string, image: string): Promise<ApplicationEmoji>;
|
|
17
|
+
delete(id: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=EmojiHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/EmojiHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD;;GAEG;AACH,qBAAa,YAAa,SAAQ,IAAI;IACxB,IAAI;IAUJ,GAAG,CAAC,EAAE,EAAE,MAAM;IAWd,SAAS,CAAC,IAAI,EAAE,MAAM;IAKnC;;;;;OAKG;IACU,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAYlC,MAAM,CAAC,EAAE,EAAE,MAAM;CAK9B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Routes } from "discord-api-types/v10";
|
|
2
|
+
import { Base } from "../abstracts/Base.js";
|
|
3
|
+
import { ApplicationEmoji } from "../structures/Emoji.js";
|
|
4
|
+
/**
|
|
5
|
+
* This class is specifically used for application emojis that you manage from the Discord Developer Portal
|
|
6
|
+
*/
|
|
7
|
+
export class EmojiHandler extends Base {
|
|
8
|
+
async list() {
|
|
9
|
+
const emojis = (await this.client.rest.get(Routes.applicationEmojis(this.client.options.clientId)));
|
|
10
|
+
return emojis.items.map((emoji) => new ApplicationEmoji(this.client, emoji, this.client.options.clientId));
|
|
11
|
+
}
|
|
12
|
+
async get(id) {
|
|
13
|
+
const emoji = (await this.client.rest.get(Routes.applicationEmoji(this.client.options.clientId, id)));
|
|
14
|
+
return new ApplicationEmoji(this.client, emoji, this.client.options.clientId);
|
|
15
|
+
}
|
|
16
|
+
async getByName(name) {
|
|
17
|
+
const emojis = await this.list();
|
|
18
|
+
return emojis.find((emoji) => emoji.name === name);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Upload a new emoji to the application
|
|
22
|
+
* @param name The name of the emoji
|
|
23
|
+
* @param image The image of the emoji in base64 format
|
|
24
|
+
* @returns The created ApplicationEmoji
|
|
25
|
+
*/
|
|
26
|
+
async create(name, image) {
|
|
27
|
+
const emoji = (await this.client.rest.post(Routes.applicationEmojis(this.client.options.clientId), { body: { name, image } }));
|
|
28
|
+
return new ApplicationEmoji(this.client, emoji, this.client.options.clientId);
|
|
29
|
+
}
|
|
30
|
+
async delete(id) {
|
|
31
|
+
await this.client.rest.delete(Routes.applicationEmoji(this.client.options.clientId, id));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=EmojiHandler.js.map
|
|
@@ -0,0 +1 @@
|
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KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;IACnD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,KAAa;QAC9C,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CACzC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EACtD,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CACzB,CAAwB,CAAA;QACzB,OAAO,IAAI,gBAAgB,CAC1B,IAAI,CAAC,MAAM,EACX,KAAK,EACL,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAC5B,CAAA;IACF,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,EAAU;QAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAC5B,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CACzD,CAAA;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Base } from "../abstracts/Base.js";
|
|
2
|
+
import type { ListenerEventAdditionalData, ListenerEventRawData } from "../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Handles Discord gateway events and dispatches them to registered listeners.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class EventHandler extends Base {
|
|
8
|
+
private eventQueue;
|
|
9
|
+
constructor(client: typeof Base.prototype.client);
|
|
10
|
+
handleEvent<T extends keyof ListenerEventRawData>(payload: ListenerEventRawData[T] & ListenerEventAdditionalData, type: T): boolean;
|
|
11
|
+
getMetrics(): {
|
|
12
|
+
queueSize: number;
|
|
13
|
+
processing: number;
|
|
14
|
+
processed: number;
|
|
15
|
+
dropped: number;
|
|
16
|
+
timeouts: number;
|
|
17
|
+
maxQueueSize: number;
|
|
18
|
+
maxConcurrency: number;
|
|
19
|
+
};
|
|
20
|
+
hasCapacity(): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=EventHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/EventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EACX,2BAA2B,EAC3B,oBAAoB,EACpB,MAAM,mBAAmB,CAAA;AAG1B;;;GAGG;AACH,qBAAa,YAAa,SAAQ,IAAI;IACrC,OAAO,CAAC,UAAU,CAAY;gBAElB,MAAM,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM;IAKhD,WAAW,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAC/C,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,2BAA2B,EAC9D,IAAI,EAAE,CAAC,GACL,OAAO;IAIV,UAAU;;;;;;;;;IAIV,WAAW,IAAI,OAAO;CAGtB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Base } from "../abstracts/Base.js";
|
|
2
|
+
import { EventQueue } from "./EventQueue.js";
|
|
3
|
+
/**
|
|
4
|
+
* Handles Discord gateway events and dispatches them to registered listeners.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export class EventHandler extends Base {
|
|
8
|
+
eventQueue;
|
|
9
|
+
constructor(client) {
|
|
10
|
+
super(client);
|
|
11
|
+
this.eventQueue = new EventQueue(client, client.options.eventQueue);
|
|
12
|
+
}
|
|
13
|
+
handleEvent(payload, type) {
|
|
14
|
+
return this.eventQueue.enqueue(payload, type);
|
|
15
|
+
}
|
|
16
|
+
getMetrics() {
|
|
17
|
+
return this.eventQueue.getMetrics();
|
|
18
|
+
}
|
|
19
|
+
hasCapacity() {
|
|
20
|
+
return this.eventQueue.hasCapacity();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=EventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventHandler.js","sourceRoot":"","sources":["../../../src/internals/EventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAK3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,IAAI;IAC7B,UAAU,CAAY;IAE9B,YAAY,MAAoC;QAC/C,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACpE,CAAC;IAED,WAAW,CACV,OAA8D,EAC9D,IAAO;QAEP,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC9C,CAAC;IAED,UAAU;QACT,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAA;IACpC,CAAC;IAED,WAAW;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA;IACrC,CAAC;CACD"}
|