@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,38 +1,8 @@
|
|
|
1
1
|
import { type APIInteraction, type InteractionType } from "discord-api-types/v10";
|
|
2
|
-
import {
|
|
2
|
+
import { type Client, Embed, Guild, Message, type Modal, User } from "../index.js";
|
|
3
3
|
import { GuildMember } from "../structures/GuildMember.js";
|
|
4
|
-
import type { MessagePayload } from "../types.js";
|
|
5
|
-
|
|
6
|
-
* Additional options for replying to an interaction
|
|
7
|
-
*/
|
|
8
|
-
export type InteractionReplyOptions = {
|
|
9
|
-
/**
|
|
10
|
-
* The files to send in the interaction
|
|
11
|
-
*/
|
|
12
|
-
files?: InteractionFileData[];
|
|
13
|
-
/**
|
|
14
|
-
* Whether the interaction should be ephemeral
|
|
15
|
-
*/
|
|
16
|
-
ephemeral?: boolean;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The data for a file to send in an interaction
|
|
20
|
-
*/
|
|
21
|
-
export type InteractionFileData = {
|
|
22
|
-
/**
|
|
23
|
-
* The name of the file that will be given to Discord
|
|
24
|
-
*/
|
|
25
|
-
name: string;
|
|
26
|
-
/**
|
|
27
|
-
* The data of the file in a Blob
|
|
28
|
-
*/
|
|
29
|
-
data: Blob;
|
|
30
|
-
/**
|
|
31
|
-
* The alt text of the file, shown for accessibility
|
|
32
|
-
* @alpha This isn't implemented yet
|
|
33
|
-
*/
|
|
34
|
-
description?: string;
|
|
35
|
-
};
|
|
4
|
+
import type { MessagePayload } from "../types/index.js";
|
|
5
|
+
import { Base } from "./Base.js";
|
|
36
6
|
export type InteractionDefaults = {
|
|
37
7
|
ephemeral?: boolean;
|
|
38
8
|
};
|
|
@@ -65,12 +35,22 @@ export declare abstract class BaseInteraction<T extends APIInteraction> extends
|
|
|
65
35
|
get user(): User | null;
|
|
66
36
|
get channel(): import("../index.js").DmChannel<false> | import("../index.js").GroupDmChannel<false> | import("../index.js").GuildTextChannel<false> | import("../index.js").GuildVoiceChannel<false> | import("../index.js").GuildCategoryChannel<false> | import("../index.js").GuildAnnouncementChannel<false> | import("../index.js").GuildThreadChannel<import("discord-api-types/v10").ThreadChannelType, false> | import("../index.js").GuildStageChannel<false> | import("../index.js").GuildForumChannel<false> | import("../index.js").GuildMediaChannel | null;
|
|
67
37
|
get member(): GuildMember<false, true> | null;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
* Automatically register components found in a message payload when sending the message.
|
|
41
|
+
*/
|
|
42
|
+
private _internalAutoRegisterComponentsOnSend;
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
* Register components found in a message payload when sending the message.
|
|
46
|
+
*/
|
|
47
|
+
private _internalRegisterComponentsOnSend;
|
|
68
48
|
/**
|
|
69
49
|
* Reply to an interaction.
|
|
70
50
|
* If the interaction is deferred, this will edit the original response.
|
|
71
|
-
* @param data The
|
|
51
|
+
* @param data The message data to send
|
|
72
52
|
*/
|
|
73
|
-
reply(data: MessagePayload,
|
|
53
|
+
reply(data: MessagePayload, overrideAutoRegister?: boolean): Promise<Message<false>>;
|
|
74
54
|
/**
|
|
75
55
|
* Defer the interaction response. This is used automatically by commands that are set to defer.
|
|
76
56
|
* If the interaction is already deferred, this will do nothing.
|
|
@@ -87,6 +67,39 @@ export declare abstract class BaseInteraction<T extends APIInteraction> extends
|
|
|
87
67
|
/**
|
|
88
68
|
* Send a followup message to the interaction
|
|
89
69
|
*/
|
|
90
|
-
followUp(reply: MessagePayload
|
|
70
|
+
followUp(reply: MessagePayload): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* This function will reply to the interaction and wait for a component to be pressed.
|
|
73
|
+
* Any components passed in the message will not have run() functions called and
|
|
74
|
+
* will only trigger the interaction.acknowledge() function.
|
|
75
|
+
* This function will also return a promise that resolves
|
|
76
|
+
* to the custom ID of the component that was pressed.
|
|
77
|
+
*
|
|
78
|
+
* @param data The message data to send
|
|
79
|
+
* @param timeout After this many milliseconds, the promise will resolve to null
|
|
80
|
+
*/
|
|
81
|
+
replyAndWaitForComponent(data: MessagePayload, timeout?: number): Promise<{
|
|
82
|
+
/**
|
|
83
|
+
* Whether the interaction was successful
|
|
84
|
+
*/
|
|
85
|
+
success: true;
|
|
86
|
+
/**
|
|
87
|
+
* The custom ID of the component that was pressed
|
|
88
|
+
*/
|
|
89
|
+
customId: string;
|
|
90
|
+
/**
|
|
91
|
+
* If this is a select menu, this will be the values of the selected options
|
|
92
|
+
*/
|
|
93
|
+
values?: string[];
|
|
94
|
+
} | {
|
|
95
|
+
/**
|
|
96
|
+
* Whether the interaction was successful
|
|
97
|
+
*/
|
|
98
|
+
success: false;
|
|
99
|
+
/**
|
|
100
|
+
* The reason the interaction failed
|
|
101
|
+
*/
|
|
102
|
+
reason: "timed out";
|
|
103
|
+
}>;
|
|
91
104
|
}
|
|
92
105
|
//# sourceMappingURL=BaseInteraction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"BaseInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,cAAc,EAGnB,KAAK,eAAe,EAOpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAEN,KAAK,MAAM,EAEX,KAAK,EACL,KAAK,EACL,OAAO,EACP,KAAK,KAAK,EAGV,IAAI,EAEJ,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAA;AAE3E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,MAAM,mBAAmB,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KAChB,GACD;QACA;;WAEG;QACH,OAAO,EAAE,KAAK,CAAA;QACd;;WAEG;QACH,MAAM,EAAE,WAAW,CAAA;KAClB,CACH;CAuBD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { InteractionResponseType, MessageFlags, Routes } from "discord-api-types/v10";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseMessageInteractiveComponent, Container, Embed, Guild, Message, Row, Section, User, channelFactory } from "../index.js";
|
|
3
3
|
import { GuildMember } from "../structures/GuildMember.js";
|
|
4
|
-
import { serializePayload } from "../utils.js";
|
|
4
|
+
import { serializePayload } from "../utils/index.js";
|
|
5
|
+
import { Base } from "./Base.js";
|
|
5
6
|
/**
|
|
6
7
|
* This is the base type interaction, all interaction types extend from this
|
|
7
8
|
*/
|
|
@@ -67,36 +68,73 @@ export class BaseInteraction extends Base {
|
|
|
67
68
|
return null;
|
|
68
69
|
return new GuildMember(this.client, this.rawData.member, this.guild);
|
|
69
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
* Automatically register components found in a message payload when sending the message.
|
|
74
|
+
*/
|
|
75
|
+
_internalAutoRegisterComponentsOnSend(data) {
|
|
76
|
+
if (typeof data !== "string" && data.components) {
|
|
77
|
+
this._internalRegisterComponentsOnSend(data.components);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
* Register components found in a message payload when sending the message.
|
|
83
|
+
*/
|
|
84
|
+
_internalRegisterComponentsOnSend(components) {
|
|
85
|
+
for (const component of components) {
|
|
86
|
+
if (component instanceof Row) {
|
|
87
|
+
for (const childComponent of component.components) {
|
|
88
|
+
if (childComponent instanceof BaseMessageInteractiveComponent) {
|
|
89
|
+
const key = childComponent.customIdParser(childComponent.customId).key;
|
|
90
|
+
const existingComponent = this.client.componentHandler.components.find((comp) => comp.customIdParser(comp.customId).key === key);
|
|
91
|
+
if (!existingComponent) {
|
|
92
|
+
this.client.componentHandler.registerComponent(childComponent);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (component instanceof Section) {
|
|
98
|
+
if (component.accessory instanceof BaseMessageInteractiveComponent) {
|
|
99
|
+
const key = component.accessory.customIdParser(component.accessory.customId).key;
|
|
100
|
+
const existingComponent = this.client.componentHandler.components.find((comp) => comp.customIdParser(comp.customId).key === key);
|
|
101
|
+
if (!existingComponent) {
|
|
102
|
+
this.client.componentHandler.registerComponent(component.accessory);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else if (component instanceof Container) {
|
|
107
|
+
this._internalRegisterComponentsOnSend(component.components);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
70
111
|
/**
|
|
71
112
|
* Reply to an interaction.
|
|
72
113
|
* If the interaction is deferred, this will edit the original response.
|
|
73
|
-
* @param data The
|
|
114
|
+
* @param data The message data to send
|
|
74
115
|
*/
|
|
75
|
-
async reply(data,
|
|
76
|
-
const serialized = serializePayload(data);
|
|
116
|
+
async reply(data, overrideAutoRegister = false) {
|
|
117
|
+
const serialized = serializePayload(data, this.defaultEphemeral);
|
|
118
|
+
// Auto-register any components in the message
|
|
119
|
+
if (!overrideAutoRegister)
|
|
120
|
+
this._internalAutoRegisterComponentsOnSend(data);
|
|
77
121
|
if (this._deferred) {
|
|
78
|
-
await this.client.rest.patch(Routes.webhookMessage(this.client.options.clientId, this.rawData.token, "@original"), {
|
|
79
|
-
body:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
files: options.files
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
|
|
87
|
-
body: {
|
|
88
|
-
type: InteractionResponseType.ChannelMessageWithSource,
|
|
89
|
-
data: {
|
|
90
|
-
...serialized,
|
|
91
|
-
flags: options.ephemeral || this.defaultEphemeral
|
|
92
|
-
? MessageFlags.Ephemeral |
|
|
93
|
-
("flags" in serialized ? (serialized.flags ?? 0) : 0)
|
|
94
|
-
: undefined
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
files: options.files
|
|
98
|
-
});
|
|
122
|
+
const message = (await this.client.rest.patch(Routes.webhookMessage(this.client.options.clientId, this.rawData.token, "@original"), {
|
|
123
|
+
body: serialized
|
|
124
|
+
}));
|
|
125
|
+
return new Message(this.client, message);
|
|
99
126
|
}
|
|
127
|
+
const done = (await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
|
|
128
|
+
body: {
|
|
129
|
+
type: InteractionResponseType.ChannelMessageWithSource,
|
|
130
|
+
data: serialized
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
with_response: true
|
|
134
|
+
}));
|
|
135
|
+
if (!done.resource?.message)
|
|
136
|
+
throw new Error(`No resource returned for message from interaction callback: ${done.resource}`);
|
|
137
|
+
return new Message(this.client, done.resource.message);
|
|
100
138
|
}
|
|
101
139
|
/**
|
|
102
140
|
* Defer the interaction response. This is used automatically by commands that are set to defer.
|
|
@@ -125,6 +163,11 @@ export class BaseInteraction extends Base {
|
|
|
125
163
|
async showModal(modal) {
|
|
126
164
|
if (this._deferred)
|
|
127
165
|
throw new Error("You cannot defer an interaction that shows a modal");
|
|
166
|
+
const key = modal.customIdParser(modal.customId).key;
|
|
167
|
+
const existingModal = this.client.modalHandler.modals.find((m) => m.customIdParser(m.customId).key === key);
|
|
168
|
+
if (!existingModal) {
|
|
169
|
+
this.client.modalHandler.registerModal(modal);
|
|
170
|
+
}
|
|
128
171
|
await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
|
|
129
172
|
body: {
|
|
130
173
|
type: InteractionResponseType.Modal,
|
|
@@ -135,17 +178,45 @@ export class BaseInteraction extends Base {
|
|
|
135
178
|
/**
|
|
136
179
|
* Send a followup message to the interaction
|
|
137
180
|
*/
|
|
138
|
-
async followUp(reply
|
|
181
|
+
async followUp(reply) {
|
|
139
182
|
const serialized = serializePayload(reply);
|
|
183
|
+
// Auto-register any components in the message
|
|
184
|
+
this._internalAutoRegisterComponentsOnSend(reply);
|
|
140
185
|
await this.client.rest.post(Routes.webhook(this.client.options.clientId, this.rawData.token), {
|
|
141
186
|
body: {
|
|
142
|
-
...serialized
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
187
|
+
...serialized
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* This function will reply to the interaction and wait for a component to be pressed.
|
|
193
|
+
* Any components passed in the message will not have run() functions called and
|
|
194
|
+
* will only trigger the interaction.acknowledge() function.
|
|
195
|
+
* This function will also return a promise that resolves
|
|
196
|
+
* to the custom ID of the component that was pressed.
|
|
197
|
+
*
|
|
198
|
+
* @param data The message data to send
|
|
199
|
+
* @param timeout After this many milliseconds, the promise will resolve to null
|
|
200
|
+
*/
|
|
201
|
+
async replyAndWaitForComponent(data, timeout = 300000) {
|
|
202
|
+
const message = await this.reply(data, true);
|
|
203
|
+
const id = `${message.id}-${message.channelId}`;
|
|
204
|
+
return new Promise((resolve) => {
|
|
205
|
+
const timer = setTimeout(() => {
|
|
206
|
+
this.client.componentHandler.oneOffComponents.delete(id);
|
|
207
|
+
resolve({ success: false, reason: "timed out" });
|
|
208
|
+
}, timeout);
|
|
209
|
+
this.client.componentHandler.oneOffComponents.set(id, {
|
|
210
|
+
resolve: (data) => {
|
|
211
|
+
clearTimeout(timer);
|
|
212
|
+
this.client.componentHandler.oneOffComponents.delete(id);
|
|
213
|
+
resolve({
|
|
214
|
+
success: true,
|
|
215
|
+
customId: data.custom_id,
|
|
216
|
+
values: "values" in data ? data.values : undefined
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
});
|
|
149
220
|
});
|
|
150
221
|
}
|
|
151
222
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,uBAAuB,EAEvB,YAAY,EAKZ,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,+BAA+B,EAE/B,SAAS,EACT,KAAK,EACL,KAAK,EACL,OAAO,EAEP,GAAG,EACH,OAAO,EACP,IAAI,EACJ,cAAc,EACd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAMhC;;GAEG;AACH,MAAM,OAAgB,eAA0C,SAAQ,IAAI;IAC3E;;OAEG;IACH,IAAI,CAAiB;IACrB;;OAEG;IACH,OAAO,CAAG;IACV;;OAEG;IACH,MAAM,CAAoB;IAE1B;;;OAGG;IACH,SAAS,GAAG,KAAK,CAAA;IAET,gBAAgB,GAAG,KAAK,CAAA;IAEhC,YAAY,MAAc,EAAE,IAAO,EAAE,QAA6B;QACjE,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,MAAM;YACV,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,SAAS,CAAA;QACnE,IAAI,QAAQ,CAAC,SAAS;YAAE,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,SAAS,CAAA;IACnE,CAAC;IAED,IAAI,MAAM;QACT,IAAI,CAAC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B,EACpB,OAAO,GAAG,MAAM;QA2BhB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAE5C,MAAM,EAAE,GAA0B,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,SAAS,EAAE,CAAA;QAEtE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC7B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;gBACxD,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAA;YACjD,CAAC,EAAE,OAAO,CAAC,CAAA;YACX,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE;gBACrD,OAAO,EAAE,CAAC,IAAwC,EAAE,EAAE;oBACrD,YAAY,CAAC,KAAK,CAAC,CAAA;oBACnB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;oBACxD,OAAO,CAAC;wBACP,OAAO,EAAE,IAAI;wBACb,QAAQ,EAAE,IAAI,CAAC,SAAS;wBACxB,MAAM,EAAE,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;qBAClD,CAAC,CAAA;gBACH,CAAC;aACD,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;CACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Client } from "../classes/Client.js";
|
|
2
|
+
import type { ListenerEventData, ListenerEventRawData, ListenerEventType } from "../types/listeners.js";
|
|
3
|
+
/**
|
|
4
|
+
* Base class for creating event listeners that handle Discord gateway events.
|
|
5
|
+
* This abstract class defines the structure for event listeners and provides type safety for event handling.
|
|
6
|
+
* @abstract
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class BaseListener {
|
|
9
|
+
abstract readonly type: ListenerEventType;
|
|
10
|
+
abstract handle(data: ListenerEventData[this["type"]], client: Client): Promise<void>;
|
|
11
|
+
abstract parseRawData(data: ListenerEventRawData[this["type"]], client: Client): ListenerEventData[this["type"]];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=BaseListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseListener.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseListener.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EACX,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;;;GAIG;AACH,8BAAsB,YAAY;IACjC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IACzC,QAAQ,CAAC,MAAM,CACd,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EACrC,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAEhB,QAAQ,CAAC,YAAY,CACpB,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EACxC,MAAM,EAAE,MAAM,GACZ,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for creating event listeners that handle Discord gateway events.
|
|
3
|
+
* This abstract class defines the structure for event listeners and provides type safety for event handling.
|
|
4
|
+
* @abstract
|
|
5
|
+
*/
|
|
6
|
+
export class BaseListener {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=BaseListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseListener.js","sourceRoot":"","sources":["../../../src/abstracts/BaseListener.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,OAAgB,YAAY;CAWjC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { APIComponentInMessageActionRow, ComponentType } from "discord-api-types/v10";
|
|
2
|
+
import type { ComponentData, ComponentParserResult } from "../types/index.js";
|
|
3
|
+
import { BaseComponent } from "./BaseComponent.js";
|
|
4
|
+
import type { BaseComponentInteraction } from "./BaseComponentInteraction.js";
|
|
5
|
+
export declare abstract class BaseMessageInteractiveComponent extends BaseComponent {
|
|
6
|
+
abstract type: ComponentType.Button | ComponentType.StringSelect | ComponentType.TextInput | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect;
|
|
7
|
+
readonly isV2 = false;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the component response should be automatically deferred
|
|
10
|
+
*/
|
|
11
|
+
defer: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the component response should be ephemeral
|
|
14
|
+
*/
|
|
15
|
+
ephemeral: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The custom ID of the component.
|
|
18
|
+
* If you want to provide a custom ID with additional data, you should either follow the default parser's format or implement your own custom parser.
|
|
19
|
+
*
|
|
20
|
+
* @see {@link customIdParser}
|
|
21
|
+
*/
|
|
22
|
+
abstract customId: string;
|
|
23
|
+
/**
|
|
24
|
+
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
25
|
+
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
26
|
+
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
27
|
+
*
|
|
28
|
+
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
29
|
+
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
30
|
+
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
31
|
+
*
|
|
32
|
+
* @param id - The custom ID of the component as received from an interaction event
|
|
33
|
+
* @returns The base key and the data object
|
|
34
|
+
*/
|
|
35
|
+
customIdParser: (id: string) => ComponentParserResult;
|
|
36
|
+
abstract serialize: () => APIComponentInMessageActionRow;
|
|
37
|
+
run(interaction: BaseComponentInteraction, data: ComponentData): unknown | Promise<unknown>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=BaseMessageInteractiveComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMessageInteractiveComponent.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseMessageInteractiveComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,8BAA8B,EAC9B,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE7E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAE7E,8BAAsB,+BAAgC,SAAQ,aAAa;IAC1E,QAAQ,CAAC,IAAI,EACV,aAAa,CAAC,MAAM,GACpB,aAAa,CAAC,YAAY,GAC1B,aAAa,CAAC,SAAS,GACvB,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,iBAAiB,GAC/B,aAAa,CAAC,aAAa,CAAA;IAE9B,QAAQ,CAAC,IAAI,SAAQ;IAErB;;OAEG;IACH,KAAK,UAAQ;IACb;;OAEG;IACH,SAAS,UAAQ;IAEjB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,qBAAqB,CAAgB;IAErE,QAAQ,CAAC,SAAS,EAAE,MAAM,8BAA8B,CAAA;IAExD,GAAG,CACF,WAAW,EAAE,wBAAwB,EACrC,IAAI,EAAE,aAAa,GACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAM7B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { parseCustomId } from "../utils/customIdParser.js";
|
|
2
|
+
import { BaseComponent } from "./BaseComponent.js";
|
|
3
|
+
export class BaseMessageInteractiveComponent extends BaseComponent {
|
|
4
|
+
isV2 = false;
|
|
5
|
+
/**
|
|
6
|
+
* Whether the component response should be automatically deferred
|
|
7
|
+
*/
|
|
8
|
+
defer = false;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the component response should be ephemeral
|
|
11
|
+
*/
|
|
12
|
+
ephemeral = false;
|
|
13
|
+
/**
|
|
14
|
+
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
15
|
+
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
16
|
+
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
17
|
+
*
|
|
18
|
+
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
19
|
+
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
20
|
+
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
21
|
+
*
|
|
22
|
+
* @param id - The custom ID of the component as received from an interaction event
|
|
23
|
+
* @returns The base key and the data object
|
|
24
|
+
*/
|
|
25
|
+
customIdParser = parseCustomId;
|
|
26
|
+
run(interaction, data) {
|
|
27
|
+
// Random things to show the vars as used
|
|
28
|
+
typeof interaction === "string";
|
|
29
|
+
typeof data === "string";
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=BaseMessageInteractiveComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMessageInteractiveComponent.js","sourceRoot":"","sources":["../../../src/abstracts/BaseMessageInteractiveComponent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,MAAM,OAAgB,+BAAgC,SAAQ,aAAa;IAUjE,IAAI,GAAG,KAAK,CAAA;IAErB;;OAEG;IACH,KAAK,GAAG,KAAK,CAAA;IACb;;OAEG;IACH,SAAS,GAAG,KAAK,CAAA;IAUjB;;;;;;;;;;;OAWG;IACH,cAAc,GAA0C,aAAa,CAAA;IAIrE,GAAG,CACF,WAAqC,EACrC,IAAmB;QAEnB,yCAAyC;QACzC,OAAO,WAAW,KAAK,QAAQ,CAAA;QAC/B,OAAO,IAAI,KAAK,QAAQ,CAAA;QACxB,OAAM;IACP,CAAC;CACD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { APIComponentInModalActionRow, ComponentType } from "discord-api-types/v10";
|
|
2
|
+
import type { ComponentParserResult } from "../types/index.js";
|
|
3
|
+
import { BaseComponent } from "./BaseComponent.js";
|
|
4
|
+
export declare abstract class BaseModalComponent extends BaseComponent {
|
|
5
|
+
abstract type: ComponentType.TextInput;
|
|
6
|
+
readonly isV2 = false;
|
|
7
|
+
/**
|
|
8
|
+
* The custom ID of the component.
|
|
9
|
+
* If you want to provide a custom ID with additional data, you should either follow the default parser's format or implement your own custom parser.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link customIdParser}
|
|
12
|
+
*/
|
|
13
|
+
abstract customId: string;
|
|
14
|
+
/**
|
|
15
|
+
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
16
|
+
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
17
|
+
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
18
|
+
*
|
|
19
|
+
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
20
|
+
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
21
|
+
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
22
|
+
*
|
|
23
|
+
* @param id - The custom ID of the component as received from an interaction event
|
|
24
|
+
* @returns The base key and the data object
|
|
25
|
+
*/
|
|
26
|
+
customIdParser: (id: string) => ComponentParserResult;
|
|
27
|
+
abstract serialize: () => APIComponentInModalActionRow;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=BaseModalComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseModalComponent.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseModalComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,4BAA4B,EAC5B,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,8BAAsB,kBAAmB,SAAQ,aAAa;IAC7D,SAAkB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAA;IAE/C,QAAQ,CAAC,IAAI,SAAQ;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,qBAAqB,CAcpD;IAED,QAAQ,CAAC,SAAS,EAAE,MAAM,4BAA4B,CAAA;CACtD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseComponent } from "./BaseComponent.js";
|
|
2
|
+
export class BaseModalComponent extends BaseComponent {
|
|
3
|
+
isV2 = false;
|
|
4
|
+
/**
|
|
5
|
+
* This function is called by the handler when a component is received, and is used to parse the custom ID into a key and data object.
|
|
6
|
+
* By default, the ID is parsed in this format: `key:arg1=true;arg2=2;arg3=cheese`, where `arg1`, `arg2`, and `arg3` are the data arguments.
|
|
7
|
+
* It will also automatically parse `true` and `false` as booleans, and will parse numbers as numbers.
|
|
8
|
+
*
|
|
9
|
+
* You can override this to parse the ID in a different format as you see fit, but it must follow these rules:
|
|
10
|
+
* - The ID must have a `key` somewhere in the ID that can be returned by the parser. This key is what Carbon's component handler will use to identify the component and pass an interaction to the correct component.
|
|
11
|
+
* - The data must be able to be arbitrary as far as Carbon's handler is concerned, meaning that any component with the same base key can be treated as the same component with logic within the component's logic methods to handle the data.
|
|
12
|
+
*
|
|
13
|
+
* @param id - The custom ID of the component as received from an interaction event
|
|
14
|
+
* @returns The base key and the data object
|
|
15
|
+
*/
|
|
16
|
+
customIdParser = (id) => {
|
|
17
|
+
const [key, ...data] = id.split(":");
|
|
18
|
+
if (!key)
|
|
19
|
+
throw new Error(`Invalid component ID: ${id}`);
|
|
20
|
+
return {
|
|
21
|
+
key,
|
|
22
|
+
data: Object.fromEntries(data.map((d) => {
|
|
23
|
+
const [k, v] = d.split("=");
|
|
24
|
+
if (v === "true")
|
|
25
|
+
return [k, true];
|
|
26
|
+
if (v === "false")
|
|
27
|
+
return [k, false];
|
|
28
|
+
return [k, Number.isNaN(Number(v)) ? v : Number(v)];
|
|
29
|
+
}))
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=BaseModalComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseModalComponent.js","sourceRoot":"","sources":["../../../src/abstracts/BaseModalComponent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,MAAM,OAAgB,kBAAmB,SAAQ,aAAa;IAGpD,IAAI,GAAG,KAAK,CAAA;IAUrB;;;;;;;;;;;OAWG;IACH,cAAc,GAA0C,CAAC,EAAE,EAAE,EAAE;QAC9D,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAA;QACxD,OAAO;YACN,GAAG;YACH,IAAI,EAAE,MAAM,CAAC,WAAW,CACvB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACd,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBAC3B,IAAI,CAAC,KAAK,MAAM;oBAAE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;gBAClC,IAAI,CAAC,KAAK,OAAO;oBAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;gBACpC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;YACpD,CAAC,CAAC,CACF;SACD,CAAA;IACF,CAAC,CAAA;CAGD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { APIGuildForumDefaultReactionEmoji, APIGuildForumTag, APIThreadOnlyChannel, ChannelType, SortOrderType } from "discord-api-types/v10";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { Message } from "../structures/Message.js";
|
|
3
|
+
import type { MessagePayload } from "../types/index.js";
|
|
4
|
+
import type { IfPartial } from "../types/index.js";
|
|
4
5
|
import { BaseGuildChannel } from "./BaseGuildChannel.js";
|
|
5
6
|
export declare abstract class GuildThreadOnlyChannel<Type extends ChannelType.GuildForum | ChannelType.GuildMedia, IsPartial extends boolean = false> extends BaseGuildChannel<Type, IsPartial> {
|
|
6
7
|
rawData: APIThreadOnlyChannel<Type> | null;
|
|
@@ -32,12 +33,12 @@ export declare abstract class GuildThreadOnlyChannel<Type extends ChannelType.Gu
|
|
|
32
33
|
* You cannot send a message directly to a forum or media channel, so this method throws an error.
|
|
33
34
|
* Use {@link GuildThreadChannel.send} instead, or the alias {@link GuildThreadOnlyChannel.sendToPost} instead, to send a message to the channel's posts.
|
|
34
35
|
*/
|
|
35
|
-
send(): Promise<
|
|
36
|
+
send(): Promise<never>;
|
|
36
37
|
/**
|
|
37
38
|
* Send a message to a post in the channel
|
|
38
39
|
* @remarks
|
|
39
40
|
* This is an alias for {@link GuildThreadChannel.send} that will fetch the channel, but if you already have the channel, you can use {@link GuildThreadChannel.send} instead.
|
|
40
41
|
*/
|
|
41
|
-
sendToPost(message: MessagePayload, postId: string): Promise<
|
|
42
|
+
sendToPost(message: MessagePayload, postId: string): Promise<Message>;
|
|
42
43
|
}
|
|
43
44
|
//# sourceMappingURL=GuildThreadOnlyChannel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuildThreadOnlyChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iCAAiC,EACjC,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,aAAa,EAEb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"GuildThreadOnlyChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iCAAiC,EACjC,gBAAgB,EAChB,oBAAo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|
@@ -63,7 +63,7 @@ export class GuildThreadOnlyChannel extends BaseGuildChannel {
|
|
|
63
63
|
*/
|
|
64
64
|
async sendToPost(message, postId) {
|
|
65
65
|
const channel = new GuildThreadChannel(this.client, postId);
|
|
66
|
-
await channel.send(message);
|
|
66
|
+
return await channel.send(message);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
//# sourceMappingURL=GuildThreadOnlyChannel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuildThreadOnlyChannel.js","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"GuildThreadOnlyChannel.js","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAIxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,MAAM,OAAgB,sBAGpB,SAAQ,gBAAiC;IAG1C;;OAEG;IACH,IAAI,KAAK;QACR,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,IAAI,0BAA0B;QAC7B,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,6BAA6B,IAAI,IAAI,CAAA;IAC1D,CAAC;IAED;;OAEG;IACH,IAAI,6BAA6B;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,IAAI,IAAI,CAAA;IAC/D,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAA;IACzC,CAAC;IAED;;OAEG;IACH,IAAI,oBAAoB;QAIvB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAA;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,gBAAgB;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAA;IACvC,CAAC;IAED;;;OAGG;IACM,KAAK,CAAC,IAAI;QAClB,MAAM,IAAI,KAAK,CACd,wMAAwM,CACxM,CAAA;IACF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,OAAuB,EAAE,MAAc;QACvD,MAAM,OAAO,GAAG,IAAI,kBAAkB,CACrC,IAAI,CAAC,MAAM,EACX,MAAM,CACN,CAAA;QACD,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;CACD"}
|
|
@@ -3,16 +3,20 @@ import type { Client } from "../classes/Client.js";
|
|
|
3
3
|
* The base class for all plugins
|
|
4
4
|
*/
|
|
5
5
|
export declare abstract class Plugin {
|
|
6
|
+
/**
|
|
7
|
+
* An ID that identifies the plugin uniquely between all other used plugins in the Client
|
|
8
|
+
*/
|
|
9
|
+
abstract readonly id: string;
|
|
6
10
|
/**
|
|
7
11
|
* Registers the client with this plugin
|
|
8
12
|
* @param client The client to register
|
|
9
13
|
*/
|
|
10
|
-
registerClient?(client: Client): void;
|
|
14
|
+
registerClient?(client: Client): Promise<void> | void;
|
|
11
15
|
/**
|
|
12
16
|
* Registers the routes of this plugin with the client
|
|
13
17
|
* @param client The client to register the routes with
|
|
14
18
|
*/
|
|
15
|
-
registerRoutes?(client: Client): void;
|
|
19
|
+
registerRoutes?(client: Client): Promise<void> | void;
|
|
16
20
|
}
|
|
17
21
|
export interface Route {
|
|
18
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../../src/abstracts/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD;;GAEG;AACH,8BAAsB,MAAM;IAC3B;;;OAGG;IACH,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../../src/abstracts/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD;;GAEG;AACH,8BAAsB,MAAM;IAC3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAC5B;;;OAGG;IACH,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAErD;;;OAGG;IACH,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CACrD;AAED,MAAM,WAAW,KAAK;IACrB;;OAEG;IACH,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;IAEnD;;OAEG;IACH,IAAI,EAAE,IAAI,MAAM,EAAE,CAAA;IAElB;;;;;OAKG;IACH,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAElE;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,OAAO;IAEvB,SAAS,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../../src/abstracts/Plugin.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAgB,MAAM;
|
|
1
|
+
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../../src/abstracts/Plugin.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAgB,MAAM;CAgB3B"}
|