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,151 @@
|
|
|
1
|
+
import type { Context, Route } from "../../abstracts/Plugin.js";
|
|
2
|
+
import { Client, type ClientOptions } from "../../classes/Client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Credentials for a single application in the ClientManager
|
|
5
|
+
*/
|
|
6
|
+
export interface ApplicationCredentials {
|
|
7
|
+
/**
|
|
8
|
+
* The client ID of the application - must be a valid Discord snowflake
|
|
9
|
+
*/
|
|
10
|
+
clientId: string;
|
|
11
|
+
/**
|
|
12
|
+
* The public key of the app, used for interaction verification
|
|
13
|
+
* Can be a single key or an array of keys
|
|
14
|
+
*/
|
|
15
|
+
publicKey: string | string[];
|
|
16
|
+
/**
|
|
17
|
+
* The token of the bot
|
|
18
|
+
*/
|
|
19
|
+
token: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ClientSetupOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Whether to recreate the client if it already exists
|
|
24
|
+
*/
|
|
25
|
+
recreate?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to set the interactions URL on the Discord Developer Portal
|
|
28
|
+
*/
|
|
29
|
+
setInteractionsUrlOnDevPortal?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to set the events URL on the Discord Developer Portal
|
|
32
|
+
*/
|
|
33
|
+
setEventsUrlOnDevPortal?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Options for the ClientManager
|
|
37
|
+
*/
|
|
38
|
+
export interface ClientManagerOptions {
|
|
39
|
+
/**
|
|
40
|
+
* The base URL of the applications to mount the proxy at
|
|
41
|
+
*/
|
|
42
|
+
baseUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* The deploy secret of the applications
|
|
45
|
+
*/
|
|
46
|
+
deploySecret: string;
|
|
47
|
+
/**
|
|
48
|
+
* Shared options that apply to all applications
|
|
49
|
+
*/
|
|
50
|
+
sharedOptions: Omit<ClientOptions, "baseUrl" | "deploySecret" | "clientId" | "publicKey" | "token">;
|
|
51
|
+
/**
|
|
52
|
+
* Array of application credentials.
|
|
53
|
+
* If you need dynamic application loading (e.g., from a database),
|
|
54
|
+
* extend ClientManager and override getClient/getAllClients/getClientIds instead.
|
|
55
|
+
*/
|
|
56
|
+
applications?: ApplicationCredentials[];
|
|
57
|
+
/**
|
|
58
|
+
* The initial setup options for the clients, this will be passed to clientManager#setupClient
|
|
59
|
+
*/
|
|
60
|
+
initialSetupOptions?: ClientSetupOptions;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Manages multiple Discord applications, routing requests to the appropriate client
|
|
64
|
+
* based on the client ID in the URL path (/:clientId/*)
|
|
65
|
+
*
|
|
66
|
+
* To use with a database, extend this class and override:
|
|
67
|
+
* - getClient(clientId) - Return the client for a specific ID (or create it)
|
|
68
|
+
* - getAllClients() - Return all available clients
|
|
69
|
+
* - getClientIds() - Return all available client IDs
|
|
70
|
+
*
|
|
71
|
+
* Then call setupClient(credentials) to create clients on-demand.
|
|
72
|
+
*/
|
|
73
|
+
export declare class ClientManager {
|
|
74
|
+
/**
|
|
75
|
+
* The routes that the application manager will handle
|
|
76
|
+
*/
|
|
77
|
+
routes: Route[];
|
|
78
|
+
/**
|
|
79
|
+
* The shared deploy secret used for all applications
|
|
80
|
+
*/
|
|
81
|
+
protected deploySecret?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The base URL of the applications to mount the proxy at
|
|
84
|
+
*/
|
|
85
|
+
protected baseUrl: string;
|
|
86
|
+
/**
|
|
87
|
+
* Shared options that apply to all applications
|
|
88
|
+
* Protected to allow subclasses to use it when creating clients
|
|
89
|
+
*/
|
|
90
|
+
protected sharedOptions: Omit<ClientOptions, "baseUrl" | "deploySecret" | "clientId" | "publicKey" | "token">;
|
|
91
|
+
protected clients: Map<string, Client>;
|
|
92
|
+
protected staticApplications: ApplicationCredentials[];
|
|
93
|
+
protected initialHandlers: ConstructorParameters<typeof Client>[1];
|
|
94
|
+
protected initialPlugins: ConstructorParameters<typeof Client>[2];
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new ClientManager
|
|
97
|
+
* @param options Configuration options including shared settings and per-app credentials
|
|
98
|
+
*/
|
|
99
|
+
constructor(options: ClientManagerOptions, handlers: ConstructorParameters<typeof Client>[1], plugins: ConstructorParameters<typeof Client>[2]);
|
|
100
|
+
/**
|
|
101
|
+
* Setup a client from credentials.
|
|
102
|
+
*
|
|
103
|
+
* @param credentials The application credentials
|
|
104
|
+
* @param options The setup options for the client
|
|
105
|
+
* @returns A configured Client instance
|
|
106
|
+
*/
|
|
107
|
+
setupClient(credentials: ApplicationCredentials, options?: ClientSetupOptions): Promise<Client>;
|
|
108
|
+
/**
|
|
109
|
+
* Set up the routing for the application manager
|
|
110
|
+
*/
|
|
111
|
+
protected setupRoutes(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Deploy all applications
|
|
114
|
+
*/
|
|
115
|
+
protected handleGlobalDeploy(req: Request): Promise<Response>;
|
|
116
|
+
/**
|
|
117
|
+
* Handle a request and route it to the appropriate client
|
|
118
|
+
* @param req The incoming request
|
|
119
|
+
* @param ctx Optional context (for Cloudflare Workers, etc.)
|
|
120
|
+
*/
|
|
121
|
+
handleRequest(req: Request, ctx?: Context): Promise<Response>;
|
|
122
|
+
protected handleProxyRequest(req: Request, ctx?: Context): Promise<Response>;
|
|
123
|
+
/**
|
|
124
|
+
* Get a client by its client ID
|
|
125
|
+
* @param clientId The client ID to look up
|
|
126
|
+
*/
|
|
127
|
+
getClient(clientId: string): Client | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Get all clients that the manager is managing
|
|
130
|
+
*/
|
|
131
|
+
getClients(): Client[];
|
|
132
|
+
/**
|
|
133
|
+
* Get all client IDs that the manager is managing
|
|
134
|
+
*/
|
|
135
|
+
getClientIds(): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Get all applications
|
|
138
|
+
* You can override this in an extended class to return dynamic applications
|
|
139
|
+
*/
|
|
140
|
+
getApplications(): Promise<ApplicationCredentials[]>;
|
|
141
|
+
/**
|
|
142
|
+
* Get an application by its client ID
|
|
143
|
+
* You can override this in an extended class to return dynamic applications
|
|
144
|
+
*/
|
|
145
|
+
getApplication(clientId: string): Promise<ApplicationCredentials | undefined>;
|
|
146
|
+
/**
|
|
147
|
+
* Validate if a string is a valid Discord snowflake
|
|
148
|
+
*/
|
|
149
|
+
protected isValidClientId(id: string): boolean;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=ClientManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientManager.d.ts","sourceRoot":"","sources":["../../../../src/plugins/client-manager/ClientManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,aAAa,EAAE,IAAI,CAClB,aAAa,EACb,SAAS,GAAG,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAC/D,CAAA;IACD;;;;OAIG;IACH,YAAY,CAAC,EAAE,sBAAsB,EAAE,CAAA;IACvC;;OAEG;IACH,mBAAmB,CAAC,EAAE,kBAAkB,CAAA;CACxC;AA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OAAO,GACX,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI/C;;OAEG;IACH,UAAU,IAAI,MAAM,EAAE;IAItB;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;IAIxB;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAI1D;;;OAGG;IACG,cAAc,CACnB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAI9C;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;CAG9C"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { Routes } from "discord-api-types/v10";
|
|
2
|
+
import { Client } from "../../classes/Client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Manages multiple Discord applications, routing requests to the appropriate client
|
|
5
|
+
* based on the client ID in the URL path (/:clientId/*)
|
|
6
|
+
*
|
|
7
|
+
* To use with a database, extend this class and override:
|
|
8
|
+
* - getClient(clientId) - Return the client for a specific ID (or create it)
|
|
9
|
+
* - getAllClients() - Return all available clients
|
|
10
|
+
* - getClientIds() - Return all available client IDs
|
|
11
|
+
*
|
|
12
|
+
* Then call setupClient(credentials) to create clients on-demand.
|
|
13
|
+
*/
|
|
14
|
+
export class ClientManager {
|
|
15
|
+
/**
|
|
16
|
+
* The routes that the application manager will handle
|
|
17
|
+
*/
|
|
18
|
+
routes = [];
|
|
19
|
+
/**
|
|
20
|
+
* The shared deploy secret used for all applications
|
|
21
|
+
*/
|
|
22
|
+
deploySecret;
|
|
23
|
+
/**
|
|
24
|
+
* The base URL of the applications to mount the proxy at
|
|
25
|
+
*/
|
|
26
|
+
baseUrl;
|
|
27
|
+
/**
|
|
28
|
+
* Shared options that apply to all applications
|
|
29
|
+
* Protected to allow subclasses to use it when creating clients
|
|
30
|
+
*/
|
|
31
|
+
sharedOptions;
|
|
32
|
+
clients = new Map();
|
|
33
|
+
staticApplications;
|
|
34
|
+
initialHandlers;
|
|
35
|
+
initialPlugins;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new ClientManager
|
|
38
|
+
* @param options Configuration options including shared settings and per-app credentials
|
|
39
|
+
*/
|
|
40
|
+
constructor(options, handlers, plugins) {
|
|
41
|
+
this.sharedOptions = options.sharedOptions;
|
|
42
|
+
this.deploySecret = options.deploySecret;
|
|
43
|
+
this.baseUrl = options.baseUrl;
|
|
44
|
+
this.staticApplications = options.applications ?? [];
|
|
45
|
+
this.initialHandlers = handlers;
|
|
46
|
+
this.initialPlugins = plugins;
|
|
47
|
+
this.setupRoutes();
|
|
48
|
+
this.getApplications().then(async (applications) => {
|
|
49
|
+
applications.map(async (application) => {
|
|
50
|
+
this.setupClient({
|
|
51
|
+
clientId: application.clientId,
|
|
52
|
+
publicKey: application.publicKey,
|
|
53
|
+
token: application.token
|
|
54
|
+
}, options.initialSetupOptions);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Setup a client from credentials.
|
|
60
|
+
*
|
|
61
|
+
* @param credentials The application credentials
|
|
62
|
+
* @param options The setup options for the client
|
|
63
|
+
* @returns A configured Client instance
|
|
64
|
+
*/
|
|
65
|
+
async setupClient(credentials, options = {
|
|
66
|
+
recreate: false,
|
|
67
|
+
setInteractionsUrlOnDevPortal: false,
|
|
68
|
+
setEventsUrlOnDevPortal: false
|
|
69
|
+
}) {
|
|
70
|
+
const existing = this.getClient(credentials.clientId);
|
|
71
|
+
if (existing && !options.recreate) {
|
|
72
|
+
throw new Error(`Client ${credentials.clientId} already exists. If you want to recreate it, pass true to the recreate parameter.`);
|
|
73
|
+
}
|
|
74
|
+
if (existing && options.recreate) {
|
|
75
|
+
this.clients.delete(credentials.clientId);
|
|
76
|
+
}
|
|
77
|
+
if (!this.isValidClientId(credentials.clientId)) {
|
|
78
|
+
throw new Error(`Invalid client ID: ${credentials.clientId}. Client ID must be a valid Discord snowflake (17-19 digits).`);
|
|
79
|
+
}
|
|
80
|
+
const clientOptions = {
|
|
81
|
+
...this.sharedOptions,
|
|
82
|
+
baseUrl: `${this.baseUrl}/${credentials.clientId}`,
|
|
83
|
+
deploySecret: this.deploySecret,
|
|
84
|
+
clientId: credentials.clientId,
|
|
85
|
+
publicKey: credentials.publicKey,
|
|
86
|
+
token: credentials.token
|
|
87
|
+
};
|
|
88
|
+
const client = new Client(clientOptions, this.initialHandlers, this.initialPlugins);
|
|
89
|
+
this.clients.set(credentials.clientId, client);
|
|
90
|
+
if (options.setInteractionsUrlOnDevPortal ||
|
|
91
|
+
options.setEventsUrlOnDevPortal) {
|
|
92
|
+
await client.rest.patch(Routes.currentApplication(), {
|
|
93
|
+
body: {
|
|
94
|
+
interactions_endpoint_url: options.setInteractionsUrlOnDevPortal
|
|
95
|
+
? `${this.baseUrl}/${credentials.clientId}/interactions`
|
|
96
|
+
: undefined,
|
|
97
|
+
event_webhooks_url: options.setEventsUrlOnDevPortal
|
|
98
|
+
? `${this.baseUrl}/${credentials.clientId}/events`
|
|
99
|
+
: undefined
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return client;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Set up the routing for the application manager
|
|
107
|
+
*/
|
|
108
|
+
setupRoutes() {
|
|
109
|
+
this.routes.push({
|
|
110
|
+
method: "GET",
|
|
111
|
+
path: "/deploy",
|
|
112
|
+
handler: this.handleGlobalDeploy.bind(this),
|
|
113
|
+
protected: true,
|
|
114
|
+
disabled: !this.deploySecret
|
|
115
|
+
});
|
|
116
|
+
this.routes.push({
|
|
117
|
+
method: "POST",
|
|
118
|
+
path: "/:clientId/*",
|
|
119
|
+
handler: this.handleProxyRequest.bind(this)
|
|
120
|
+
});
|
|
121
|
+
this.routes.push({
|
|
122
|
+
method: "GET",
|
|
123
|
+
path: "/:clientId/*",
|
|
124
|
+
handler: this.handleProxyRequest.bind(this)
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Deploy all applications
|
|
129
|
+
*/
|
|
130
|
+
async handleGlobalDeploy(req) {
|
|
131
|
+
if (this.deploySecret) {
|
|
132
|
+
const url = new URL(req.url);
|
|
133
|
+
const secret = url.searchParams.get("secret");
|
|
134
|
+
if (secret !== this.deploySecret) {
|
|
135
|
+
await req.text().catch(() => { });
|
|
136
|
+
return new Response("Unauthorized", { status: 401 });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const results = [];
|
|
140
|
+
const clientIds = this.getClientIds();
|
|
141
|
+
for (const clientId of clientIds) {
|
|
142
|
+
const client = this.getClient(clientId);
|
|
143
|
+
if (!client)
|
|
144
|
+
continue;
|
|
145
|
+
try {
|
|
146
|
+
await client.handleDeployRequest();
|
|
147
|
+
results.push({ clientId, status: "success" });
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
results.push({
|
|
151
|
+
clientId,
|
|
152
|
+
status: `error: ${error instanceof Error ? error.message : String(error)}`
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return Response.json(results, { status: 200 });
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Handle a request and route it to the appropriate client
|
|
160
|
+
* @param req The incoming request
|
|
161
|
+
* @param ctx Optional context (for Cloudflare Workers, etc.)
|
|
162
|
+
*/
|
|
163
|
+
async handleRequest(req, ctx) {
|
|
164
|
+
const url = new URL(req.url);
|
|
165
|
+
const baseUrl = new URL(this.baseUrl);
|
|
166
|
+
const basePathname = baseUrl.pathname.replace(/\/$/, "");
|
|
167
|
+
const reqPathname = url.pathname.replace(/\/$/, "");
|
|
168
|
+
if (!reqPathname.startsWith(basePathname)) {
|
|
169
|
+
await req.text().catch(() => { });
|
|
170
|
+
return new Response("Not Found: Invalid base URL", { status: 404 });
|
|
171
|
+
}
|
|
172
|
+
const truePathname = reqPathname.slice(basePathname.length);
|
|
173
|
+
if (truePathname === "/deploy" && req.method === "GET") {
|
|
174
|
+
return this.handleGlobalDeploy(req);
|
|
175
|
+
}
|
|
176
|
+
const pathParts = truePathname.split("/").filter(Boolean);
|
|
177
|
+
if (pathParts.length < 2) {
|
|
178
|
+
await req.text().catch(() => { });
|
|
179
|
+
return new Response("Bad Request: Invalid path format", { status: 400 });
|
|
180
|
+
}
|
|
181
|
+
const clientId = pathParts[0];
|
|
182
|
+
if (!clientId) {
|
|
183
|
+
await req.text().catch(() => { });
|
|
184
|
+
return new Response("Bad Request: Missing client ID", { status: 400 });
|
|
185
|
+
}
|
|
186
|
+
const client = this.getClient(clientId);
|
|
187
|
+
if (!client) {
|
|
188
|
+
await req.text().catch(() => { });
|
|
189
|
+
return new Response(`Not Found: No application with client ID ${clientId}`, {
|
|
190
|
+
status: 404
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const remainingPath = `/${pathParts.slice(1).join("/")}`;
|
|
194
|
+
const route = client.routes.find((r) => r.path === remainingPath && r.method === req.method && !r.disabled);
|
|
195
|
+
if (!route) {
|
|
196
|
+
await req.text().catch(() => { });
|
|
197
|
+
return new Response(`Not Found: No route ${req.method} ${remainingPath}`, {
|
|
198
|
+
status: 404
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (route.protected) {
|
|
202
|
+
const secret = url.searchParams.get("secret");
|
|
203
|
+
if (secret !== client.options.deploySecret) {
|
|
204
|
+
await req.text().catch(() => { });
|
|
205
|
+
return new Response("Unauthorized", { status: 401 });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return route.handler(req, ctx);
|
|
209
|
+
}
|
|
210
|
+
async handleProxyRequest(req, ctx) {
|
|
211
|
+
return this.handleRequest(req, ctx);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get a client by its client ID
|
|
215
|
+
* @param clientId The client ID to look up
|
|
216
|
+
*/
|
|
217
|
+
getClient(clientId) {
|
|
218
|
+
return this.clients.get(clientId);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get all clients that the manager is managing
|
|
222
|
+
*/
|
|
223
|
+
getClients() {
|
|
224
|
+
return Array.from(this.clients.values());
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get all client IDs that the manager is managing
|
|
228
|
+
*/
|
|
229
|
+
getClientIds() {
|
|
230
|
+
return Array.from(this.clients.keys());
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Get all applications
|
|
234
|
+
* You can override this in an extended class to return dynamic applications
|
|
235
|
+
*/
|
|
236
|
+
async getApplications() {
|
|
237
|
+
return this.staticApplications;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get an application by its client ID
|
|
241
|
+
* You can override this in an extended class to return dynamic applications
|
|
242
|
+
*/
|
|
243
|
+
async getApplication(clientId) {
|
|
244
|
+
return this.staticApplications.find((app) => app.clientId === clientId);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Validate if a string is a valid Discord snowflake
|
|
248
|
+
*/
|
|
249
|
+
isValidClientId(id) {
|
|
250
|
+
return /^\d{17,19}$/.test(id);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=ClientManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientManager.js","sourceRoot":"","sources":["../../../../src/plugins/client-manager/ClientManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAsB,MAAM,yBAAyB,CAAA;AAmEpE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAa;IACzB;;OAEG;IACH,MAAM,GAAY,EAAE,CAAA;IAEpB;;OAEG;IACO,YAAY,CAAS;IAE/B;;OAEG;IACO,OAAO,CAAQ;IAEzB;;;OAGG;IACO,aAAa,CAGtB;IAES,OAAO,GAAwB,IAA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,GAAG,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,QAAgB;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,UAAU;QACT,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACzC,CAAC;IAED;;OAEG;IACH,YAAY;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IACvC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,eAAe;QACpB,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAC/B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc,CACnB,QAAgB;QAEhB,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAA;IACxE,CAAC;IAED;;OAEG;IACO,eAAe,CAAC,EAAU;QACnC,OAAO,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/client-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/client-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from "../../abstracts/Plugin.js";
|
|
2
|
+
import type { Client } from "../../classes/Client.js";
|
|
3
|
+
/**
|
|
4
|
+
* This plugin is a basic plugin that allows you to get the command data from the client over HTTP.
|
|
5
|
+
* The JSON array provided here is the same as the one you would send to Discord, allowing you to build your own command deployment setup.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CommandDataPlugin extends Plugin {
|
|
8
|
+
readonly id = "command-data";
|
|
9
|
+
client?: Client;
|
|
10
|
+
registerClient(client: Client): void;
|
|
11
|
+
registerRoutes(client: Client): void;
|
|
12
|
+
private discordCommandData;
|
|
13
|
+
handleFullCommandDataRequest(): Promise<Response>;
|
|
14
|
+
handleCommandDataRequest(): Promise<Response>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=CommandDataPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandDataPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/command-data/CommandDataPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAErD;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,MAAM;IAC5C,QAAQ,CAAC,EAAE,kBAAiB;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IAER,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpC,cAAc,CAAC,MAAM,EAAE,MAAM;IAepC,OAAO,CAAC,kBAAkB,CAAuC;IACpD,4BAA4B;IAW5B,wBAAwB;CAQrC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Routes } from "discord-api-types/v10";
|
|
2
|
+
import { Plugin } from "../../abstracts/Plugin.js";
|
|
3
|
+
/**
|
|
4
|
+
* This plugin is a basic plugin that allows you to get the command data from the client over HTTP.
|
|
5
|
+
* The JSON array provided here is the same as the one you would send to Discord, allowing you to build your own command deployment setup.
|
|
6
|
+
*/
|
|
7
|
+
export class CommandDataPlugin extends Plugin {
|
|
8
|
+
id = "command-data";
|
|
9
|
+
client;
|
|
10
|
+
registerClient(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
registerRoutes(client) {
|
|
14
|
+
client.routes.push({
|
|
15
|
+
method: "GET",
|
|
16
|
+
path: "/commands",
|
|
17
|
+
handler: this.handleCommandDataRequest.bind(this)
|
|
18
|
+
}, {
|
|
19
|
+
method: "GET",
|
|
20
|
+
path: "/commands/full",
|
|
21
|
+
handler: this.handleFullCommandDataRequest.bind(this)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
discordCommandData = null;
|
|
25
|
+
async handleFullCommandDataRequest() {
|
|
26
|
+
if (!this.client)
|
|
27
|
+
return new Response("Client not registered", { status: 500 });
|
|
28
|
+
if (this.discordCommandData)
|
|
29
|
+
return Response.json(this.discordCommandData);
|
|
30
|
+
const commands = (await this.client.rest.get(Routes.applicationCommands(this.client.options.clientId)));
|
|
31
|
+
this.discordCommandData = commands;
|
|
32
|
+
return Response.json(commands);
|
|
33
|
+
}
|
|
34
|
+
async handleCommandDataRequest() {
|
|
35
|
+
if (!this.client)
|
|
36
|
+
return new Response("Client not registered", { status: 500 });
|
|
37
|
+
const commands = this.client?.commands
|
|
38
|
+
.filter((c) => c.name !== "*")
|
|
39
|
+
.map((c) => c.serialize());
|
|
40
|
+
return Response.json(commands);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=CommandDataPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandDataPlugin.js","sourceRoot":"","sources":["../../../../src/plugins/command-data/CommandDataPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAGlD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IACnC,EAAE,GAAG,cAAc,CAAA;IAC5B,MAAM,CAAS;IAER,cAAc,CAAC,MAAc;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAA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7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;QAC3B,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/command-data/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/command-data/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface GuildCacheEntry {
|
|
2
|
+
available: boolean;
|
|
3
|
+
lastEvent: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class BabyCache {
|
|
6
|
+
guildCache: Map<string, GuildCacheEntry>;
|
|
7
|
+
private readonly maxGuilds;
|
|
8
|
+
private readonly ttl;
|
|
9
|
+
constructor(maxGuilds?: number, ttl?: number);
|
|
10
|
+
setGuild(guildId: string, entry: GuildCacheEntry): void;
|
|
11
|
+
getGuild(guildId: string): GuildCacheEntry | undefined;
|
|
12
|
+
removeGuild(guildId: string): boolean;
|
|
13
|
+
cleanup(): number;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=BabyCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BabyCache.d.ts","sourceRoot":"","sources":["../../../../src/plugins/gateway/BabyCache.ts"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,qBAAa,SAAS;IACrB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAY;IACpD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;gBAEhB,SAAS,SAAO,EAAE,GAAG,SAAW;IAK5C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAuBhD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAatD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIrC,OAAO,IAAI,MAAM;CAajB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// I called this the BabyCache because eventually, one way, carbon will have a more
|
|
2
|
+
// proper caching setup. For now, this is the toddler of that cache.
|
|
3
|
+
export class BabyCache {
|
|
4
|
+
guildCache = new Map();
|
|
5
|
+
maxGuilds;
|
|
6
|
+
ttl;
|
|
7
|
+
constructor(maxGuilds = 5000, ttl = 86400000) {
|
|
8
|
+
this.maxGuilds = maxGuilds;
|
|
9
|
+
this.ttl = ttl;
|
|
10
|
+
}
|
|
11
|
+
setGuild(guildId, entry) {
|
|
12
|
+
if (this.guildCache.size >= this.maxGuilds &&
|
|
13
|
+
!this.guildCache.has(guildId)) {
|
|
14
|
+
let oldestId = null;
|
|
15
|
+
let oldestTime = Number.POSITIVE_INFINITY;
|
|
16
|
+
for (const [id, guild] of this.guildCache.entries()) {
|
|
17
|
+
if (guild.lastEvent < oldestTime) {
|
|
18
|
+
oldestTime = guild.lastEvent;
|
|
19
|
+
oldestId = id;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (oldestId) {
|
|
23
|
+
this.guildCache.delete(oldestId);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
this.guildCache.set(guildId, entry);
|
|
27
|
+
}
|
|
28
|
+
getGuild(guildId) {
|
|
29
|
+
const entry = this.guildCache.get(guildId);
|
|
30
|
+
if (!entry)
|
|
31
|
+
return undefined;
|
|
32
|
+
if (Date.now() - entry.lastEvent > this.ttl) {
|
|
33
|
+
this.guildCache.delete(guildId);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
return entry;
|
|
37
|
+
}
|
|
38
|
+
removeGuild(guildId) {
|
|
39
|
+
return this.guildCache.delete(guildId);
|
|
40
|
+
}
|
|
41
|
+
cleanup() {
|
|
42
|
+
const now = Date.now();
|
|
43
|
+
let removed = 0;
|
|
44
|
+
for (const [id, entry] of this.guildCache.entries()) {
|
|
45
|
+
if (now - entry.lastEvent > this.ttl) {
|
|
46
|
+
this.guildCache.delete(id);
|
|
47
|
+
removed++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return removed;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=BabyCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BabyCache.js","sourceRoot":"","sources":["../../../../src/plugins/gateway/BabyCache.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,oEAAoE;AAOpE,MAAM,OAAO,SAAS;IACrB,UAAU,GAAiC,IAAI,GAAG,EAAE,CAAA;IACnC,SAAS,CAAQ;IACjB,GAAG,CAAQ;IAE5B,YAAY,SAAS,GAAG,IAAI,EAAE,GAAG,GAAG,QAAQ;QAC3C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IACf,CAAC;IAED,QAAQ,CAAC,OAAe,EAAE,KAAsB;QAC/C,IACC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS;YACtC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAC5B,CAAC;YACF,IAAI,QAAQ,GAAkB,IAAI,CAAA;YAClC,IAAI,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAA;YAEzC,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;gBACrD,IAAI,KAAK,C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