@buape/carbon 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +8 -7
- package/dist/src/abstracts/AnySelectMenu.d.ts +4 -3
- package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -1
- package/dist/src/abstracts/AnySelectMenu.js +8 -2
- package/dist/src/abstracts/AnySelectMenu.js.map +1 -1
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +0 -1
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/AnySelectMenuInteraction.js +0 -2
- package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseChannel.d.ts +12 -3
- package/dist/src/abstracts/BaseChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseChannel.js +15 -1
- package/dist/src/abstracts/BaseChannel.js.map +1 -1
- package/dist/src/abstracts/BaseCommand.d.ts +18 -8
- package/dist/src/abstracts/BaseCommand.d.ts.map +1 -1
- package/dist/src/abstracts/BaseCommand.js +24 -7
- package/dist/src/abstracts/BaseCommand.js.map +1 -1
- package/dist/src/abstracts/BaseComponent.d.ts +10 -24
- package/dist/src/abstracts/BaseComponent.d.ts.map +1 -1
- package/dist/src/abstracts/BaseComponent.js +5 -25
- package/dist/src/abstracts/BaseComponent.js.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +3 -4
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.js +3 -6
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.d.ts +4 -3
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.js +5 -3
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.d.ts +49 -36
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.js +105 -34
- package/dist/src/abstracts/BaseInteraction.js.map +1 -1
- 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 +39 -0
- package/dist/src/abstracts/BaseMessageInteractiveComponent.d.ts.map +1 -0
- package/dist/src/abstracts/BaseMessageInteractiveComponent.js +33 -0
- package/dist/src/abstracts/BaseMessageInteractiveComponent.js.map +1 -0
- package/dist/src/abstracts/BaseModalComponent.d.ts +29 -0
- package/dist/src/abstracts/BaseModalComponent.d.ts.map +1 -0
- package/dist/src/abstracts/BaseModalComponent.js +33 -0
- package/dist/src/abstracts/BaseModalComponent.js.map +1 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +5 -4
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.js +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -1
- package/dist/src/abstracts/Plugin.d.ts +6 -2
- package/dist/src/abstracts/Plugin.d.ts.map +1 -1
- package/dist/src/abstracts/Plugin.js.map +1 -1
- package/dist/src/classes/Client.d.ts +42 -12
- package/dist/src/classes/Client.d.ts.map +1 -1
- package/dist/src/classes/Client.js +98 -25
- package/dist/src/classes/Client.js.map +1 -1
- package/dist/src/classes/Command.d.ts +10 -2
- package/dist/src/classes/Command.d.ts.map +1 -1
- package/dist/src/classes/Command.js +12 -1
- package/dist/src/classes/Command.js.map +1 -1
- package/dist/src/classes/Listener.d.ts +376 -5
- package/dist/src/classes/Listener.d.ts.map +1 -1
- package/dist/src/classes/Listener.js +1011 -1
- package/dist/src/classes/Listener.js.map +1 -1
- package/dist/src/classes/Modal.d.ts +22 -5
- package/dist/src/classes/Modal.d.ts.map +1 -1
- package/dist/src/classes/Modal.js +14 -0
- package/dist/src/classes/Modal.js.map +1 -1
- package/dist/src/classes/RequestClient.d.ts +79 -0
- package/dist/src/classes/RequestClient.d.ts.map +1 -0
- package/dist/src/classes/RequestClient.js +225 -0
- package/dist/src/classes/RequestClient.js.map +1 -0
- package/dist/src/classes/{Button.d.ts → components/Button.d.ts} +8 -5
- package/dist/src/classes/components/Button.d.ts.map +1 -0
- package/dist/src/classes/{Button.js → components/Button.js} +13 -3
- package/dist/src/classes/components/Button.js.map +1 -0
- package/dist/src/classes/{ChannelSelectMenu.d.ts → components/ChannelSelectMenu.d.ts} +6 -4
- package/dist/src/classes/components/ChannelSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/{ChannelSelectMenu.js → components/ChannelSelectMenu.js} +8 -1
- package/dist/src/classes/components/ChannelSelectMenu.js.map +1 -0
- package/dist/src/classes/components/Container.d.ts +23 -0
- package/dist/src/classes/components/Container.d.ts.map +1 -0
- package/dist/src/classes/components/Container.js +27 -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 +33 -0
- package/dist/src/classes/components/File.js.map +1 -0
- package/dist/src/classes/components/MediaGallery.d.ts +27 -0
- package/dist/src/classes/components/MediaGallery.d.ts.map +1 -0
- package/dist/src/classes/components/MediaGallery.js +27 -0
- package/dist/src/classes/components/MediaGallery.js.map +1 -0
- package/dist/src/classes/{MentionableSelectMenu.d.ts → components/MentionableSelectMenu.d.ts} +6 -4
- package/dist/src/classes/components/MentionableSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/{MentionableSelectMenu.js → components/MentionableSelectMenu.js} +8 -1
- package/dist/src/classes/components/MentionableSelectMenu.js.map +1 -0
- package/dist/src/classes/{RoleSelectMenu.d.ts → components/RoleSelectMenu.d.ts} +6 -4
- 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 +29 -0
- package/dist/src/classes/components/Row.d.ts.map +1 -0
- package/dist/src/classes/{Row.js → components/Row.js} +8 -2
- package/dist/src/classes/components/Row.js.map +1 -0
- package/dist/src/classes/components/Section.d.ts +22 -0
- package/dist/src/classes/components/Section.d.ts.map +1 -0
- package/dist/src/classes/components/Section.js +15 -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 +19 -0
- package/dist/src/classes/components/TextDisplay.js.map +1 -0
- package/dist/src/classes/{TextInput.d.ts → components/TextInput.d.ts} +4 -3
- package/dist/src/classes/components/TextInput.d.ts.map +1 -0
- package/dist/src/classes/{TextInput.js → components/TextInput.js} +3 -2
- package/dist/src/classes/components/TextInput.js.map +1 -0
- package/dist/src/classes/components/Thumbnail.d.ts +13 -0
- package/dist/src/classes/components/Thumbnail.d.ts.map +1 -0
- package/dist/src/classes/components/Thumbnail.js +16 -0
- package/dist/src/classes/components/Thumbnail.js.map +1 -0
- package/dist/src/classes/{UserSelectMenu.d.ts → components/UserSelectMenu.d.ts} +6 -4
- 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/{factories → functions}/channelFactory.d.ts +3 -2
- package/dist/src/functions/channelFactory.d.ts.map +1 -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 +29 -63
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +31 -15
- package/dist/src/index.js.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.d.ts +15 -5
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.js +27 -15
- package/dist/src/internals/AutocompleteInteraction.js.map +1 -1
- package/dist/src/internals/ButtonInteraction.d.ts +0 -1
- package/dist/src/internals/ButtonInteraction.d.ts.map +1 -1
- package/dist/src/internals/ButtonInteraction.js +0 -2
- package/dist/src/internals/ButtonInteraction.js.map +1 -1
- package/dist/src/internals/CommandHandler.d.ts +1 -1
- package/dist/src/internals/CommandHandler.d.ts.map +1 -1
- package/dist/src/internals/CommandHandler.js +25 -3
- package/dist/src/internals/CommandHandler.js.map +1 -1
- package/dist/src/internals/CommandInteraction.d.ts +7 -1
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -1
- package/dist/src/internals/CommandInteraction.js +10 -4
- package/dist/src/internals/CommandInteraction.js.map +1 -1
- package/dist/src/internals/ComponentHandler.d.ts +8 -5
- package/dist/src/internals/ComponentHandler.d.ts.map +1 -1
- package/dist/src/internals/ComponentHandler.js +40 -16
- package/dist/src/internals/ComponentHandler.js.map +1 -1
- package/dist/src/internals/EventHandler.d.ts +7 -5
- package/dist/src/internals/EventHandler.d.ts.map +1 -1
- package/dist/src/internals/EventHandler.js +13 -11
- package/dist/src/internals/EventHandler.js.map +1 -1
- package/dist/src/internals/ModalHandler.d.ts +1 -1
- package/dist/src/internals/ModalHandler.d.ts.map +1 -1
- package/dist/src/internals/ModalHandler.js +6 -2
- package/dist/src/internals/ModalHandler.js.map +1 -1
- package/dist/src/internals/ModalInteraction.d.ts +2 -3
- package/dist/src/internals/ModalInteraction.d.ts.map +1 -1
- package/dist/src/internals/ModalInteraction.js +3 -4
- package/dist/src/internals/ModalInteraction.js.map +1 -1
- package/dist/src/internals/OptionsHandler.d.ts +13 -3
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -1
- package/dist/src/internals/OptionsHandler.js +51 -1
- package/dist/src/internals/OptionsHandler.js.map +1 -1
- package/dist/src/permissions.d.ts +54 -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/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 +46 -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/GatewayPlugin.d.ts +41 -0
- package/dist/src/plugins/gateway/GatewayPlugin.d.ts.map +1 -0
- package/dist/src/plugins/gateway/GatewayPlugin.js +282 -0
- package/dist/src/plugins/gateway/GatewayPlugin.js.map +1 -0
- package/dist/src/plugins/gateway/index.d.ts +6 -0
- package/dist/src/plugins/gateway/index.d.ts.map +1 -0
- package/dist/src/plugins/gateway/index.js +6 -0
- package/dist/src/plugins/gateway/index.js.map +1 -0
- package/dist/src/plugins/gateway/types.d.ts +62 -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 +17 -0
- package/dist/src/plugins/gateway/utils/heartbeat.d.ts.map +1 -0
- package/dist/src/plugins/gateway/utils/heartbeat.js +28 -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 +22 -0
- package/dist/src/plugins/gateway/utils/payload.d.ts.map +1 -0
- package/dist/src/plugins/gateway/utils/payload.js +47 -0
- package/dist/src/plugins/gateway/utils/payload.js.map +1 -0
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.d.ts +26 -0
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.d.ts.map +1 -0
- package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js +74 -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 +10 -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 +1 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.d.ts.map +1 -1
- package/dist/src/plugins/linked-roles/LinkedRoles.js +1 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.js.map +1 -1
- package/dist/src/plugins/paginator/Paginator.d.ts +51 -0
- package/dist/src/plugins/paginator/Paginator.d.ts.map +1 -0
- package/dist/src/plugins/paginator/Paginator.js +155 -0
- package/dist/src/plugins/paginator/Paginator.js.map +1 -0
- package/dist/src/plugins/paginator/index.d.ts +8 -0
- package/dist/src/plugins/paginator/index.d.ts.map +1 -0
- package/dist/src/plugins/paginator/index.js +8 -0
- package/dist/src/plugins/paginator/index.js.map +1 -0
- package/dist/src/plugins/sharding/ShardingPlugin.d.ts +43 -0
- package/dist/src/plugins/sharding/ShardingPlugin.d.ts.map +1 -0
- package/dist/src/plugins/sharding/ShardingPlugin.js +111 -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/structures/DmChannel.d.ts +3 -3
- package/dist/src/structures/DmChannel.d.ts.map +1 -1
- package/dist/src/structures/DmChannel.js +5 -3
- package/dist/src/structures/DmChannel.js.map +1 -1
- package/dist/src/structures/GroupDmChannel.d.ts +1 -1
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -1
- package/dist/src/structures/Guild.d.ts +186 -6
- package/dist/src/structures/Guild.d.ts.map +1 -1
- package/dist/src/structures/Guild.js +409 -13
- package/dist/src/structures/Guild.js.map +1 -1
- package/dist/src/structures/GuildCategoryChannel.d.ts +1 -1
- package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildForumChannel.d.ts +1 -1
- package/dist/src/structures/GuildForumChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildMember.d.ts +15 -12
- package/dist/src/structures/GuildMember.d.ts.map +1 -1
- package/dist/src/structures/GuildMember.js +78 -19
- package/dist/src/structures/GuildMember.js.map +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildTextChannel.d.ts +1 -1
- package/dist/src/structures/GuildTextChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildThreadChannel.d.ts +1 -1
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -1
- package/dist/src/structures/Message.d.ts +31 -14
- package/dist/src/structures/Message.d.ts.map +1 -1
- package/dist/src/structures/Message.js +126 -17
- package/dist/src/structures/Message.js.map +1 -1
- package/dist/src/structures/Poll.d.ts +25 -0
- package/dist/src/structures/Poll.d.ts.map +1 -0
- package/dist/src/structures/Poll.js +45 -0
- package/dist/src/structures/Poll.js.map +1 -0
- package/dist/src/structures/Role.d.ts +31 -13
- package/dist/src/structures/Role.d.ts.map +1 -1
- package/dist/src/structures/Role.js +50 -21
- package/dist/src/structures/Role.js.map +1 -1
- package/dist/src/structures/ThreadMember.d.ts +36 -0
- package/dist/src/structures/ThreadMember.d.ts.map +1 -0
- package/dist/src/structures/ThreadMember.js +72 -0
- package/dist/src/structures/ThreadMember.js.map +1 -0
- package/dist/src/structures/User.d.ts +10 -4
- package/dist/src/structures/User.d.ts.map +1 -1
- package/dist/src/structures/User.js +10 -1
- package/dist/src/structures/User.js.map +1 -1
- package/dist/src/structures/Webhook.d.ts +135 -0
- package/dist/src/structures/Webhook.d.ts.map +1 -0
- package/dist/src/structures/Webhook.js +239 -0
- package/dist/src/structures/Webhook.js.map +1 -0
- package/dist/src/types/index.d.ts +132 -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 +566 -0
- package/dist/src/types/listeners.d.ts.map +1 -0
- package/dist/src/types/listeners.js +12 -0
- package/dist/src/types/listeners.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 +17 -0
- package/dist/src/utils/customIdParser.js.map +1 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +4 -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 +45 -0
- package/dist/src/utils/payload.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.js → utils/verification.js} +1 -26
- package/dist/src/utils/verification.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/dist/src/adapters/cloudflare/index.d.ts +0 -16
- package/dist/src/adapters/cloudflare/index.d.ts.map +0 -1
- package/dist/src/adapters/cloudflare/index.js +0 -17
- package/dist/src/adapters/cloudflare/index.js.map +0 -1
- package/dist/src/adapters/next/index.d.ts +0 -14
- package/dist/src/adapters/next/index.d.ts.map +0 -1
- package/dist/src/adapters/next/index.js +0 -17
- package/dist/src/adapters/next/index.js.map +0 -1
- package/dist/src/adapters/shared.d.ts +0 -10
- package/dist/src/adapters/shared.d.ts.map +0 -1
- package/dist/src/adapters/shared.js +0 -2
- package/dist/src/adapters/shared.js.map +0 -1
- package/dist/src/classes/Button.d.ts.map +0 -1
- package/dist/src/classes/Button.js.map +0 -1
- package/dist/src/classes/ChannelSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/ChannelSelectMenu.js.map +0 -1
- package/dist/src/classes/MentionableSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/MentionableSelectMenu.js.map +0 -1
- package/dist/src/classes/RoleSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/RoleSelectMenu.js +0 -13
- package/dist/src/classes/RoleSelectMenu.js.map +0 -1
- package/dist/src/classes/Row.d.ts +0 -25
- package/dist/src/classes/Row.d.ts.map +0 -1
- package/dist/src/classes/Row.js.map +0 -1
- package/dist/src/classes/StringSelectMenu.d.ts +0 -13
- package/dist/src/classes/StringSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/StringSelectMenu.js +0 -12
- package/dist/src/classes/StringSelectMenu.js.map +0 -1
- package/dist/src/classes/TextInput.d.ts.map +0 -1
- package/dist/src/classes/TextInput.js.map +0 -1
- package/dist/src/classes/UserSelectMenu.d.ts.map +0 -1
- package/dist/src/classes/UserSelectMenu.js +0 -13
- package/dist/src/classes/UserSelectMenu.js.map +0 -1
- package/dist/src/createHandle.d.ts +0 -20
- package/dist/src/createHandle.d.ts.map +0 -1
- package/dist/src/createHandle.js +0 -57
- package/dist/src/createHandle.js.map +0 -1
- package/dist/src/factories/channelFactory.d.ts.map +0 -1
- package/dist/src/factories/channelFactory.js.map +0 -1
- package/dist/src/types/messagePayload.d.ts +0 -37
- package/dist/src/types/messagePayload.d.ts.map +0 -1
- package/dist/src/types/messagePayload.js +0 -2
- package/dist/src/types/messagePayload.js.map +0 -1
- package/dist/src/types.d.ts +0 -38
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.d.ts +0 -27
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js.map +0 -1
- /package/dist/src/{factories → functions}/channelFactory.js +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { RequestClient, type RequestClientOptions } from "@buape/carbon-request";
|
|
2
1
|
import type { BaseCommand } from "../abstracts/BaseCommand.js";
|
|
2
|
+
import type { BaseListener } from "../abstracts/BaseListener.js";
|
|
3
|
+
import type { BaseMessageInteractiveComponent } from "../abstracts/BaseMessageInteractiveComponent.js";
|
|
3
4
|
import type { Context, Plugin, Route } from "../abstracts/Plugin.js";
|
|
4
5
|
import { CommandHandler } from "../internals/CommandHandler.js";
|
|
5
6
|
import { ComponentHandler } from "../internals/ComponentHandler.js";
|
|
@@ -7,9 +8,11 @@ import { EventHandler } from "../internals/EventHandler.js";
|
|
|
7
8
|
import { ModalHandler } from "../internals/ModalHandler.js";
|
|
8
9
|
import { Guild } from "../structures/Guild.js";
|
|
9
10
|
import { GuildMember } from "../structures/GuildMember.js";
|
|
11
|
+
import { Message } from "../structures/Message.js";
|
|
10
12
|
import { Role } from "../structures/Role.js";
|
|
11
13
|
import { User } from "../structures/User.js";
|
|
12
|
-
import type
|
|
14
|
+
import { Webhook, type WebhookInput } from "../structures/Webhook.js";
|
|
15
|
+
import { RequestClient, type RequestClientOptions } from "./RequestClient.js";
|
|
13
16
|
/**
|
|
14
17
|
* The options used for initializing the client
|
|
15
18
|
*/
|
|
@@ -28,8 +31,9 @@ export interface ClientOptions {
|
|
|
28
31
|
deploySecret?: string;
|
|
29
32
|
/**
|
|
30
33
|
* The public key of the app, used for interaction verification
|
|
34
|
+
* Can be a single key or an array of keys
|
|
31
35
|
*/
|
|
32
|
-
publicKey: string;
|
|
36
|
+
publicKey: string | string[];
|
|
33
37
|
/**
|
|
34
38
|
* The token of the bot
|
|
35
39
|
*/
|
|
@@ -43,12 +47,6 @@ export interface ClientOptions {
|
|
|
43
47
|
* @default false
|
|
44
48
|
*/
|
|
45
49
|
autoDeploy?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Whether components and modals should not be registered automatically.
|
|
48
|
-
* If you want you register components yourself (e.g. you are changing them at runtime), you can manually call {@link ComponentHandler#registerComponent} and {@link ModalHandler#registerModal} on the client.
|
|
49
|
-
* @default false
|
|
50
|
-
*/
|
|
51
|
-
disableAutoRegister?: boolean;
|
|
52
50
|
/**
|
|
53
51
|
* Whether the deploy route should be disabled.
|
|
54
52
|
* @default false
|
|
@@ -64,6 +62,11 @@ export interface ClientOptions {
|
|
|
64
62
|
* @default false
|
|
65
63
|
*/
|
|
66
64
|
disableEventsRoute?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* A list of guild IDs to deploy all commands to during development (guild command deployment is instant and rate-limited higher).
|
|
67
|
+
* If set, all commands will be deployed to these guilds instead of globally.
|
|
68
|
+
*/
|
|
69
|
+
devGuilds?: string[];
|
|
67
70
|
}
|
|
68
71
|
/**
|
|
69
72
|
* The main client used to interact with Discord
|
|
@@ -88,7 +91,11 @@ export declare class Client {
|
|
|
88
91
|
/**
|
|
89
92
|
* The event listeners that the client has registered
|
|
90
93
|
*/
|
|
91
|
-
listeners:
|
|
94
|
+
listeners: BaseListener[];
|
|
95
|
+
/**
|
|
96
|
+
* The components that the client has globally registered
|
|
97
|
+
*/
|
|
98
|
+
components: BaseMessageInteractiveComponent[];
|
|
92
99
|
/**
|
|
93
100
|
* The rest client used to interact with the Discord API
|
|
94
101
|
*/
|
|
@@ -113,15 +120,24 @@ export declare class Client {
|
|
|
113
120
|
* @internal
|
|
114
121
|
*/
|
|
115
122
|
eventHandler: EventHandler;
|
|
123
|
+
/**
|
|
124
|
+
* The ID of the shard this client is running on, if sharding is enabled
|
|
125
|
+
*/
|
|
126
|
+
shardId?: number;
|
|
127
|
+
/**
|
|
128
|
+
* The total number of shards, if sharding is enabled
|
|
129
|
+
*/
|
|
130
|
+
totalShards?: number;
|
|
116
131
|
/**
|
|
117
132
|
* Creates a new client
|
|
118
133
|
* @param options The options used to initialize the client
|
|
119
|
-
* @param
|
|
134
|
+
* @param handlers The handlers that the client has registered
|
|
120
135
|
* @param plugins The plugins that the client should use
|
|
121
136
|
*/
|
|
122
137
|
constructor(options: ClientOptions, handlers: {
|
|
123
138
|
commands?: BaseCommand[];
|
|
124
|
-
listeners?:
|
|
139
|
+
listeners?: BaseListener[];
|
|
140
|
+
components?: BaseMessageInteractiveComponent[];
|
|
125
141
|
}, plugins?: Plugin[]);
|
|
126
142
|
private appendRoutes;
|
|
127
143
|
/**
|
|
@@ -132,6 +148,7 @@ export declare class Client {
|
|
|
132
148
|
/**
|
|
133
149
|
* Handle an interaction request from Discord
|
|
134
150
|
* @param req The request to handle
|
|
151
|
+
* @param ctx The context for the request
|
|
135
152
|
* @returns A response
|
|
136
153
|
*/
|
|
137
154
|
handleEventsRequest(req: Request): Promise<Response>;
|
|
@@ -178,6 +195,19 @@ export declare class Client {
|
|
|
178
195
|
* @returns The member data
|
|
179
196
|
*/
|
|
180
197
|
fetchMember(guildId: string, id: string): Promise<GuildMember<false, true>>;
|
|
198
|
+
/**
|
|
199
|
+
* Fetch a message from the Discord API
|
|
200
|
+
* @param channelId The ID of the channel the message is in
|
|
201
|
+
* @param messageId The ID of the message to fetch
|
|
202
|
+
* @returns The message data
|
|
203
|
+
*/
|
|
204
|
+
fetchMessage(channelId: string, messageId: string): Promise<Message<false>>;
|
|
205
|
+
/**
|
|
206
|
+
* Fetch a webhook from the Discord API
|
|
207
|
+
* @param input The webhook data, ID and token, or webhook URL
|
|
208
|
+
* @returns The webhook data
|
|
209
|
+
*/
|
|
210
|
+
fetchWebhook(input: WebhookInput): Promise<Webhook<false>>;
|
|
181
211
|
}
|
|
182
212
|
/**
|
|
183
213
|
* @hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../../src/classes/Client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Client.d.ts","sourceRoot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E,OAAO;IAe7C;;;;;OAKG;IACU,yBAAyB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO;IAsCjE;;;OAGG;YACW,sBAAsB;IAiDpC;;;;OAIG;IACG,SAAS,CAAC,EAAE,EAAE,MAAM;IAK1B;;;;OAIG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM;IAK3B;;;;OAIG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM;IAK7B;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAK3C;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAO7C;;;;;OAKG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAOvD;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,YAAY;CAMtC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAEhC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACtC"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { RequestClient } from "@buape/carbon-request";
|
|
2
1
|
import { ApplicationWebhookType, InteractionResponseType, InteractionType, Routes } from "discord-api-types/v10";
|
|
3
|
-
import { channelFactory } from "../
|
|
2
|
+
import { channelFactory } from "../functions/channelFactory.js";
|
|
4
3
|
import { CommandHandler } from "../internals/CommandHandler.js";
|
|
5
4
|
import { ComponentHandler } from "../internals/ComponentHandler.js";
|
|
6
5
|
import { EventHandler } from "../internals/EventHandler.js";
|
|
7
6
|
import { ModalHandler } from "../internals/ModalHandler.js";
|
|
8
7
|
import { Guild } from "../structures/Guild.js";
|
|
9
8
|
import { GuildMember } from "../structures/GuildMember.js";
|
|
9
|
+
import { Message } from "../structures/Message.js";
|
|
10
10
|
import { Role } from "../structures/Role.js";
|
|
11
11
|
import { User } from "../structures/User.js";
|
|
12
|
-
import {
|
|
12
|
+
import { Webhook } from "../structures/Webhook.js";
|
|
13
|
+
import { concatUint8Arrays, subtleCrypto, valueToUint8Array } from "../utils/index.js";
|
|
14
|
+
import { RequestClient } from "./RequestClient.js";
|
|
13
15
|
/**
|
|
14
16
|
* The main client used to interact with Discord
|
|
15
17
|
*/
|
|
@@ -34,6 +36,10 @@ export class Client {
|
|
|
34
36
|
* The event listeners that the client has registered
|
|
35
37
|
*/
|
|
36
38
|
listeners = [];
|
|
39
|
+
/**
|
|
40
|
+
* The components that the client has globally registered
|
|
41
|
+
*/
|
|
42
|
+
components = [];
|
|
37
43
|
/**
|
|
38
44
|
* The rest client used to interact with the Discord API
|
|
39
45
|
*/
|
|
@@ -58,10 +64,18 @@ export class Client {
|
|
|
58
64
|
* @internal
|
|
59
65
|
*/
|
|
60
66
|
eventHandler;
|
|
67
|
+
/**
|
|
68
|
+
* The ID of the shard this client is running on, if sharding is enabled
|
|
69
|
+
*/
|
|
70
|
+
shardId;
|
|
71
|
+
/**
|
|
72
|
+
* The total number of shards, if sharding is enabled
|
|
73
|
+
*/
|
|
74
|
+
totalShards;
|
|
61
75
|
/**
|
|
62
76
|
* Creates a new client
|
|
63
77
|
* @param options The options used to initialize the client
|
|
64
|
-
* @param
|
|
78
|
+
* @param handlers The handlers that the client has registered
|
|
65
79
|
* @param plugins The plugins that the client should use
|
|
66
80
|
*/
|
|
67
81
|
constructor(options, handlers, plugins = []) {
|
|
@@ -76,12 +90,21 @@ export class Client {
|
|
|
76
90
|
this.options = options;
|
|
77
91
|
this.commands = handlers.commands ?? [];
|
|
78
92
|
this.listeners = handlers.listeners ?? [];
|
|
93
|
+
this.components = handlers.components ?? [];
|
|
79
94
|
// Remove trailing slashes from the base URL
|
|
80
95
|
options.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
81
96
|
this.commandHandler = new CommandHandler(this);
|
|
82
97
|
this.componentHandler = new ComponentHandler(this);
|
|
83
98
|
this.modalHandler = new ModalHandler(this);
|
|
84
99
|
this.eventHandler = new EventHandler(this);
|
|
100
|
+
for (const component of this.components) {
|
|
101
|
+
this.componentHandler.registerComponent(component);
|
|
102
|
+
}
|
|
103
|
+
for (const command of this.commands) {
|
|
104
|
+
for (const component of command.components ?? []) {
|
|
105
|
+
this.componentHandler.registerComponent(component);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
85
108
|
this.rest = new RequestClient(options.token, options.requestOptions);
|
|
86
109
|
this.appendRoutes();
|
|
87
110
|
for (const plugin of plugins) {
|
|
@@ -89,14 +112,6 @@ export class Client {
|
|
|
89
112
|
plugin.registerRoutes?.(this);
|
|
90
113
|
this.plugins.push(plugin);
|
|
91
114
|
}
|
|
92
|
-
if (!options.disableAutoRegister) {
|
|
93
|
-
for (const command of this.commands) {
|
|
94
|
-
for (const component of command.components)
|
|
95
|
-
this.componentHandler.registerComponent(new component());
|
|
96
|
-
for (const modal of command.modals)
|
|
97
|
-
this.modalHandler.registerModal(new modal());
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
115
|
if (options.autoDeploy) {
|
|
101
116
|
this.handleDeployRequest();
|
|
102
117
|
}
|
|
@@ -127,16 +142,41 @@ export class Client {
|
|
|
127
142
|
* @returns A response
|
|
128
143
|
*/
|
|
129
144
|
async handleDeployRequest() {
|
|
130
|
-
const commands = this.commands
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
const commands = this.commands.filter((c) => c.name !== "*");
|
|
146
|
+
const globalCommands = commands.filter((c) => !c.guildIds);
|
|
147
|
+
const guildCommandsMap = {};
|
|
148
|
+
for (const command of commands) {
|
|
149
|
+
if (command.guildIds) {
|
|
150
|
+
for (const guildId of command.guildIds) {
|
|
151
|
+
if (!guildCommandsMap[guildId])
|
|
152
|
+
guildCommandsMap[guildId] = [];
|
|
153
|
+
guildCommandsMap[guildId].push(command.serialize());
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// If devGuilds is set, deploy all commands to those guilds (for development)
|
|
158
|
+
if (this.options.devGuilds && this.options.devGuilds.length > 0) {
|
|
159
|
+
for (const guildId of this.options.devGuilds) {
|
|
160
|
+
await this.rest.put(Routes.applicationGuildCommands(this.options.clientId, guildId), { body: commands.map((c) => c.serialize()) });
|
|
161
|
+
}
|
|
162
|
+
return new Response("OK (devGuilds)", { status: 202 });
|
|
163
|
+
}
|
|
164
|
+
// Deploy guild-specific commands
|
|
165
|
+
for (const [guildId, cmds] of Object.entries(guildCommandsMap)) {
|
|
166
|
+
await this.rest.put(Routes.applicationGuildCommands(this.options.clientId, guildId), { body: cmds });
|
|
167
|
+
}
|
|
168
|
+
// Deploy global commands
|
|
169
|
+
if (globalCommands.length > 0) {
|
|
170
|
+
await this.rest.put(Routes.applicationCommands(this.options.clientId), {
|
|
171
|
+
body: globalCommands.map((c) => c.serialize())
|
|
172
|
+
});
|
|
173
|
+
}
|
|
135
174
|
return new Response("OK", { status: 202 });
|
|
136
175
|
}
|
|
137
176
|
/**
|
|
138
177
|
* Handle an interaction request from Discord
|
|
139
178
|
* @param req The request to handle
|
|
179
|
+
* @param ctx The context for the request
|
|
140
180
|
* @returns A response
|
|
141
181
|
*/
|
|
142
182
|
async handleEventsRequest(req) {
|
|
@@ -147,7 +187,7 @@ export class Client {
|
|
|
147
187
|
// All ping webhooks should respond with 204 and an empty body
|
|
148
188
|
if (payload.type === ApplicationWebhookType.Ping)
|
|
149
189
|
return new Response(null, { status: 204 });
|
|
150
|
-
this.eventHandler.handleEvent(payload);
|
|
190
|
+
this.eventHandler.handleEvent(payload.event.data, payload.event.type);
|
|
151
191
|
return new Response(null, { status: 204 });
|
|
152
192
|
}
|
|
153
193
|
/**
|
|
@@ -208,13 +248,27 @@ export class Client {
|
|
|
208
248
|
const timestampData = valueToUint8Array(timestamp);
|
|
209
249
|
const bodyData = valueToUint8Array(body);
|
|
210
250
|
const message = concatUint8Arrays(timestampData, bodyData);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
251
|
+
// Convert single key to array for consistent handling
|
|
252
|
+
const publicKeys = Array.isArray(this.options.publicKey)
|
|
253
|
+
? this.options.publicKey
|
|
254
|
+
: [this.options.publicKey];
|
|
255
|
+
// Try each public key until one works
|
|
256
|
+
for (const publicKey of publicKeys) {
|
|
257
|
+
try {
|
|
258
|
+
const isValid = await subtleCrypto.verify({
|
|
259
|
+
name: "ed25519"
|
|
260
|
+
}, await subtleCrypto.importKey("raw", valueToUint8Array(publicKey, "hex"), {
|
|
261
|
+
name: "ed25519",
|
|
262
|
+
namedCurve: "ed25519"
|
|
263
|
+
}, false, ["verify"]), valueToUint8Array(signature, "hex"), message);
|
|
264
|
+
if (isValid)
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
// Skip to next key if this one fails
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
218
272
|
}
|
|
219
273
|
catch (_) {
|
|
220
274
|
return false;
|
|
@@ -267,5 +321,24 @@ export class Client {
|
|
|
267
321
|
const member = (await this.rest.get(Routes.guildMember(guildId, id)));
|
|
268
322
|
return new GuildMember(this, member, new Guild(this, guildId));
|
|
269
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* Fetch a message from the Discord API
|
|
326
|
+
* @param channelId The ID of the channel the message is in
|
|
327
|
+
* @param messageId The ID of the message to fetch
|
|
328
|
+
* @returns The message data
|
|
329
|
+
*/
|
|
330
|
+
async fetchMessage(channelId, messageId) {
|
|
331
|
+
const message = (await this.rest.get(Routes.channelMessage(channelId, messageId)));
|
|
332
|
+
return new Message(this, message);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Fetch a webhook from the Discord API
|
|
336
|
+
* @param input The webhook data, ID and token, or webhook URL
|
|
337
|
+
* @returns The webhook data
|
|
338
|
+
*/
|
|
339
|
+
async fetchWebhook(input) {
|
|
340
|
+
const webhook = new Webhook(this, input);
|
|
341
|
+
return webhook.fetch();
|
|
342
|
+
}
|
|
270
343
|
}
|
|
271
344
|
//# sourceMappingURL=Client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../src/classes/Client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../src/classes/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EASN,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,MAAM,EACN,MAAM,uBAAuB,CAAA;AAK9B,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAqB,MAAM,0BAA0B,CAAA;AACrE,OAAO,EACN,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,aAAa,EAA6B,MAAM,oBAAoB,CAAA;AA4D7E;;GAEG;AACH,MAAM,OAAO,MAAM;IAClB;;OAEG;IACH,MAAM,GAAY,EAAE,CAAA;IACpB;;OAEG;IACH,OAAO,GAAa,EAAE,CAAA;IACtB;;OAEG;IACH,OAAO,CAAe;IACtB;;OAEG;IACH,QA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AW,CAAC,OAAe,EAAE,EAAU;QAC5C,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAClC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAC/B,CAAmB,CAAA;QACpB,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,KAAK,CAAO,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IACrE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,SAAiB,EAAE,SAAiB;QACtD,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CACnC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAC3C,CAAe,CAAA;QAChB,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,KAAmB;QACrC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxC,OAAO,OAAO,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;CAGD"}
|
|
@@ -18,16 +18,24 @@ export declare abstract class Command extends BaseCommand {
|
|
|
18
18
|
* The function that is called when the command is ran
|
|
19
19
|
* @param interaction The interaction that triggered the command
|
|
20
20
|
*/
|
|
21
|
-
abstract run(interaction: CommandInteraction): Promise<
|
|
21
|
+
abstract run(interaction: CommandInteraction): unknown | Promise<unknown>;
|
|
22
22
|
/**
|
|
23
23
|
* The function that is called when the command's autocomplete is triggered.
|
|
24
24
|
* @param interaction The interaction that triggered the autocomplete
|
|
25
25
|
* @remarks You are expected to `override` this function to provide your own autocomplete functionality.
|
|
26
26
|
*/
|
|
27
27
|
autocomplete(interaction: AutocompleteInteraction): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* The function that is called before the command is ran.
|
|
30
|
+
* You can use this to run things such as cooldown checks, extra permission checks, etc.
|
|
31
|
+
* If this returns anything other than `true`, the command will not run.
|
|
32
|
+
* @param interaction The interaction that triggered the command
|
|
33
|
+
* @returns Whether the command should continue to run
|
|
34
|
+
*/
|
|
35
|
+
preCheck(interaction: CommandInteraction): Promise<true | unknown>;
|
|
28
36
|
/**
|
|
29
37
|
* @internal
|
|
30
38
|
*/
|
|
31
|
-
serializeOptions():
|
|
39
|
+
serializeOptions(): APIApplicationCommandBasicOption[] | undefined;
|
|
32
40
|
}
|
|
33
41
|
//# sourceMappingURL=Command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../../src/classes/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gCAAgC,EACrC,sBAAsB,EACtB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../../src/classes/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gCAAgC,EACrC,sBAAsB,EACtB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACN,KAAK,uBAAuB,EAC5B,WAAW,EACX,KAAK,kBAAkB,EACvB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,cAAc,GAAG,gCAAgC,EAAE,CAAA;AAE/D;;GAEG;AACH,8BAAsB,OAAQ,SAAQ,WAAW;IAChD;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IAExB;;;OAGG;IACH,IAAI,EAAE,sBAAsB,CAAmC;IAE/D;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAEzE;;;;OAIG;IACU,YAAY,CACxB,WAAW,EAAE,uBAAuB,GAClC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;;OAMG;IACU,QAAQ,CACpB,WAAW,EAAE,kBAAkB,GAC7B,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;IAI1B;;OAEG;IACH,gBAAgB;CAGhB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApplicationCommandType } from "discord-api-types/v10";
|
|
2
|
+
import { enforceChoicesLimit } from "../functions/enforceChoicesLimit.js";
|
|
2
3
|
import { BaseCommand } from "../index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Represents a standard command that the user creates
|
|
@@ -21,11 +22,21 @@ export class Command extends BaseCommand {
|
|
|
21
22
|
async autocomplete(interaction) {
|
|
22
23
|
throw new Error(`The ${interaction.rawData.data.name} command does not support autocomplete`);
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The function that is called before the command is ran.
|
|
27
|
+
* You can use this to run things such as cooldown checks, extra permission checks, etc.
|
|
28
|
+
* If this returns anything other than `true`, the command will not run.
|
|
29
|
+
* @param interaction The interaction that triggered the command
|
|
30
|
+
* @returns Whether the command should continue to run
|
|
31
|
+
*/
|
|
32
|
+
async preCheck(interaction) {
|
|
33
|
+
return !!interaction;
|
|
34
|
+
}
|
|
24
35
|
/**
|
|
25
36
|
* @internal
|
|
26
37
|
*/
|
|
27
38
|
serializeOptions() {
|
|
28
|
-
return this.options;
|
|
39
|
+
return enforceChoicesLimit(this.options);
|
|
29
40
|
}
|
|
30
41
|
}
|
|
31
42
|
//# sourceMappingURL=Command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../../src/classes/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,sBAAsB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAEN,WAAW,EAEX,MAAM,aAAa,CAAA;AAIpB;;GAEG;AACH,MAAM,OAAgB,OAAQ,SAAQ,WAAW;IAChD;;OAEG;IACH,OAAO,CAAiB;IAExB;;;OAGG;IACH,IAAI,GAA2B,sBAAsB,CAAC,SAAS,CAAA;IAQ/D;;;;OAIG;IACI,KAAK,CAAC,YAAY,CACxB,WAAoC;QAEpC,MAAM,IAAI,KAAK,CACd,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,wCAAwC,CAC5E,CAAA;IACF,CAAC;IAED;;OAEG;IACH,gBAAgB;QACf,OAAO,IAAI,CAAC,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../../src/classes/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,sBAAsB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAEN,WAAW,EAEX,MAAM,aAAa,CAAA;AAIpB;;GAEG;AACH,MAAM,OAAgB,OAAQ,SAAQ,WAAW;IAChD;;OAEG;IACH,OAAO,CAAiB;IAExB;;;OAGG;IACH,IAAI,GAA2B,sBAAsB,CAAC,SAAS,CAAA;IAQ/D;;;;OAIG;IACI,KAAK,CAAC,YAAY,CACxB,WAAoC;QAEpC,MAAM,IAAI,KAAK,CACd,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,wCAAwC,CAC5E,CAAA;IACF,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,QAAQ,CACpB,WAA+B;QAE/B,OAAO,CAAC,CAAC,WAAW,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,gBAAgB;QACf,OAAO,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;CACD"}
|