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
package/README.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Carbon Proxy
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="https://github.com/stonev5/carbon"><img src="https://cdn.buape.com/carbon/wordmark.png" alt="Carbon Wordmark"></a>
|
|
5
|
+
|
|
6
|
+
<img alt="Discord" src="https://img.shields.io/discord/1280628625904894072?style=for-the-badge">
|
|
7
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/carbon-proxy?style=for-the-badge">
|
|
8
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/carbon-proxy?style=for-the-badge">
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
> Carbon 框架的代理增强版 - 支持通过 HTTP/SOCKS5 代理访问 Discord API
|
|
12
|
+
|
|
13
|
+
这是基于 [@buape/carbon](https://github.com/buape/carbon) 的 fork 版本,增加了对代理的支持,方便在需要代理的环境中使用。
|
|
14
|
+
|
|
15
|
+
## ✨ 新增特性
|
|
16
|
+
|
|
17
|
+
本版本在原版基础上新增:
|
|
18
|
+
|
|
19
|
+
- **🔒 HTTP 代理支持** - 通过 HTTP 代理访问 Discord API
|
|
20
|
+
- **🧦 SOCKS5 代理支持** - 支持 SOCKS5 协议的代理
|
|
21
|
+
- **⚙️ 灵活配置** - 支持环境变量和代码配置两种方式
|
|
22
|
+
- **🌍 国际化友好** - 完美支持中国大陆等需要代理的地区
|
|
23
|
+
|
|
24
|
+
## 原版特性
|
|
25
|
+
|
|
26
|
+
Carbon 是一个功能完善的 Discord HTTP 框架,使用 TypeScript 构建,设计简洁易懂。
|
|
27
|
+
|
|
28
|
+
- 完全兼容 Discord API
|
|
29
|
+
- 灵活强大
|
|
30
|
+
- 基于类的系统,易于复用
|
|
31
|
+
- 支持多平台部署(Node.js、Cloudflare Workers、Bun、Next.js)
|
|
32
|
+
|
|
33
|
+
## 📦 安装
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install carbon-proxy
|
|
37
|
+
# 或
|
|
38
|
+
pnpm add carbon-proxy
|
|
39
|
+
# 或
|
|
40
|
+
yarn add carbon-proxy
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 🚀 快速开始
|
|
44
|
+
|
|
45
|
+
### 基础用法(不带代理)
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { Client } from "carbon-proxy"
|
|
49
|
+
|
|
50
|
+
const client = new Client({
|
|
51
|
+
clientId: "your-client-id",
|
|
52
|
+
publicKey: "your-public-key",
|
|
53
|
+
token: "your-bot-token",
|
|
54
|
+
baseUrl: "http://localhost:3000"
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
client.startServer()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 使用 HTTP 代理
|
|
61
|
+
|
|
62
|
+
**方式一:环境变量(推荐)**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 设置代理环境变量
|
|
66
|
+
export HTTPS_PROXY="http://127.0.0.1:7891"
|
|
67
|
+
export HTTP_PROXY="http://127.0.0.1:7891"
|
|
68
|
+
|
|
69
|
+
# 或使用 Discord 专用代理变量
|
|
70
|
+
export DISCORD_HTTP_PROXY="http://127.0.0.1:7891"
|
|
71
|
+
|
|
72
|
+
# 运行你的 bot
|
|
73
|
+
node dist/index.js
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**方式二:代码配置**
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { Client } from "carbon-proxy"
|
|
80
|
+
|
|
81
|
+
const client = new Client({
|
|
82
|
+
clientId: "your-client-id",
|
|
83
|
+
publicKey: "your-public-key",
|
|
84
|
+
token: "your-bot-token",
|
|
85
|
+
baseUrl: "http://localhost:3000",
|
|
86
|
+
requestOptions: {
|
|
87
|
+
proxy: "http://127.0.0.1:7891"
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
client.startServer()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 使用 SOCKS5 代理
|
|
95
|
+
|
|
96
|
+
**环境变量方式:**
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
export ALL_PROXY="socks5://127.0.0.1:7892"
|
|
100
|
+
node dist/index.js
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**代码配置方式:**
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { Client } from "carbon-proxy"
|
|
107
|
+
|
|
108
|
+
const client = new Client({
|
|
109
|
+
clientId: "your-client-id",
|
|
110
|
+
publicKey: "your-public-key",
|
|
111
|
+
token: "your-bot-token",
|
|
112
|
+
baseUrl: "http://localhost:3000",
|
|
113
|
+
requestOptions: {
|
|
114
|
+
proxy: "socks5://127.0.0.1:7892"
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
client.startServer()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 🔧 代理配置说明
|
|
122
|
+
|
|
123
|
+
### 支持的代理格式
|
|
124
|
+
|
|
125
|
+
- **HTTP 代理**: `http://host:port` 或 `http://user:pass@host:port`
|
|
126
|
+
- **HTTPS 代理**: `https://host:port` 或 `https://user:pass@host:port`
|
|
127
|
+
- **SOCKS 代理**: `socks://host:port`, `socks4://host:port`, `socks5://host:port`
|
|
128
|
+
|
|
129
|
+
### 环境变量优先级
|
|
130
|
+
|
|
131
|
+
按优先级从高到低:
|
|
132
|
+
|
|
133
|
+
1. `DISCORD_HTTP_PROXY` - Discord 专用代理
|
|
134
|
+
2. `HTTPS_PROXY` - HTTPS 请求代理
|
|
135
|
+
3. `HTTP_PROXY` - HTTP 请求代理
|
|
136
|
+
4. `ALL_PROXY` - 所有请求代理
|
|
137
|
+
|
|
138
|
+
### 常用代理软件配置
|
|
139
|
+
|
|
140
|
+
**Clash**
|
|
141
|
+
```bash
|
|
142
|
+
export HTTP_PROXY="http://127.0.0.1:7890"
|
|
143
|
+
export HTTPS_PROXY="http://127.0.0.1:7890"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**V2Ray**
|
|
147
|
+
```bash
|
|
148
|
+
export HTTP_PROXY="http://127.0.0.1:10809"
|
|
149
|
+
export HTTPS_PROXY="http://127.0.0.1:10809"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Shadowsocks (需要 SOCKS5 支持)**
|
|
153
|
+
```bash
|
|
154
|
+
export ALL_PROXY="socks5://127.0.0.1:7891"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## 📖 完整示例
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { Client, Intents } from "carbon-proxy"
|
|
161
|
+
import { MyCommand } from "./commands/MyCommand"
|
|
162
|
+
|
|
163
|
+
const client = new Client({
|
|
164
|
+
clientId: process.env.CLIENT_ID!,
|
|
165
|
+
publicKey: process.env.PUBLIC_KEY!,
|
|
166
|
+
token: process.env.TOKEN!,
|
|
167
|
+
baseUrl: "http://localhost:3000",
|
|
168
|
+
// 配置代理(可选,也可以用环境变量)
|
|
169
|
+
requestOptions: {
|
|
170
|
+
proxy: process.env.DISCORD_HTTP_PROXY
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
// 注册命令
|
|
175
|
+
client.registerCommand(MyCommand)
|
|
176
|
+
|
|
177
|
+
// 启动服务器
|
|
178
|
+
client.startServer()
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 🧪 测试代理连接
|
|
182
|
+
|
|
183
|
+
项目包含代理测试脚本,可以快速验证代理配置:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
cd node_modules/carbon-proxy
|
|
187
|
+
|
|
188
|
+
# 测试 HTTP 代理
|
|
189
|
+
DISCORD_BOT_TOKEN="your_token" HTTPS_PROXY="http://127.0.0.1:7891" node test-proxy.mjs
|
|
190
|
+
|
|
191
|
+
# 测试 SOCKS5 代理
|
|
192
|
+
DISCORD_BOT_TOKEN="your_token" ALL_PROXY="socks5://127.0.0.1:7892" node test-proxy.mjs
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 🔍 故障排查
|
|
196
|
+
|
|
197
|
+
### 代理连接失败
|
|
198
|
+
|
|
199
|
+
1. **确认代理服务正在运行**
|
|
200
|
+
```bash
|
|
201
|
+
curl -x http://127.0.0.1:7891 https://www.google.com
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
2. **检查代理格式**
|
|
205
|
+
- 确保使用正确的协议前缀:`http://`, `socks5://`
|
|
206
|
+
- 确保端口号正确
|
|
207
|
+
|
|
208
|
+
3. **检查代理认证**
|
|
209
|
+
- 如果代理需要认证,使用格式:`http://username:password@host:port`
|
|
210
|
+
|
|
211
|
+
### 请求超时
|
|
212
|
+
|
|
213
|
+
- 增加请求超时时间(如果支持)
|
|
214
|
+
- 检查代理服务器的网络连接
|
|
215
|
+
- 尝试切换到不同的代理协议(HTTP → SOCKS5)
|
|
216
|
+
|
|
217
|
+
## 📚 相关资源
|
|
218
|
+
|
|
219
|
+
- [原版文档](https://carbon.buape.com/carbon)
|
|
220
|
+
- [原版 Discord 社区](https://go.buape.com/carbon)
|
|
221
|
+
- [Discord API 文档](https://discord.com/developers/docs/intro)
|
|
222
|
+
|
|
223
|
+
## 🤝 贡献
|
|
224
|
+
|
|
225
|
+
欢迎提交 Issue 和 Pull Request!
|
|
226
|
+
|
|
227
|
+
## 📄 许可证
|
|
228
|
+
|
|
229
|
+
MIT License - 基于 [@buape/carbon](https://github.com/buape/carbon) 修改
|
|
230
|
+
|
|
231
|
+
## 🙏 致谢
|
|
232
|
+
|
|
233
|
+
感谢 [buape](https://github.com/buape) 开发了这么优秀的 Carbon 框架!
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
**注意**: 本版本是 fork 的增强版,主要用于需要代理的场景。如果你不需要代理功能,建议使用[原版](https://www.npmjs.com/package/@buape/carbon)。
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "carbon-proxy",
|
|
3
|
+
"version": "0.14.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/src/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/stonev5/carbon.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/stonev5/carbon#readme",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
14
|
+
"import": "./dist/src/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./*": {
|
|
17
|
+
"types": "./dist/src/plugins/*/index.d.ts",
|
|
18
|
+
"import": "./dist/src/plugins/*/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./adapters/*": {
|
|
21
|
+
"types": "./dist/src/adapters/*/index.d.ts",
|
|
22
|
+
"import": "./dist/src/adapters/*/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"dev": "tsc -w",
|
|
28
|
+
"docs": "typedoc"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@types/node": "^25.0.9",
|
|
33
|
+
"discord-api-types": "0.38.37",
|
|
34
|
+
"https-proxy-agent": "^7.0.5",
|
|
35
|
+
"socks-proxy-agent": "^8.0.0",
|
|
36
|
+
"undici": "^7.18.2",
|
|
37
|
+
"ws": "8.19.0"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { APIChannelSelectComponent, APIMentionableSelectComponent, APIRoleSelectComponent, APISelectMenuComponent, APIStringSelectComponent, APIUserSelectComponent, ComponentType } from "discord-api-types/v10";
|
|
2
|
+
import type { ComponentData } from "../types/index.js";
|
|
3
|
+
import type { AnySelectMenuInteraction } from "./AnySelectMenuInteraction.js";
|
|
4
|
+
import { BaseMessageInteractiveComponent } from "./BaseMessageInteractiveComponent.js";
|
|
5
|
+
export type AnySelectMenuComponentType = ComponentType.ChannelSelect | ComponentType.RoleSelect | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.MentionableSelect;
|
|
6
|
+
export declare abstract class AnySelectMenu extends BaseMessageInteractiveComponent {
|
|
7
|
+
abstract type: AnySelectMenuComponentType;
|
|
8
|
+
run(interaction: AnySelectMenuInteraction, data: ComponentData): unknown | Promise<unknown>;
|
|
9
|
+
minValues?: number;
|
|
10
|
+
maxValues?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Not available in modals, will throw an error if used
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Defaults to true in modals, ignored in messages
|
|
18
|
+
*/
|
|
19
|
+
required?: boolean;
|
|
20
|
+
serialize: () => APISelectMenuComponent;
|
|
21
|
+
abstract serializeOptions(): {
|
|
22
|
+
type: ComponentType.ChannelSelect;
|
|
23
|
+
channel_types: APIChannelSelectComponent["channel_types"];
|
|
24
|
+
default_values: APIChannelSelectComponent["default_values"];
|
|
25
|
+
} | {
|
|
26
|
+
type: ComponentType.StringSelect;
|
|
27
|
+
options: APIStringSelectComponent["options"];
|
|
28
|
+
} | {
|
|
29
|
+
type: ComponentType.RoleSelect;
|
|
30
|
+
default_values: APIRoleSelectComponent["default_values"];
|
|
31
|
+
} | {
|
|
32
|
+
type: ComponentType.UserSelect;
|
|
33
|
+
default_values: APIUserSelectComponent["default_values"];
|
|
34
|
+
} | {
|
|
35
|
+
type: ComponentType.MentionableSelect;
|
|
36
|
+
default_values: APIMentionableSelectComponent["default_values"];
|
|
37
|
+
};
|
|
38
|
+
serializeExtra(): Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=AnySelectMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenu.d.ts","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAA;AACtF,MAAM,MAAM,0BAA0B,GACnC,aAAa,CAAC,aAAa,GAC3B,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,YAAY,GAC1B,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,iBAAiB,CAAA;AAElC,8BAAsB,aAAc,SAAQ,+BAA+B;IAC1E,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAA;IACzC,GAAG,CACF,WAAW,EAAE,wBAAwB,EACrC,IAAI,EAAE,aAAa,GACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAO7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,SAAS,QAAO,sBAAsB,CAgBrC;IAED,QAAQ,CAAC,gBAAgB,IACtB;QACA,IAAI,EAAE,aAAa,CAAC,aAAa,CAAA;QACjC,aAAa,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAA;QACzD,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;KAC1D,GACD;QACA,IAAI,EAAE,aAAa,CAAC,YAAY,CAAA;QAChC,OAAO,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAA;KAC3C,GACD;QACA,IAAI,EAAE,aAAa,CAAC,UAAU,CAAA;QAC9B,cAAc,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;KACvD,GACD;QACA,IAAI,EAAE,aAAa,CAAC,UAAU,CAAA;QAC9B,cAAc,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;KACvD,GACD;QACA,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAA;QACrC,cAAc,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAA;KAC9D;IAEJ,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGzC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseMessageInteractiveComponent } from "./BaseMessageInteractiveComponent.js";
|
|
2
|
+
export class AnySelectMenu extends BaseMessageInteractiveComponent {
|
|
3
|
+
run(interaction, data) {
|
|
4
|
+
// Random things to show the vars as used
|
|
5
|
+
typeof interaction === "string";
|
|
6
|
+
typeof data === "string";
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
minValues;
|
|
10
|
+
maxValues;
|
|
11
|
+
/**
|
|
12
|
+
* Not available in modals, will throw an error if used
|
|
13
|
+
*/
|
|
14
|
+
disabled;
|
|
15
|
+
placeholder;
|
|
16
|
+
/**
|
|
17
|
+
* Defaults to true in modals, ignored in messages
|
|
18
|
+
*/
|
|
19
|
+
required;
|
|
20
|
+
serialize = () => {
|
|
21
|
+
const options = this.serializeOptions();
|
|
22
|
+
const extra = this.serializeExtra();
|
|
23
|
+
const data = {
|
|
24
|
+
...options,
|
|
25
|
+
custom_id: this.customId,
|
|
26
|
+
placeholder: this.placeholder,
|
|
27
|
+
min_values: this.minValues,
|
|
28
|
+
max_values: this.maxValues,
|
|
29
|
+
required: this.required,
|
|
30
|
+
...extra
|
|
31
|
+
};
|
|
32
|
+
if (this.disabled) {
|
|
33
|
+
data.disabled = true;
|
|
34
|
+
}
|
|
35
|
+
return data;
|
|
36
|
+
};
|
|
37
|
+
serializeExtra() {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=AnySelectMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenu.js","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenu.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAA;AAQtF,MAAM,OAAgB,aAAc,SAAQ,+BAA+B;IAE1E,GAAG,CACF,WAAqC,EACrC,IAAmB;QAEnB,yCAAyC;QACzC,OAAO,WAAW,KAAK,QAAQ,CAAA;QAC/B,OAAO,IAAI,KAAK,QAAQ,CAAA;QACxB,OAAM;IACP,CAAC;IAED,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB;;OAEG;IACH,QAAQ,CAAU;IAClB,WAAW,CAAS;IACpB;;OAEG;IACH,QAAQ,CAAU;IAElB,SAAS,GAAG,GAA2B,EAAE;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAA;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;QACnC,MAAM,IAAI,GAA2B;YACpC,GAAG,OAAO;YACV,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,GAAG,KAAK;SACR,CAAA;QACD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACrB,CAAC;QACD,OAAO,IAAI,CAAA;IACZ,CAAC,CAAA;IAyBD,cAAc;QACb,OAAO,EAAE,CAAA;IACV,CAAC;CACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type APIMessageComponentSelectMenuInteraction } from "discord-api-types/v10";
|
|
2
|
+
import type { Client } from "../classes/Client.js";
|
|
3
|
+
import { BaseComponentInteraction } from "./BaseComponentInteraction.js";
|
|
4
|
+
import type { InteractionDefaults } from "./BaseInteraction.js";
|
|
5
|
+
export declare abstract class AnySelectMenuInteraction extends BaseComponentInteraction {
|
|
6
|
+
constructor(client: Client, data: APIMessageComponentSelectMenuInteraction, defaults: InteractionDefaults);
|
|
7
|
+
/**
|
|
8
|
+
* The raw IDs of the selected options (either role/string/channel IDs or the IDs you provided in your options)
|
|
9
|
+
*/
|
|
10
|
+
get values(): string[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=AnySelectMenuInteraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenuInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,wCAAwC,EAG7C,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,8BAAsB,wBAAyB,SAAQ,wBAAwB;gBAE7E,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,wCAAwC,EAC9C,QAAQ,EAAE,mBAAmB;IAU9B;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;CACD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InteractionType } from "discord-api-types/v10";
|
|
2
|
+
import { BaseComponentInteraction } from "./BaseComponentInteraction.js";
|
|
3
|
+
export class AnySelectMenuInteraction extends BaseComponentInteraction {
|
|
4
|
+
constructor(client, data, defaults) {
|
|
5
|
+
super(client, data, defaults);
|
|
6
|
+
if (!data.data)
|
|
7
|
+
throw new Error("Invalid interaction data was used to create this class");
|
|
8
|
+
if (data.type !== InteractionType.MessageComponent) {
|
|
9
|
+
throw new Error("Invalid interaction type was used to create this class");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The raw IDs of the selected options (either role/string/channel IDs or the IDs you provided in your options)
|
|
14
|
+
*/
|
|
15
|
+
get values() {
|
|
16
|
+
return this.rawData.data.values;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=AnySelectMenuInteraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenuInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,eAAe,EACf,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAGxE,MAAM,OAAgB,wBAAyB,SAAQ,wBAAwB;IAC9E,YACC,MAAc,EACd,IAA8C,EAC9C,QAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI;YACb,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;IACF,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACT,OAAQ,IAAI,CAAC,OAAO,CAAC,IAA4C,CAAC,MAAM,CAAA;IACzE,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../../src/abstracts/Base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD;;;GAGG;AACH,qBAAa,IAAI;IAChB,MAAM,EAAE,MAAM,CAAA;gBACF,MAAM,EAAE,MAAM;CAG1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../src/abstracts/Base.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,IAAI;IAChB,MAAM,CAAQ;IACd,YAAY,MAAc;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;CACD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type APIChannel, type ChannelFlags, type ChannelType } from "discord-api-types/v10";
|
|
2
|
+
import type { Client } from "../classes/Client.js";
|
|
3
|
+
import type { IfPartial } from "../types/index.js";
|
|
4
|
+
import { Base } from "./Base.js";
|
|
5
|
+
export declare abstract class BaseChannel<Type extends ChannelType, IsPartial extends boolean = false> extends Base {
|
|
6
|
+
constructor(client: Client, rawDataOrId: IsPartial extends true ? string : Extract<APIChannel, {
|
|
7
|
+
type: Type;
|
|
8
|
+
}>);
|
|
9
|
+
/**
|
|
10
|
+
* The raw data of the channel.
|
|
11
|
+
*/
|
|
12
|
+
protected _rawData: Extract<APIChannel, {
|
|
13
|
+
type: Type;
|
|
14
|
+
}> | null;
|
|
15
|
+
protected setData(data: Extract<APIChannel, {
|
|
16
|
+
type: Type;
|
|
17
|
+
}>): void;
|
|
18
|
+
protected setField(field: keyof Extract<APIChannel, {
|
|
19
|
+
type: Type;
|
|
20
|
+
}>, value: unknown): void;
|
|
21
|
+
/**
|
|
22
|
+
* The raw Discord API data for this channel
|
|
23
|
+
*/
|
|
24
|
+
get rawData(): Readonly<Extract<APIChannel, {
|
|
25
|
+
type: Type;
|
|
26
|
+
}>>;
|
|
27
|
+
/**
|
|
28
|
+
* The id of the channel.
|
|
29
|
+
*/
|
|
30
|
+
readonly id: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the channel is a partial channel (meaning it does not have all the data).
|
|
33
|
+
* If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
|
|
34
|
+
*/
|
|
35
|
+
get partial(): IsPartial;
|
|
36
|
+
/**
|
|
37
|
+
* The type of the channel.
|
|
38
|
+
*/
|
|
39
|
+
get type(): IfPartial<IsPartial, Type>;
|
|
40
|
+
/**
|
|
41
|
+
* The flags of the channel in a bitfield.
|
|
42
|
+
* @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
|
43
|
+
*/
|
|
44
|
+
get flags(): IfPartial<IsPartial, ChannelFlags | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetches the channel from the API.
|
|
47
|
+
* @returns A Promise that resolves to a non-partial channel
|
|
48
|
+
*/
|
|
49
|
+
fetch(): Promise<BaseChannel<Type, false>>;
|
|
50
|
+
/**
|
|
51
|
+
* Delete the channel
|
|
52
|
+
*/
|
|
53
|
+
delete(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the Discord mention format for this channel
|
|
56
|
+
* @returns The mention string in the format <#channelId>
|
|
57
|
+
*/
|
|
58
|
+
toString(): string;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=BaseChannel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,8BAAsB,WAAW,CAChC,IAAI,SAAS,WAAW,EACxB,SAAS,SAAS,OAAO,GAAG,KAAK,CAChC,SAAQ,IAAI;gBAEZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,SAAS,SAAS,IAAI,GAChC,MAAM,GACN,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAYvC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,GAAG,IAAI,CAAO;IACrE,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAI3D,SAAS,CAAC,QAAQ,CACjB,KAAK,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,EAChD,KAAK,EAAE,OAAO;IAOf;;OAEG;IACH,IAAI,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC,CAM3D;IAED;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,IAAI,OAAO,IAAI,SAAS,CAEvB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAGrC;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,SAAS,CAAC,SAAS,EAAE,YAAY,GAAG,SAAS,CAAC,CAG1D;IAED;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAWhD;;OAEG;IACG,MAAM;IAIZ;;;OAGG;IACH,QAAQ,IAAI,MAAM;CAGlB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Routes } from "discord-api-types/v10";
|
|
2
|
+
import { Base } from "./Base.js";
|
|
3
|
+
export class BaseChannel extends Base {
|
|
4
|
+
constructor(client, rawDataOrId) {
|
|
5
|
+
super(client);
|
|
6
|
+
if (typeof rawDataOrId === "string") {
|
|
7
|
+
this.id = rawDataOrId;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
this._rawData = rawDataOrId;
|
|
11
|
+
this.id = rawDataOrId.id;
|
|
12
|
+
this.setData(rawDataOrId);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The raw data of the channel.
|
|
17
|
+
*/
|
|
18
|
+
_rawData = null;
|
|
19
|
+
setData(data) {
|
|
20
|
+
if (!data)
|
|
21
|
+
throw new Error("Cannot set data without having data... smh");
|
|
22
|
+
this._rawData = data;
|
|
23
|
+
}
|
|
24
|
+
setField(field, value) {
|
|
25
|
+
if (!this._rawData)
|
|
26
|
+
throw new Error("Cannot set field without having data... smh");
|
|
27
|
+
this._rawData[field] = value;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The raw Discord API data for this channel
|
|
31
|
+
*/
|
|
32
|
+
get rawData() {
|
|
33
|
+
if (!this._rawData)
|
|
34
|
+
throw new Error("Cannot access rawData on partial Channel. Use fetch() to populate data.");
|
|
35
|
+
return this._rawData;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The id of the channel.
|
|
39
|
+
*/
|
|
40
|
+
id;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the channel is a partial channel (meaning it does not have all the data).
|
|
43
|
+
* If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
|
|
44
|
+
*/
|
|
45
|
+
get partial() {
|
|
46
|
+
return (this._rawData === null);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The type of the channel.
|
|
50
|
+
*/
|
|
51
|
+
get type() {
|
|
52
|
+
if (!this._rawData)
|
|
53
|
+
return undefined;
|
|
54
|
+
return this._rawData.type;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The flags of the channel in a bitfield.
|
|
58
|
+
* @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
|
59
|
+
*/
|
|
60
|
+
get flags() {
|
|
61
|
+
if (!this._rawData)
|
|
62
|
+
return undefined;
|
|
63
|
+
return this._rawData.flags;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Fetches the channel from the API.
|
|
67
|
+
* @returns A Promise that resolves to a non-partial channel
|
|
68
|
+
*/
|
|
69
|
+
async fetch() {
|
|
70
|
+
const newData = (await this.client.rest.get(Routes.channel(this.id)));
|
|
71
|
+
if (!newData)
|
|
72
|
+
throw new Error(`Channel ${this.id} not found`);
|
|
73
|
+
this.setData(newData);
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Delete the channel
|
|
78
|
+
*/
|
|
79
|
+
async delete() {
|
|
80
|
+
await this.client.rest.delete(Routes.channel(this.id));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Returns the Discord mention format for this channel
|
|
84
|
+
* @returns The mention string in the format <#channelId>
|
|
85
|
+
*/
|
|
86
|
+
toString() {
|
|
87
|
+
return `<#${this.id}>`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=BaseChannel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseChannel.js","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,MAAM,EACN,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,OAAgB,WAGpB,SAAQ,IAAI;IACb,YACC,MAAc,EACd,WAEsC;QAEtC,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAA;QACtB,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,QAAQ,GAAG,WAAoB,CAAA;YACpC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,EAAE,CAAA;YACxB,IAAI,CAAC,OAAO,CAAC,WAAoB,CAAC,CAAA;QACnC,CAAC;IACF,CAAC;IAED;;OAEG;IACO,QAAQ,GAA+C,IAAI,CAAA;IAC3D,OAAO,CAAC,IAAyC;QAC1D,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;QACxE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;IACrB,CAAC;IACS,QAAQ,CACjB,KAAgD,EAChD,KAAc;QAEd,IAAI,CAAC,IAAI,CAAC,QAAQ;YACjB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAC/D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAA;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,QAAQ;YACjB,MAAM,IAAI,KAAK,CACd,yEAAyE,CACzE,CAAA;QACF,OAAO,IAAI,CAAC,QAAQ,CAAA;IACrB,CAAC;IAED;;OAEG;IACM,EAAE,CAAQ;IAEnB;;;OAGG;IACH,IAAI,OAAO;QACV,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAU,CAAA;IACzC,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACP,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAkB,CAAA;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACR,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAkB,CAAA;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACV,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAC1C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CACvB,CAAwC,CAAA;QACzC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,EAAE,YAAY,CAAC,CAAA;QAE7D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAErB,OAAO,IAAgC,CAAA;IACxC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACX,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IACvD,CAAC;IAED;;;OAGG;IACH,QAAQ;QACP,OAAO,KAAK,IAAI,CAAC,EAAE,GAAG,CAAA;IACvB,CAAC;CACD"}
|