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,715 @@
|
|
|
1
|
+
import { Routes } from "discord-api-types/v10";
|
|
2
|
+
import { Base } from "../abstracts/Base.js";
|
|
3
|
+
import { DiscordError } from "../errors/DiscordError.js";
|
|
4
|
+
import { channelFactory } from "../functions/channelFactory.js";
|
|
5
|
+
import { buildCDNUrl } from "../utils/index.js";
|
|
6
|
+
import { GuildEmoji } from "./Emoji.js";
|
|
7
|
+
import { GuildMember } from "./GuildMember.js";
|
|
8
|
+
import { GuildScheduledEvent } from "./GuildScheduledEvent.js";
|
|
9
|
+
import { Role } from "./Role.js";
|
|
10
|
+
export class Guild extends Base {
|
|
11
|
+
constructor(client, rawDataOrId) {
|
|
12
|
+
super(client);
|
|
13
|
+
if (typeof rawDataOrId === "string") {
|
|
14
|
+
this.id = rawDataOrId;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
this._rawData = rawDataOrId;
|
|
18
|
+
this.id = rawDataOrId.id;
|
|
19
|
+
this.setData(rawDataOrId);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
_rawData = null;
|
|
23
|
+
setData(data) {
|
|
24
|
+
if (!data)
|
|
25
|
+
throw new Error("Cannot set data without having data... smh");
|
|
26
|
+
this._rawData = data;
|
|
27
|
+
}
|
|
28
|
+
setField(key, value) {
|
|
29
|
+
if (!this._rawData)
|
|
30
|
+
throw new Error("Cannot set field without having data... smh");
|
|
31
|
+
Reflect.set(this._rawData, key, value);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The raw Discord API data for this guild
|
|
35
|
+
*/
|
|
36
|
+
get rawData() {
|
|
37
|
+
if (!this._rawData)
|
|
38
|
+
throw new Error("Cannot access rawData on partial Guild. Use fetch() to populate data.");
|
|
39
|
+
return this._rawData;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The ID of the guild
|
|
43
|
+
*/
|
|
44
|
+
id;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the guild is a partial guild (meaning it does not have all the data).
|
|
47
|
+
* If this is true, you should use {@link Guild.fetch} to get the full data of the guild.
|
|
48
|
+
*/
|
|
49
|
+
get partial() {
|
|
50
|
+
return (this._rawData === null);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The name of the guild.
|
|
54
|
+
*/
|
|
55
|
+
get name() {
|
|
56
|
+
if (!this._rawData)
|
|
57
|
+
return undefined;
|
|
58
|
+
return this._rawData.name;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The description of the guild.
|
|
62
|
+
*/
|
|
63
|
+
get description() {
|
|
64
|
+
if (!this._rawData)
|
|
65
|
+
return undefined;
|
|
66
|
+
return this._rawData.description;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The icon hash of the guild.
|
|
70
|
+
* You can use {@link Guild.iconUrl} to get the URL of the icon.
|
|
71
|
+
*/
|
|
72
|
+
get icon() {
|
|
73
|
+
if (!this._rawData)
|
|
74
|
+
return undefined;
|
|
75
|
+
return this._rawData.icon;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get the URL of the guild's icon with default settings (png format)
|
|
79
|
+
*/
|
|
80
|
+
get iconUrl() {
|
|
81
|
+
if (!this._rawData)
|
|
82
|
+
return undefined;
|
|
83
|
+
return buildCDNUrl(`https://cdn.discordapp.com/icons/${this.id}`, this.icon);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get the URL of the guild's icon with custom format and size options
|
|
87
|
+
* @param options Optional format and size parameters
|
|
88
|
+
* @returns The icon URL or null if no icon is set
|
|
89
|
+
*/
|
|
90
|
+
getIconUrl(options) {
|
|
91
|
+
if (!this._rawData)
|
|
92
|
+
return undefined;
|
|
93
|
+
return buildCDNUrl(`https://cdn.discordapp.com/icons/${this.id}`, this.icon, options);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The splash hash of the guild.
|
|
97
|
+
* You can use {@link Guild.splashUrl} to get the URL of the splash.
|
|
98
|
+
*/
|
|
99
|
+
get splash() {
|
|
100
|
+
if (!this._rawData)
|
|
101
|
+
return undefined;
|
|
102
|
+
return this._rawData.splash;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get the URL of the guild's splash with default settings (png format)
|
|
106
|
+
*/
|
|
107
|
+
get splashUrl() {
|
|
108
|
+
if (!this._rawData)
|
|
109
|
+
return undefined;
|
|
110
|
+
return buildCDNUrl(`https://cdn.discordapp.com/splashes/${this.id}`, this.splash);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get the URL of the guild's splash with custom format and size options
|
|
114
|
+
* @param options Optional format and size parameters
|
|
115
|
+
* @returns The splash URL or null if no splash is set
|
|
116
|
+
*/
|
|
117
|
+
getSplashUrl(options) {
|
|
118
|
+
if (!this._rawData)
|
|
119
|
+
return undefined;
|
|
120
|
+
return buildCDNUrl(`https://cdn.discordapp.com/splashes/${this.id}`, this.splash, options);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The ID of the owner of the guild.
|
|
124
|
+
*/
|
|
125
|
+
get ownerId() {
|
|
126
|
+
if (!this._rawData)
|
|
127
|
+
return undefined;
|
|
128
|
+
return this._rawData.owner_id;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get all roles in the guild
|
|
132
|
+
*/
|
|
133
|
+
get roles() {
|
|
134
|
+
if (!this._rawData)
|
|
135
|
+
return undefined;
|
|
136
|
+
const roles = this._rawData?.roles;
|
|
137
|
+
if (!roles)
|
|
138
|
+
throw new Error("Cannot get roles without having data... smh");
|
|
139
|
+
return roles.map((role) => new Role(this.client, role, this.id));
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The preferred locale of the guild.
|
|
143
|
+
*/
|
|
144
|
+
get preferredLocale() {
|
|
145
|
+
if (!this._rawData)
|
|
146
|
+
return undefined;
|
|
147
|
+
return this._rawData.preferred_locale;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The discovery splash hash of the guild.
|
|
151
|
+
* You can use {@link Guild.discoverySplashUrl} to get the URL of the discovery splash.
|
|
152
|
+
*/
|
|
153
|
+
get discoverySplash() {
|
|
154
|
+
if (!this._rawData)
|
|
155
|
+
return undefined;
|
|
156
|
+
return this._rawData.discovery_splash;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get the URL of the guild's discovery splash with default settings (png format)
|
|
160
|
+
*/
|
|
161
|
+
get discoverySplashUrl() {
|
|
162
|
+
if (!this._rawData)
|
|
163
|
+
return undefined;
|
|
164
|
+
return buildCDNUrl(`https://cdn.discordapp.com/discovery-splashes/${this.id}`, this.discoverySplash);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get the URL of the guild's discovery splash with custom format and size options
|
|
168
|
+
* @param options Optional format and size parameters
|
|
169
|
+
* @returns The discovery splash URL or null if no discovery splash is set
|
|
170
|
+
*/
|
|
171
|
+
getDiscoverySplashUrl(options) {
|
|
172
|
+
if (!this._rawData)
|
|
173
|
+
return undefined;
|
|
174
|
+
return buildCDNUrl(`https://cdn.discordapp.com/discovery-splashes/${this.id}`, this.discoverySplash, options);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Whether the user is the owner of the guild
|
|
178
|
+
*/
|
|
179
|
+
get owner() {
|
|
180
|
+
if (!this._rawData)
|
|
181
|
+
return undefined;
|
|
182
|
+
return this._rawData.owner ?? false;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Total permissions for the user in the guild (excludes overrides)
|
|
186
|
+
*/
|
|
187
|
+
get permissions() {
|
|
188
|
+
if (!this._rawData)
|
|
189
|
+
return undefined;
|
|
190
|
+
return this._rawData.permissions;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* ID of afk channel
|
|
194
|
+
*/
|
|
195
|
+
get afkChannelId() {
|
|
196
|
+
if (!this._rawData)
|
|
197
|
+
return undefined;
|
|
198
|
+
return this._rawData.afk_channel_id;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
|
|
202
|
+
*/
|
|
203
|
+
get afkTimeout() {
|
|
204
|
+
if (!this._rawData)
|
|
205
|
+
return undefined;
|
|
206
|
+
return this._rawData.afk_timeout;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Whether the guild widget is enabled
|
|
210
|
+
*/
|
|
211
|
+
get widgetEnabled() {
|
|
212
|
+
if (!this._rawData)
|
|
213
|
+
return undefined;
|
|
214
|
+
return this._rawData.widget_enabled ?? false;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The channel id that the widget will generate an invite to, or `null` if set to no invite
|
|
218
|
+
*/
|
|
219
|
+
get widgetChannelId() {
|
|
220
|
+
if (!this._rawData)
|
|
221
|
+
return undefined;
|
|
222
|
+
return this._rawData.widget_channel_id ?? null;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Verification level required for the guild
|
|
226
|
+
*/
|
|
227
|
+
get verificationLevel() {
|
|
228
|
+
if (!this._rawData)
|
|
229
|
+
return undefined;
|
|
230
|
+
return this._rawData.verification_level;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Default message notifications level
|
|
234
|
+
*/
|
|
235
|
+
get defaultMessageNotifications() {
|
|
236
|
+
if (!this._rawData)
|
|
237
|
+
return undefined;
|
|
238
|
+
return this._rawData.default_message_notifications;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Explicit content filter level
|
|
242
|
+
*/
|
|
243
|
+
get explicitContentFilter() {
|
|
244
|
+
if (!this._rawData)
|
|
245
|
+
return undefined;
|
|
246
|
+
return this._rawData.explicit_content_filter;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Custom guild emojis
|
|
250
|
+
*/
|
|
251
|
+
get emojis() {
|
|
252
|
+
if (!this._rawData)
|
|
253
|
+
return undefined;
|
|
254
|
+
return this._rawData.emojis.map((emoji) => new GuildEmoji(this.client, emoji, this.id));
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Enabled guild features
|
|
258
|
+
*/
|
|
259
|
+
get features() {
|
|
260
|
+
if (!this._rawData)
|
|
261
|
+
return undefined;
|
|
262
|
+
return this._rawData.features;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Required MFA level for the guild
|
|
266
|
+
*/
|
|
267
|
+
get mfaLevel() {
|
|
268
|
+
if (!this._rawData)
|
|
269
|
+
return undefined;
|
|
270
|
+
return this._rawData.mfa_level;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Application id of the guild creator if it is bot-created
|
|
274
|
+
*/
|
|
275
|
+
get applicationId() {
|
|
276
|
+
if (!this._rawData)
|
|
277
|
+
return undefined;
|
|
278
|
+
return this._rawData.application_id;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The id of the channel where guild notices such as welcome messages and boost events are posted
|
|
282
|
+
*/
|
|
283
|
+
get systemChannelId() {
|
|
284
|
+
if (!this._rawData)
|
|
285
|
+
return undefined;
|
|
286
|
+
return this._rawData.system_channel_id;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* System channel flags
|
|
290
|
+
*/
|
|
291
|
+
get systemChannelFlags() {
|
|
292
|
+
if (!this._rawData)
|
|
293
|
+
return undefined;
|
|
294
|
+
return this._rawData.system_channel_flags;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* The id of the channel where Community guilds can display rules and/or guidelines
|
|
298
|
+
*/
|
|
299
|
+
get rulesChannelId() {
|
|
300
|
+
if (!this._rawData)
|
|
301
|
+
return undefined;
|
|
302
|
+
return this._rawData.rules_channel_id;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
|
306
|
+
*/
|
|
307
|
+
get maxPresences() {
|
|
308
|
+
if (!this._rawData)
|
|
309
|
+
return undefined;
|
|
310
|
+
return this._rawData.max_presences ?? null;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* The maximum number of members for the guild
|
|
314
|
+
*/
|
|
315
|
+
get maxMembers() {
|
|
316
|
+
if (!this._rawData)
|
|
317
|
+
return undefined;
|
|
318
|
+
return this._rawData.max_members ?? 0;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The vanity url code for the guild
|
|
322
|
+
*/
|
|
323
|
+
get vanityUrlCode() {
|
|
324
|
+
if (!this._rawData)
|
|
325
|
+
return undefined;
|
|
326
|
+
return this._rawData.vanity_url_code;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Banner hash
|
|
330
|
+
* You can use {@link Guild.bannerUrl} to get the URL of the banner.
|
|
331
|
+
*/
|
|
332
|
+
get banner() {
|
|
333
|
+
if (!this._rawData)
|
|
334
|
+
return undefined;
|
|
335
|
+
return this._rawData.banner;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Get the URL of the guild's banner with default settings (png format)
|
|
339
|
+
*/
|
|
340
|
+
get bannerUrl() {
|
|
341
|
+
if (!this._rawData)
|
|
342
|
+
return undefined;
|
|
343
|
+
return buildCDNUrl(`https://cdn.discordapp.com/banners/${this.id}`, this.banner);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Get the URL of the guild's banner with custom format and size options
|
|
347
|
+
* @param options Optional format and size parameters
|
|
348
|
+
* @returns The banner URL or null if no banner is set
|
|
349
|
+
*/
|
|
350
|
+
getBannerUrl(options) {
|
|
351
|
+
if (!this._rawData)
|
|
352
|
+
return undefined;
|
|
353
|
+
return buildCDNUrl(`https://cdn.discordapp.com/banners/${this.id}`, this.banner, options);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Premium tier (Server Boost level)
|
|
357
|
+
*/
|
|
358
|
+
get premiumTier() {
|
|
359
|
+
if (!this._rawData)
|
|
360
|
+
return undefined;
|
|
361
|
+
return this._rawData.premium_tier;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* The number of boosts this guild currently has
|
|
365
|
+
*/
|
|
366
|
+
get premiumSubscriptionCount() {
|
|
367
|
+
if (!this._rawData)
|
|
368
|
+
return undefined;
|
|
369
|
+
return this._rawData.premium_subscription_count ?? 0;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* The id of the channel where admins and moderators of Community guilds receive notices from Discord
|
|
373
|
+
*/
|
|
374
|
+
get publicUpdatesChannelId() {
|
|
375
|
+
if (!this._rawData)
|
|
376
|
+
return undefined;
|
|
377
|
+
return this._rawData.public_updates_channel_id;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* The maximum amount of users in a video channel
|
|
381
|
+
*/
|
|
382
|
+
get maxVideoChannelUsers() {
|
|
383
|
+
if (!this._rawData)
|
|
384
|
+
return undefined;
|
|
385
|
+
return this._rawData.max_video_channel_users ?? 0;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* The maximum amount of users in a stage video channel
|
|
389
|
+
*/
|
|
390
|
+
get maxStageVideoChannelUsers() {
|
|
391
|
+
if (!this._rawData)
|
|
392
|
+
return undefined;
|
|
393
|
+
return this._rawData.max_stage_video_channel_users ?? 0;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Approximate number of members in this guild
|
|
397
|
+
*/
|
|
398
|
+
get approximateMemberCount() {
|
|
399
|
+
if (!this._rawData)
|
|
400
|
+
return undefined;
|
|
401
|
+
return this._rawData.approximate_member_count ?? 0;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Approximate number of non-offline members in this guild
|
|
405
|
+
*/
|
|
406
|
+
get approximatePresenceCount() {
|
|
407
|
+
if (!this._rawData)
|
|
408
|
+
return undefined;
|
|
409
|
+
return this._rawData.approximate_presence_count ?? 0;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* The welcome screen of a Community guild, shown to new members
|
|
413
|
+
*/
|
|
414
|
+
get welcomeScreen() {
|
|
415
|
+
if (!this._rawData)
|
|
416
|
+
return undefined;
|
|
417
|
+
return this._rawData.welcome_screen;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* The nsfw level of the guild
|
|
421
|
+
*/
|
|
422
|
+
get nsfwLevel() {
|
|
423
|
+
if (!this._rawData)
|
|
424
|
+
return undefined;
|
|
425
|
+
return this._rawData.nsfw_level;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Custom guild stickers
|
|
429
|
+
*/
|
|
430
|
+
get stickers() {
|
|
431
|
+
if (!this._rawData)
|
|
432
|
+
return undefined;
|
|
433
|
+
return this._rawData.stickers;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Whether the guild has the boost progress bar enabled
|
|
437
|
+
*/
|
|
438
|
+
get premiumProgressBarEnabled() {
|
|
439
|
+
if (!this._rawData)
|
|
440
|
+
return undefined;
|
|
441
|
+
return this._rawData.premium_progress_bar_enabled;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* The type of Student Hub the guild is
|
|
445
|
+
*/
|
|
446
|
+
get hubType() {
|
|
447
|
+
if (!this._rawData)
|
|
448
|
+
return undefined;
|
|
449
|
+
return this._rawData.hub_type;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
|
|
453
|
+
*/
|
|
454
|
+
get safetyAlertsChannelId() {
|
|
455
|
+
if (!this._rawData)
|
|
456
|
+
return undefined;
|
|
457
|
+
return this._rawData.safety_alerts_channel_id;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* The incidents data for this guild
|
|
461
|
+
*/
|
|
462
|
+
get incidentsData() {
|
|
463
|
+
if (!this._rawData)
|
|
464
|
+
return undefined;
|
|
465
|
+
return this._rawData.incidents_data;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Fetch updated data for this guild.
|
|
469
|
+
* If the guild is partial, this will fetch all the data for the guild and populate the fields.
|
|
470
|
+
* If the guild is not partial, all fields will be updated with new values from Discord.
|
|
471
|
+
* @returns A Promise that resolves to a non-partial Guild
|
|
472
|
+
*/
|
|
473
|
+
async fetch() {
|
|
474
|
+
const newData = (await this.client.rest.get(Routes.guild(this.id)));
|
|
475
|
+
if (!newData)
|
|
476
|
+
throw new Error(`Guild ${this.id} not found`);
|
|
477
|
+
this.setData(newData);
|
|
478
|
+
return this;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Leave the guild
|
|
482
|
+
*/
|
|
483
|
+
async leave() {
|
|
484
|
+
await this.client.rest.delete(Routes.guild(this.id));
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Create a role in the guild
|
|
488
|
+
*/
|
|
489
|
+
async createRole(data) {
|
|
490
|
+
const role = (await this.client.rest.post(Routes.guildRoles(this.id), {
|
|
491
|
+
body: {
|
|
492
|
+
...data
|
|
493
|
+
}
|
|
494
|
+
}));
|
|
495
|
+
const roleClass = new Role(this.client, role, this.id);
|
|
496
|
+
this.setField("roles", Array.isArray(this.roles) ? [...this.roles, roleClass] : [roleClass]);
|
|
497
|
+
return roleClass;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Get a member in the guild by ID
|
|
501
|
+
* @param memberId The ID of the member to fetch
|
|
502
|
+
* @returns A Promise that resolves to a GuildMember or null if not found
|
|
503
|
+
*/
|
|
504
|
+
async fetchMember(memberId) {
|
|
505
|
+
try {
|
|
506
|
+
const partialGuild = new Guild(this.client, this.id);
|
|
507
|
+
const member = (await this.client.rest.get(Routes.guildMember(this.id, memberId)));
|
|
508
|
+
const memberObject = new GuildMember(this.client, member, partialGuild);
|
|
509
|
+
return memberObject;
|
|
510
|
+
}
|
|
511
|
+
catch (e) {
|
|
512
|
+
if (e instanceof DiscordError) {
|
|
513
|
+
if (e.status === 404)
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
throw e;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Fetch all members in the guild
|
|
521
|
+
* @param limit The maximum number of members to fetch (max 1000, default 100, set to "all" to fetch all members)
|
|
522
|
+
* @returns A Promise that resolves to an array of GuildMember objects
|
|
523
|
+
* @experimental
|
|
524
|
+
*/
|
|
525
|
+
async fetchMembers(limit = 100) {
|
|
526
|
+
if (limit === "all") {
|
|
527
|
+
const members = [];
|
|
528
|
+
let after;
|
|
529
|
+
let hasMore = true;
|
|
530
|
+
while (hasMore) {
|
|
531
|
+
const newMembers = (await this.client.rest.get(Routes.guildMembers(this.id), {
|
|
532
|
+
limit: "1000",
|
|
533
|
+
...(after ? { after } : {})
|
|
534
|
+
}));
|
|
535
|
+
if (newMembers.length === 0) {
|
|
536
|
+
hasMore = false;
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
members.push(...newMembers);
|
|
540
|
+
after = newMembers[newMembers.length - 1]?.user.id;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
const memberObjects = members.map((member) => new GuildMember(this.client, member, this));
|
|
544
|
+
return memberObjects;
|
|
545
|
+
}
|
|
546
|
+
const cappedLimit = Math.min(limit, 1000);
|
|
547
|
+
const members = (await this.client.rest.get(Routes.guildMembers(this.id), {
|
|
548
|
+
limit: cappedLimit.toString()
|
|
549
|
+
}));
|
|
550
|
+
const memberObjects = members.map((member) => new GuildMember(this.client, member, this));
|
|
551
|
+
return memberObjects;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Fetch a channel from the guild by ID
|
|
555
|
+
*/
|
|
556
|
+
async fetchChannel(channelId) {
|
|
557
|
+
try {
|
|
558
|
+
const channel = (await this.client.rest.get(Routes.channel(channelId)));
|
|
559
|
+
return channelFactory(this.client, channel);
|
|
560
|
+
}
|
|
561
|
+
catch (e) {
|
|
562
|
+
if (e instanceof DiscordError) {
|
|
563
|
+
if (e.status === 404)
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
throw e;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Fetch all channels in the guild
|
|
571
|
+
* @returns A Promise that resolves to an array of channel objects
|
|
572
|
+
*/
|
|
573
|
+
async fetchChannels() {
|
|
574
|
+
const channels = (await this.client.rest.get(Routes.guildChannels(this.id)));
|
|
575
|
+
const channelObjects = channels.map((channel) => channelFactory(this.client, channel));
|
|
576
|
+
return channelObjects;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Fetch a role from the guild by ID
|
|
580
|
+
*/
|
|
581
|
+
async fetchRole(roleId) {
|
|
582
|
+
const role = (await this.client.rest.get(Routes.guildRole(this.id, roleId)));
|
|
583
|
+
return new Role(this.client, role, this.id);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Fetch all roles in the guild
|
|
587
|
+
* @returns A Promise that resolves to an array of Role objects
|
|
588
|
+
*/
|
|
589
|
+
async fetchRoles() {
|
|
590
|
+
const roles = (await this.client.rest.get(Routes.guildRoles(this.id)));
|
|
591
|
+
const roleObjects = roles.map((role) => new Role(this.client, role, this.id));
|
|
592
|
+
return roleObjects;
|
|
593
|
+
}
|
|
594
|
+
async getEmoji(id) {
|
|
595
|
+
const emoji = (await this.client.rest.get(Routes.guildEmoji(this.id, id)));
|
|
596
|
+
return new GuildEmoji(this.client, emoji, this.id);
|
|
597
|
+
}
|
|
598
|
+
getEmojiByName(name) {
|
|
599
|
+
const emojis = this.emojis;
|
|
600
|
+
return emojis?.find((emoji) => emoji.name === name);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Upload a new emoji to the application
|
|
604
|
+
* @param name The name of the emoji
|
|
605
|
+
* @param image The image of the emoji in base64 format
|
|
606
|
+
* @returns The created ApplicationEmoji
|
|
607
|
+
*/
|
|
608
|
+
async createEmoji(name, image) {
|
|
609
|
+
const emoji = (await this.client.rest.post(Routes.guildEmojis(this.id), {
|
|
610
|
+
body: { name, image }
|
|
611
|
+
}));
|
|
612
|
+
return new GuildEmoji(this.client, emoji, this.id);
|
|
613
|
+
}
|
|
614
|
+
async deleteEmoji(id) {
|
|
615
|
+
await this.client.rest.delete(Routes.guildEmoji(this.id, id));
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Fetch all scheduled events for the guild
|
|
619
|
+
* @param withUserCount Whether to include the user count in the response
|
|
620
|
+
* @returns A Promise that resolves to an array of GuildScheduledEvent objects
|
|
621
|
+
*/
|
|
622
|
+
async fetchScheduledEvents(withUserCount = false) {
|
|
623
|
+
const scheduledEvents = (await this.client.rest.get(Routes.guildScheduledEvents(this.id), withUserCount ? { with_user_count: "true" } : undefined));
|
|
624
|
+
return scheduledEvents.map((event) => new GuildScheduledEvent(this.client, event, this.id));
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Fetch a specific scheduled event by ID
|
|
628
|
+
* @param eventId The ID of the scheduled event to fetch
|
|
629
|
+
* @param withUserCount Whether to include the user count in the response
|
|
630
|
+
* @returns A Promise that resolves to a GuildScheduledEvent or null if not found
|
|
631
|
+
*/
|
|
632
|
+
async fetchScheduledEvent(eventId, withUserCount = false) {
|
|
633
|
+
try {
|
|
634
|
+
const scheduledEvent = (await this.client.rest.get(Routes.guildScheduledEvent(this.id, eventId), withUserCount ? { with_user_count: "true" } : undefined));
|
|
635
|
+
return new GuildScheduledEvent(this.client, scheduledEvent, this.id);
|
|
636
|
+
}
|
|
637
|
+
catch (e) {
|
|
638
|
+
if (e instanceof DiscordError) {
|
|
639
|
+
if (e.status === 404)
|
|
640
|
+
return null;
|
|
641
|
+
}
|
|
642
|
+
throw e;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Create a new scheduled event
|
|
647
|
+
* @param data The data for the scheduled event
|
|
648
|
+
* @returns A Promise that resolves to the created GuildScheduledEvent
|
|
649
|
+
*/
|
|
650
|
+
async createScheduledEvent(data) {
|
|
651
|
+
const scheduledEvent = (await this.client.rest.post(Routes.guildScheduledEvents(this.id), {
|
|
652
|
+
body: {
|
|
653
|
+
name: data.name,
|
|
654
|
+
description: data.description ?? null,
|
|
655
|
+
scheduled_start_time: data.scheduledStartTime,
|
|
656
|
+
scheduled_end_time: data.scheduledEndTime ?? null,
|
|
657
|
+
privacy_level: data.privacyLevel,
|
|
658
|
+
entity_type: data.entityType,
|
|
659
|
+
channel_id: data.channelId ?? null,
|
|
660
|
+
entity_metadata: data.entityMetadata,
|
|
661
|
+
image: data.image ?? null
|
|
662
|
+
}
|
|
663
|
+
}));
|
|
664
|
+
return new GuildScheduledEvent(this.client, scheduledEvent, this.id);
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Edit a scheduled event
|
|
668
|
+
* @param eventId The ID of the scheduled event to edit
|
|
669
|
+
* @param data The data to update the scheduled event with
|
|
670
|
+
* @returns A Promise that resolves to the updated GuildScheduledEvent
|
|
671
|
+
*/
|
|
672
|
+
async editScheduledEvent(eventId, data) {
|
|
673
|
+
const body = {};
|
|
674
|
+
if (data.name !== undefined)
|
|
675
|
+
body.name = data.name;
|
|
676
|
+
if (data.description !== undefined)
|
|
677
|
+
body.description = data.description;
|
|
678
|
+
if (data.scheduledStartTime !== undefined)
|
|
679
|
+
body.scheduled_start_time = data.scheduledStartTime;
|
|
680
|
+
if (data.scheduledEndTime !== undefined)
|
|
681
|
+
body.scheduled_end_time = data.scheduledEndTime;
|
|
682
|
+
if (data.privacyLevel !== undefined)
|
|
683
|
+
body.privacy_level = data.privacyLevel;
|
|
684
|
+
if (data.entityType !== undefined)
|
|
685
|
+
body.entity_type = data.entityType;
|
|
686
|
+
if (data.channelId !== undefined)
|
|
687
|
+
body.channel_id = data.channelId;
|
|
688
|
+
if (data.entityMetadata !== undefined)
|
|
689
|
+
body.entity_metadata = data.entityMetadata;
|
|
690
|
+
if (data.image !== undefined)
|
|
691
|
+
body.image = data.image;
|
|
692
|
+
const scheduledEvent = (await this.client.rest.patch(Routes.guildScheduledEvent(this.id, eventId), { body }));
|
|
693
|
+
return new GuildScheduledEvent(this.client, scheduledEvent, this.id);
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Delete a scheduled event
|
|
697
|
+
* @param eventId The ID of the scheduled event to delete
|
|
698
|
+
*/
|
|
699
|
+
async deleteScheduledEvent(eventId) {
|
|
700
|
+
await this.client.rest.delete(Routes.guildScheduledEvent(this.id, eventId));
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Get member counts for each role in the guild
|
|
704
|
+
* @returns A Promise that resolves to an array of objects containing role ID, partial Role, and member count
|
|
705
|
+
*/
|
|
706
|
+
async fetchRoleMemberCounts() {
|
|
707
|
+
const memberCounts = (await this.client.rest.get(`/guilds/${this.id}/roles/member-counts`));
|
|
708
|
+
return Object.entries(memberCounts).map(([roleId, count]) => ({
|
|
709
|
+
id: roleId,
|
|
710
|
+
role: new Role(this.client, roleId, this.id),
|
|
711
|
+
count
|
|
712
|
+
}));
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
//# sourceMappingURL=Guild.js.map
|