@buape/carbon 0.1.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/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-dev.log +12 -0
- package/.turbo/turbo-docs.log +10 -0
- package/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/package.json +18 -0
- package/dist/src/abstracts/AnySelectMenu.d.ts +31 -0
- package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -0
- package/dist/src/abstracts/AnySelectMenu.js +19 -0
- package/dist/src/abstracts/AnySelectMenu.js.map +1 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +12 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.js +21 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -0
- package/dist/src/abstracts/Base.d.ts +10 -0
- package/dist/src/abstracts/Base.d.ts.map +1 -0
- package/dist/src/abstracts/Base.js +11 -0
- package/dist/src/abstracts/Base.js.map +1 -0
- package/dist/src/abstracts/BaseChannel.d.ts +44 -0
- package/dist/src/abstracts/BaseChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseChannel.js +58 -0
- package/dist/src/abstracts/BaseChannel.js.map +1 -0
- package/dist/src/abstracts/BaseCommand.d.ts +58 -0
- package/dist/src/abstracts/BaseCommand.d.ts.map +1 -0
- package/dist/src/abstracts/BaseCommand.js +69 -0
- package/dist/src/abstracts/BaseCommand.js.map +1 -0
- package/dist/src/abstracts/BaseComponent.d.ts +34 -0
- package/dist/src/abstracts/BaseComponent.d.ts.map +1 -0
- package/dist/src/abstracts/BaseComponent.js +30 -0
- package/dist/src/abstracts/BaseComponent.js.map +1 -0
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +9 -0
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/BaseComponentInteraction.js +14 -0
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -0
- package/dist/src/abstracts/BaseGuildChannel.d.ts +68 -0
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseGuildChannel.js +130 -0
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -0
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts +42 -0
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseGuildTextChannel.js +61 -0
- package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -0
- package/dist/src/abstracts/BaseInteraction.d.ts +87 -0
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/BaseInteraction.js +101 -0
- package/dist/src/abstracts/BaseInteraction.js.map +1 -0
- package/dist/src/abstracts/ButtonInteraction.d.ts +8 -0
- package/dist/src/abstracts/ButtonInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/ButtonInteraction.js +18 -0
- package/dist/src/abstracts/ButtonInteraction.js.map +1 -0
- package/dist/src/abstracts/ChannelSelectMenuInteraction.d.ts +7 -0
- package/dist/src/abstracts/ChannelSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/ChannelSelectMenuInteraction.js +11 -0
- package/dist/src/abstracts/ChannelSelectMenuInteraction.js.map +1 -0
- package/dist/src/abstracts/CommandHandler.d.ts +6 -0
- package/dist/src/abstracts/CommandHandler.d.ts.map +1 -0
- package/dist/src/abstracts/CommandHandler.js +65 -0
- package/dist/src/abstracts/CommandHandler.js.map +1 -0
- package/dist/src/abstracts/CommandInteraction.d.ts +15 -0
- package/dist/src/abstracts/CommandInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/CommandInteraction.js +60 -0
- package/dist/src/abstracts/CommandInteraction.js.map +1 -0
- package/dist/src/abstracts/ComponentHandler.d.ts +6 -0
- package/dist/src/abstracts/ComponentHandler.d.ts.map +1 -0
- package/dist/src/abstracts/ComponentHandler.js +64 -0
- package/dist/src/abstracts/ComponentHandler.js.map +1 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +42 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.js +54 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -0
- package/dist/src/abstracts/MentionableSelectMenuInteraction.d.ts +8 -0
- package/dist/src/abstracts/MentionableSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/MentionableSelectMenuInteraction.js +15 -0
- package/dist/src/abstracts/MentionableSelectMenuInteraction.js.map +1 -0
- package/dist/src/abstracts/RoleSelectMenuInteraction.d.ts +8 -0
- package/dist/src/abstracts/RoleSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/RoleSelectMenuInteraction.js +14 -0
- package/dist/src/abstracts/RoleSelectMenuInteraction.js.map +1 -0
- package/dist/src/abstracts/StringSelectMenuInteraction.d.ts +8 -0
- package/dist/src/abstracts/StringSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/StringSelectMenuInteraction.js +14 -0
- package/dist/src/abstracts/StringSelectMenuInteraction.js.map +1 -0
- package/dist/src/abstracts/UserSelectMenuInteraction.d.ts +8 -0
- package/dist/src/abstracts/UserSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/UserSelectMenuInteraction.js +14 -0
- package/dist/src/abstracts/UserSelectMenuInteraction.js.map +1 -0
- package/dist/src/classes/Button.d.ts +53 -0
- package/dist/src/classes/Button.d.ts.map +1 -0
- package/dist/src/classes/Button.js +55 -0
- package/dist/src/classes/Button.js.map +1 -0
- package/dist/src/classes/ChannelSelectMenu.d.ts +15 -0
- package/dist/src/classes/ChannelSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/ChannelSelectMenu.js +15 -0
- package/dist/src/classes/ChannelSelectMenu.js.map +1 -0
- package/dist/src/classes/Client.d.ts +117 -0
- package/dist/src/classes/Client.d.ts.map +1 -0
- package/dist/src/classes/Client.js +170 -0
- package/dist/src/classes/Client.js.map +1 -0
- package/dist/src/classes/Command.d.ts +35 -0
- package/dist/src/classes/Command.d.ts.map +1 -0
- package/dist/src/classes/Command.js +31 -0
- package/dist/src/classes/Command.js.map +1 -0
- package/dist/src/classes/CommandWithSubcommandGroups.d.ts +22 -0
- package/dist/src/classes/CommandWithSubcommandGroups.d.ts.map +1 -0
- package/dist/src/classes/CommandWithSubcommandGroups.js +31 -0
- package/dist/src/classes/CommandWithSubcommandGroups.js.map +1 -0
- package/dist/src/classes/CommandWithSubcommands.d.ts +19 -0
- package/dist/src/classes/CommandWithSubcommands.d.ts.map +1 -0
- package/dist/src/classes/CommandWithSubcommands.js +21 -0
- package/dist/src/classes/CommandWithSubcommands.js.map +1 -0
- package/dist/src/classes/MentionableSelectMenu.d.ts +13 -0
- package/dist/src/classes/MentionableSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/MentionableSelectMenu.js +13 -0
- package/dist/src/classes/MentionableSelectMenu.js.map +1 -0
- package/dist/src/classes/Paginator.d.ts +3 -0
- package/dist/src/classes/Paginator.d.ts.map +1 -0
- package/dist/src/classes/Paginator.js +3 -0
- package/dist/src/classes/Paginator.js.map +1 -0
- package/dist/src/classes/RoleSelectMenu.d.ts +13 -0
- package/dist/src/classes/RoleSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/RoleSelectMenu.js +13 -0
- package/dist/src/classes/RoleSelectMenu.js.map +1 -0
- package/dist/src/classes/Row.d.ts +27 -0
- package/dist/src/classes/Row.d.ts.map +1 -0
- package/dist/src/classes/Row.js +39 -0
- package/dist/src/classes/Row.js.map +1 -0
- package/dist/src/classes/StringSelectMenu.d.ts +13 -0
- package/dist/src/classes/StringSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/StringSelectMenu.js +12 -0
- package/dist/src/classes/StringSelectMenu.js.map +1 -0
- package/dist/src/classes/UserSelectMenu.d.ts +13 -0
- package/dist/src/classes/UserSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/UserSelectMenu.js +13 -0
- package/dist/src/classes/UserSelectMenu.js.map +1 -0
- package/dist/src/factories/channelFactory.d.ts +13 -0
- package/dist/src/factories/channelFactory.d.ts.map +1 -0
- package/dist/src/factories/channelFactory.js +39 -0
- package/dist/src/factories/channelFactory.js.map +1 -0
- package/dist/src/index.d.ts +49 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +55 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internals/AutocompleteInteraction.d.ts +34 -0
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -0
- package/dist/src/internals/AutocompleteInteraction.js +68 -0
- package/dist/src/internals/AutocompleteInteraction.js.map +1 -0
- package/dist/src/internals/ButtonInteraction.d.ts +8 -0
- package/dist/src/internals/ButtonInteraction.d.ts.map +1 -0
- package/dist/src/internals/ButtonInteraction.js +18 -0
- package/dist/src/internals/ButtonInteraction.js.map +1 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.d.ts +7 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.js +11 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/CommandHandler.d.ts +8 -0
- package/dist/src/internals/CommandHandler.d.ts.map +1 -0
- package/dist/src/internals/CommandHandler.js +81 -0
- package/dist/src/internals/CommandHandler.js.map +1 -0
- package/dist/src/internals/CommandInteraction.d.ts +17 -0
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -0
- package/dist/src/internals/CommandInteraction.js +29 -0
- package/dist/src/internals/CommandInteraction.js.map +1 -0
- package/dist/src/internals/ComponentHandler.d.ts +6 -0
- package/dist/src/internals/ComponentHandler.d.ts.map +1 -0
- package/dist/src/internals/ComponentHandler.js +64 -0
- package/dist/src/internals/ComponentHandler.js.map +1 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.d.ts +8 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.js +15 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/OptionsHandler.d.ts +70 -0
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -0
- package/dist/src/internals/OptionsHandler.js +115 -0
- package/dist/src/internals/OptionsHandler.js.map +1 -0
- package/dist/src/internals/RoleSelectMenuInteraction.d.ts +8 -0
- package/dist/src/internals/RoleSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/RoleSelectMenuInteraction.js +14 -0
- package/dist/src/internals/RoleSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/StringSelectMenuInteraction.d.ts +8 -0
- package/dist/src/internals/StringSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/StringSelectMenuInteraction.js +14 -0
- package/dist/src/internals/StringSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/UserSelectMenuInteraction.d.ts +8 -0
- package/dist/src/internals/UserSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/UserSelectMenuInteraction.js +14 -0
- package/dist/src/internals/UserSelectMenuInteraction.js.map +1 -0
- package/dist/src/structures/AnySelectMenu.d.ts +31 -0
- package/dist/src/structures/AnySelectMenu.d.ts.map +1 -0
- package/dist/src/structures/AnySelectMenu.js +19 -0
- package/dist/src/structures/AnySelectMenu.js.map +1 -0
- package/dist/src/structures/AnySelectMenuInteraction.d.ts +12 -0
- package/dist/src/structures/AnySelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/structures/AnySelectMenuInteraction.js +21 -0
- package/dist/src/structures/AnySelectMenuInteraction.js.map +1 -0
- package/dist/src/structures/Base.d.ts +10 -0
- package/dist/src/structures/Base.d.ts.map +1 -0
- package/dist/src/structures/Base.js +11 -0
- package/dist/src/structures/Base.js.map +1 -0
- package/dist/src/structures/BaseCommand.d.ts +64 -0
- package/dist/src/structures/BaseCommand.d.ts.map +1 -0
- package/dist/src/structures/BaseCommand.js +58 -0
- package/dist/src/structures/BaseCommand.js.map +1 -0
- package/dist/src/structures/BaseComponent.d.ts +34 -0
- package/dist/src/structures/BaseComponent.d.ts.map +1 -0
- package/dist/src/structures/BaseComponent.js +30 -0
- package/dist/src/structures/BaseComponent.js.map +1 -0
- package/dist/src/structures/BaseComponentInteraction.d.ts +9 -0
- package/dist/src/structures/BaseComponentInteraction.d.ts.map +1 -0
- package/dist/src/structures/BaseComponentInteraction.js +14 -0
- package/dist/src/structures/BaseComponentInteraction.js.map +1 -0
- package/dist/src/structures/BaseInteraction.d.ts +81 -0
- package/dist/src/structures/BaseInteraction.d.ts.map +1 -0
- package/dist/src/structures/BaseInteraction.js +99 -0
- package/dist/src/structures/BaseInteraction.js.map +1 -0
- package/dist/src/structures/ButtonInteraction.d.ts +8 -0
- package/dist/src/structures/ButtonInteraction.d.ts.map +1 -0
- package/dist/src/structures/ButtonInteraction.js +18 -0
- package/dist/src/structures/ButtonInteraction.js.map +1 -0
- package/dist/src/structures/ChannelSelectMenuInteraction.d.ts +7 -0
- package/dist/src/structures/ChannelSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/structures/ChannelSelectMenuInteraction.js +11 -0
- package/dist/src/structures/ChannelSelectMenuInteraction.js.map +1 -0
- package/dist/src/structures/CommandHandler.d.ts +6 -0
- package/dist/src/structures/CommandHandler.d.ts.map +1 -0
- package/dist/src/structures/CommandHandler.js +70 -0
- package/dist/src/structures/CommandHandler.js.map +1 -0
- package/dist/src/structures/CommandInteraction.d.ts +15 -0
- package/dist/src/structures/CommandInteraction.d.ts.map +1 -0
- package/dist/src/structures/CommandInteraction.js +60 -0
- package/dist/src/structures/CommandInteraction.js.map +1 -0
- package/dist/src/structures/ComponentHandler.d.ts +6 -0
- package/dist/src/structures/ComponentHandler.d.ts.map +1 -0
- package/dist/src/structures/ComponentHandler.js +64 -0
- package/dist/src/structures/ComponentHandler.js.map +1 -0
- package/dist/src/structures/DmChannel.d.ts +18 -0
- package/dist/src/structures/DmChannel.d.ts.map +1 -0
- package/dist/src/structures/DmChannel.js +24 -0
- package/dist/src/structures/DmChannel.js.map +1 -0
- package/dist/src/structures/GroupDmChannel.d.ts +67 -0
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -0
- package/dist/src/structures/GroupDmChannel.js +109 -0
- package/dist/src/structures/GroupDmChannel.js.map +1 -0
- package/dist/src/structures/Guild.d.ts +71 -0
- package/dist/src/structures/Guild.d.ts.map +1 -0
- package/dist/src/structures/Guild.js +123 -0
- package/dist/src/structures/Guild.js.map +1 -0
- package/dist/src/structures/GuildAnnouncementChannel.d.ts +12 -0
- package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildAnnouncementChannel.js +17 -0
- package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -0
- package/dist/src/structures/GuildCategoryChannel.d.ts +13 -0
- package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildCategoryChannel.js +14 -0
- package/dist/src/structures/GuildCategoryChannel.js.map +1 -0
- package/dist/src/structures/GuildForumChannel.d.ts +13 -0
- package/dist/src/structures/GuildForumChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildForumChannel.js +14 -0
- package/dist/src/structures/GuildForumChannel.js.map +1 -0
- package/dist/src/structures/GuildMediaChannel.d.ts +13 -0
- package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildMediaChannel.js +12 -0
- package/dist/src/structures/GuildMediaChannel.js.map +1 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +30 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.js +34 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -0
- package/dist/src/structures/GuildTextChannel.d.ts +15 -0
- package/dist/src/structures/GuildTextChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildTextChannel.js +18 -0
- package/dist/src/structures/GuildTextChannel.js.map +1 -0
- package/dist/src/structures/GuildThreadChannel.d.ts +89 -0
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildThreadChannel.js +134 -0
- package/dist/src/structures/GuildThreadChannel.js.map +1 -0
- package/dist/src/structures/MentionableSelectMenuInteraction.d.ts +8 -0
- package/dist/src/structures/MentionableSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/structures/MentionableSelectMenuInteraction.js +15 -0
- package/dist/src/structures/MentionableSelectMenuInteraction.js.map +1 -0
- package/dist/src/structures/Message.d.ts +52 -0
- package/dist/src/structures/Message.d.ts.map +1 -0
- package/dist/src/structures/Message.js +93 -0
- package/dist/src/structures/Message.js.map +1 -0
- package/dist/src/structures/Role.d.ts +106 -0
- package/dist/src/structures/Role.d.ts.map +1 -0
- package/dist/src/structures/Role.js +181 -0
- package/dist/src/structures/Role.js.map +1 -0
- package/dist/src/structures/RoleSelectMenuInteraction.d.ts +8 -0
- package/dist/src/structures/RoleSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/structures/RoleSelectMenuInteraction.js +14 -0
- package/dist/src/structures/RoleSelectMenuInteraction.js.map +1 -0
- package/dist/src/structures/StringSelectMenuInteraction.d.ts +8 -0
- package/dist/src/structures/StringSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/structures/StringSelectMenuInteraction.js +14 -0
- package/dist/src/structures/StringSelectMenuInteraction.js.map +1 -0
- package/dist/src/structures/User.d.ts +80 -0
- package/dist/src/structures/User.d.ts.map +1 -0
- package/dist/src/structures/User.js +133 -0
- package/dist/src/structures/User.js.map +1 -0
- package/dist/src/structures/UserSelectMenuInteraction.d.ts +8 -0
- package/dist/src/structures/UserSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/structures/UserSelectMenuInteraction.js +14 -0
- package/dist/src/structures/UserSelectMenuInteraction.js.map +1 -0
- package/dist/src/types.d.ts +31 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +33 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +2 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +11 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docs/classes/AnySelectMenu.mdx +114 -0
- package/docs/classes/AnySelectMenuInteraction.mdx +161 -0
- package/docs/classes/AutocompleteInteraction.mdx +152 -0
- package/docs/classes/AutocompleteOptionsHandler.mdx +243 -0
- package/docs/classes/BaseChannel.mdx +97 -0
- package/docs/classes/BaseCommand.mdx +61 -0
- package/docs/classes/BaseComponent.mdx +55 -0
- package/docs/classes/BaseComponentInteraction.mdx +146 -0
- package/docs/classes/BaseGuildChannel.mdx +262 -0
- package/docs/classes/BaseGuildTextChannel.mdx +360 -0
- package/docs/classes/BaseInteraction.mdx +127 -0
- package/docs/classes/Button.mdx +99 -0
- package/docs/classes/ButtonInteraction.mdx +141 -0
- package/docs/classes/ChannelSelectMenu.mdx +122 -0
- package/docs/classes/ChannelSelectMenuInteraction.mdx +157 -0
- package/docs/classes/Client.mdx +48 -0
- package/docs/classes/Command.mdx +111 -0
- package/docs/classes/CommandHandler.mdx +65 -0
- package/docs/classes/CommandInteraction.mdx +141 -0
- package/docs/classes/CommandWithSubcommandGroups.mdx +73 -0
- package/docs/classes/CommandWithSubcommands.mdx +76 -0
- package/docs/classes/ComponentHandler.mdx +49 -0
- package/docs/classes/DmChannel.mdx +118 -0
- package/docs/classes/GroupDmChannel.mdx +197 -0
- package/docs/classes/Guild.mdx +139 -0
- package/docs/classes/GuildAnnouncementChannel.mdx +377 -0
- package/docs/classes/GuildCategoryChannel.mdx +272 -0
- package/docs/classes/GuildForumChannel.mdx +333 -0
- package/docs/classes/GuildMediaChannel.mdx +327 -0
- package/docs/classes/GuildStageChannel.mdx +276 -0
- package/docs/classes/GuildStageOrVoiceChannel.mdx +292 -0
- package/docs/classes/GuildTextChannel.mdx +367 -0
- package/docs/classes/GuildThreadChannel.mdx +425 -0
- package/docs/classes/GuildThreadOnlyChannel.mdx +333 -0
- package/docs/classes/GuildVoiceChannel.mdx +276 -0
- package/docs/classes/LinkButton.mdx +84 -0
- package/docs/classes/MentionableSelectMenu.mdx +120 -0
- package/docs/classes/MentionableSelectMenuInteraction.mdx +157 -0
- package/docs/classes/Message.mdx +126 -0
- package/docs/classes/OptionsHandler.mdx +203 -0
- package/docs/classes/PremiumButton.mdx +84 -0
- package/docs/classes/Role.mdx +228 -0
- package/docs/classes/RoleSelectMenu.mdx +120 -0
- package/docs/classes/RoleSelectMenuInteraction.mdx +157 -0
- package/docs/classes/Row.mdx +88 -0
- package/docs/classes/StringSelectMenu.mdx +120 -0
- package/docs/classes/StringSelectMenuInteraction.mdx +157 -0
- package/docs/classes/User.mdx +119 -0
- package/docs/classes/UserSelectMenu.mdx +120 -0
- package/docs/classes/UserSelectMenuInteraction.mdx +157 -0
- package/docs/enumerations/ClientMode.mdx +16 -0
- package/docs/functions/channelFactory.mdx +16 -0
- package/docs/index.mdx +83 -0
- package/docs/type-aliases/AnySelectMenuComponentType.mdx +5 -0
- package/docs/type-aliases/ClientOptions.mdx +20 -0
- package/docs/type-aliases/CommandOptions.mdx +5 -0
- package/docs/type-aliases/ComponentAdditionalData.mdx +9 -0
- package/docs/type-aliases/InteractionFileData.mdx +15 -0
- package/docs/type-aliases/InteractionReplyData.mdx +14 -0
- package/docs/type-aliases/InteractionReplyOptions.mdx +13 -0
- package/docs/type-aliases/RawOptions.mdx +9 -0
- package/docs/type-aliases/meta.json +3 -0
- package/package.json +18 -0
- package/src/README.md +7 -0
- package/src/abstracts/AnySelectMenu.ts +63 -0
- package/src/abstracts/AnySelectMenuInteraction.ts +29 -0
- package/src/abstracts/Base.ts +12 -0
- package/src/abstracts/BaseChannel.ts +73 -0
- package/src/abstracts/BaseCommand.ts +95 -0
- package/src/abstracts/BaseComponent.ts +49 -0
- package/src/abstracts/BaseComponentInteraction.ts +19 -0
- package/src/abstracts/BaseGuildChannel.ts +152 -0
- package/src/abstracts/BaseGuildTextChannel.ts +77 -0
- package/src/abstracts/BaseInteraction.ts +170 -0
- package/src/abstracts/GuildThreadOnlyChannel.ts +71 -0
- package/src/classes/Button.ts +95 -0
- package/src/classes/ChannelSelectMenu.ts +21 -0
- package/src/classes/Client.ts +249 -0
- package/src/classes/Command.ts +51 -0
- package/src/classes/CommandWithSubcommandGroups.ts +47 -0
- package/src/classes/CommandWithSubcommands.ts +35 -0
- package/src/classes/MentionableSelectMenu.ts +19 -0
- package/src/classes/RoleSelectMenu.ts +19 -0
- package/src/classes/Row.ts +44 -0
- package/src/classes/StringSelectMenu.ts +19 -0
- package/src/classes/UserSelectMenu.ts +19 -0
- package/src/factories/channelFactory.ts +43 -0
- package/src/index.ts +59 -0
- package/src/internals/AutocompleteInteraction.ts +107 -0
- package/src/internals/ButtonInteraction.ts +26 -0
- package/src/internals/ChannelSelectMenuInteraction.ts +15 -0
- package/src/internals/CommandHandler.ts +123 -0
- package/src/internals/CommandInteraction.ts +49 -0
- package/src/internals/ComponentHandler.ts +81 -0
- package/src/internals/MentionableSelectMenuInteraction.ts +21 -0
- package/src/internals/OptionsHandler.ts +147 -0
- package/src/internals/RoleSelectMenuInteraction.ts +20 -0
- package/src/internals/StringSelectMenuInteraction.ts +20 -0
- package/src/internals/UserSelectMenuInteraction.ts +20 -0
- package/src/structures/DmChannel.ts +31 -0
- package/src/structures/GroupDmChannel.ts +132 -0
- package/src/structures/Guild.ts +142 -0
- package/src/structures/GuildAnnouncementChannel.ts +20 -0
- package/src/structures/GuildCategoryChannel.ts +16 -0
- package/src/structures/GuildForumChannel.ts +20 -0
- package/src/structures/GuildMediaChannel.ts +13 -0
- package/src/structures/GuildStageOrVoiceChannel.ts +46 -0
- package/src/structures/GuildTextChannel.ts +21 -0
- package/src/structures/GuildThreadChannel.ts +150 -0
- package/src/structures/Message.ts +124 -0
- package/src/structures/Role.ts +201 -0
- package/src/structures/User.ts +153 -0
- package/src/utils.ts +13 -0
- package/tests/index.test.ts +4 -0
- package/tsconfig.json +12 -0
- package/typedoc.json +9 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: channelFactory
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> **channelFactory**(`client`, `channelData`): `null` \| [`DmChannel`](/carbon/api/classes/DmChannel) \| [`GroupDmChannel`](/carbon/api/classes/GroupDmChannel) \| [`GuildTextChannel`](/carbon/api/classes/GuildTextChannel) \| [`GuildVoiceChannel`](/carbon/api/classes/GuildVoiceChannel) \| [`GuildCategoryChannel`](/carbon/api/classes/GuildCategoryChannel) \| [`GuildAnnouncementChannel`](/carbon/api/classes/GuildAnnouncementChannel) \| [`GuildThreadChannel`](/carbon/api/classes/GuildThreadChannel)\<`ThreadChannelType`\> \| [`GuildStageChannel`](/carbon/api/classes/GuildStageChannel) \| [`GuildForumChannel`](/carbon/api/classes/GuildForumChannel) \| [`GuildMediaChannel`](/carbon/api/classes/GuildMediaChannel)
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
| Parameter | Type |
|
|
10
|
+
| ------ | ------ |
|
|
11
|
+
| `client` | [`Client`](/carbon/api/classes/Client) |
|
|
12
|
+
| `channelData` | `APIChannel` |
|
|
13
|
+
|
|
14
|
+
## Returns
|
|
15
|
+
|
|
16
|
+
`null` \| [`DmChannel`](/carbon/api/classes/DmChannel) \| [`GroupDmChannel`](/carbon/api/classes/GroupDmChannel) \| [`GuildTextChannel`](/carbon/api/classes/GuildTextChannel) \| [`GuildVoiceChannel`](/carbon/api/classes/GuildVoiceChannel) \| [`GuildCategoryChannel`](/carbon/api/classes/GuildCategoryChannel) \| [`GuildAnnouncementChannel`](/carbon/api/classes/GuildAnnouncementChannel) \| [`GuildThreadChannel`](/carbon/api/classes/GuildThreadChannel)\<`ThreadChannelType`\> \| [`GuildStageChannel`](/carbon/api/classes/GuildStageChannel) \| [`GuildForumChannel`](/carbon/api/classes/GuildForumChannel) \| [`GuildMediaChannel`](/carbon/api/classes/GuildMediaChannel)
|
package/docs/index.mdx
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "@buape/carbon"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Enumerations
|
|
6
|
+
|
|
7
|
+
| Enumeration | Description |
|
|
8
|
+
| ------ | ------ |
|
|
9
|
+
| [ClientMode](/carbon/api/enumerations/ClientMode) | The mode that the client is running in. Different platforms have different requirements for how processes are handled. |
|
|
10
|
+
|
|
11
|
+
## Classes
|
|
12
|
+
|
|
13
|
+
| Class | Description |
|
|
14
|
+
| ------ | ------ |
|
|
15
|
+
| [AnySelectMenu](/carbon/api/classes/AnySelectMenu) | - |
|
|
16
|
+
| [AnySelectMenuInteraction](/carbon/api/classes/AnySelectMenuInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
17
|
+
| [AutocompleteInteraction](/carbon/api/classes/AutocompleteInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
18
|
+
| [AutocompleteOptionsHandler](/carbon/api/classes/AutocompleteOptionsHandler) | This class is used to parse the options of a command, and provide errors for any missing or invalid options. It is used internally by the Command class. |
|
|
19
|
+
| [BaseChannel](/carbon/api/classes/BaseChannel) | - |
|
|
20
|
+
| [BaseCommand](/carbon/api/classes/BaseCommand) | Represents the base data of a command that the user creates |
|
|
21
|
+
| [BaseComponent](/carbon/api/classes/BaseComponent) | - |
|
|
22
|
+
| [BaseComponentInteraction](/carbon/api/classes/BaseComponentInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
23
|
+
| [BaseGuildChannel](/carbon/api/classes/BaseGuildChannel) | - |
|
|
24
|
+
| [BaseGuildTextChannel](/carbon/api/classes/BaseGuildTextChannel) | - |
|
|
25
|
+
| [BaseInteraction](/carbon/api/classes/BaseInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
26
|
+
| [Button](/carbon/api/classes/Button) | - |
|
|
27
|
+
| [ButtonInteraction](/carbon/api/classes/ButtonInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
28
|
+
| [ChannelSelectMenu](/carbon/api/classes/ChannelSelectMenu) | - |
|
|
29
|
+
| [ChannelSelectMenuInteraction](/carbon/api/classes/ChannelSelectMenuInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
30
|
+
| [Client](/carbon/api/classes/Client) | The main client used to interact with Discord |
|
|
31
|
+
| [Command](/carbon/api/classes/Command) | Represents a standard command that the user creates |
|
|
32
|
+
| [CommandHandler](/carbon/api/classes/CommandHandler) | - |
|
|
33
|
+
| [CommandInteraction](/carbon/api/classes/CommandInteraction) | Represents a command interaction |
|
|
34
|
+
| [CommandWithSubcommandGroups](/carbon/api/classes/CommandWithSubcommandGroups) | Represents a subcommand group command that the user creates. You make this instead of a [Command](/carbon/api/classes/Command) class when you want to have subcommand groups in your options. |
|
|
35
|
+
| [CommandWithSubcommands](/carbon/api/classes/CommandWithSubcommands) | Represents a subcommand command that the user creates. You make this instead of a [Command](/carbon/api/classes/Command) class when you want to have subcommands in your options. |
|
|
36
|
+
| [ComponentHandler](/carbon/api/classes/ComponentHandler) | - |
|
|
37
|
+
| [DmChannel](/carbon/api/classes/DmChannel) | Represents a DM between two users. |
|
|
38
|
+
| [GroupDmChannel](/carbon/api/classes/GroupDmChannel) | Represents a group DM channel. |
|
|
39
|
+
| [Guild](/carbon/api/classes/Guild) | - |
|
|
40
|
+
| [GuildAnnouncementChannel](/carbon/api/classes/GuildAnnouncementChannel) | Represents a guild announcement channel. |
|
|
41
|
+
| [GuildCategoryChannel](/carbon/api/classes/GuildCategoryChannel) | Represents a guild category channel. |
|
|
42
|
+
| [GuildForumChannel](/carbon/api/classes/GuildForumChannel) | Represents a guild forum channel. |
|
|
43
|
+
| [GuildMediaChannel](/carbon/api/classes/GuildMediaChannel) | Represents a guild media channel (a forum channel ) |
|
|
44
|
+
| [GuildStageChannel](/carbon/api/classes/GuildStageChannel) | - |
|
|
45
|
+
| [GuildStageOrVoiceChannel](/carbon/api/classes/GuildStageOrVoiceChannel) | - |
|
|
46
|
+
| [GuildTextChannel](/carbon/api/classes/GuildTextChannel) | - |
|
|
47
|
+
| [GuildThreadChannel](/carbon/api/classes/GuildThreadChannel) | - |
|
|
48
|
+
| [GuildThreadOnlyChannel](/carbon/api/classes/GuildThreadOnlyChannel) | - |
|
|
49
|
+
| [GuildVoiceChannel](/carbon/api/classes/GuildVoiceChannel) | - |
|
|
50
|
+
| [LinkButton](/carbon/api/classes/LinkButton) | - |
|
|
51
|
+
| [MentionableSelectMenu](/carbon/api/classes/MentionableSelectMenu) | - |
|
|
52
|
+
| [MentionableSelectMenuInteraction](/carbon/api/classes/MentionableSelectMenuInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
53
|
+
| [Message](/carbon/api/classes/Message) | - |
|
|
54
|
+
| [OptionsHandler](/carbon/api/classes/OptionsHandler) | This class is used to parse the options of a command, and provide errors for any missing or invalid options. It is used internally by the Command class. |
|
|
55
|
+
| [PremiumButton](/carbon/api/classes/PremiumButton) | - |
|
|
56
|
+
| [Role](/carbon/api/classes/Role) | - |
|
|
57
|
+
| [RoleSelectMenu](/carbon/api/classes/RoleSelectMenu) | - |
|
|
58
|
+
| [RoleSelectMenuInteraction](/carbon/api/classes/RoleSelectMenuInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
59
|
+
| [Row](/carbon/api/classes/Row) | - |
|
|
60
|
+
| [StringSelectMenu](/carbon/api/classes/StringSelectMenu) | - |
|
|
61
|
+
| [StringSelectMenuInteraction](/carbon/api/classes/StringSelectMenuInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
62
|
+
| [User](/carbon/api/classes/User) | - |
|
|
63
|
+
| [UserSelectMenu](/carbon/api/classes/UserSelectMenu) | - |
|
|
64
|
+
| [UserSelectMenuInteraction](/carbon/api/classes/UserSelectMenuInteraction) | This is the base type interaction, all interaction types extend from this |
|
|
65
|
+
|
|
66
|
+
## Type Aliases
|
|
67
|
+
|
|
68
|
+
| Type alias | Description |
|
|
69
|
+
| ------ | ------ |
|
|
70
|
+
| [AnySelectMenuComponentType](/carbon/api/type-aliases/AnySelectMenuComponentType) | - |
|
|
71
|
+
| [ClientOptions](/carbon/api/type-aliases/ClientOptions) | The options used for initializing the client |
|
|
72
|
+
| [CommandOptions](/carbon/api/type-aliases/CommandOptions) | - |
|
|
73
|
+
| [ComponentAdditionalData](/carbon/api/type-aliases/ComponentAdditionalData) | - |
|
|
74
|
+
| [InteractionFileData](/carbon/api/type-aliases/InteractionFileData) | The data for a file to send in an interaction |
|
|
75
|
+
| [InteractionReplyData](/carbon/api/type-aliases/InteractionReplyData) | The data to reply to an interaction |
|
|
76
|
+
| [InteractionReplyOptions](/carbon/api/type-aliases/InteractionReplyOptions) | Additional options for replying to an interaction |
|
|
77
|
+
| [RawOptions](/carbon/api/type-aliases/RawOptions) | - |
|
|
78
|
+
|
|
79
|
+
## Functions
|
|
80
|
+
|
|
81
|
+
| Function | Description |
|
|
82
|
+
| ------ | ------ |
|
|
83
|
+
| [channelFactory](/carbon/api/functions/channelFactory) | - |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ClientOptions
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> **ClientOptions**: `object`
|
|
6
|
+
|
|
7
|
+
The options used for initializing the client
|
|
8
|
+
|
|
9
|
+
## Type declaration
|
|
10
|
+
|
|
11
|
+
| Name | Type | Description |
|
|
12
|
+
| ------ | ------ | ------ |
|
|
13
|
+
| `autoDeploy` | `boolean` | Whether the commands should be deployed to Discord automatically. |
|
|
14
|
+
| `clientId` | `string` | The client ID of the bot |
|
|
15
|
+
| `mode` | [`ClientMode`](/carbon/api/enumerations/ClientMode) | The mode of the client, generally where you are hosting the bot. If you have a different mode for your local development, make sure to set it to the local one. **Example** `import { Client, ClientMode } from "@buape/carbon" const client = new Client({ clientId: "12345678901234567890", publicKey: "c1a2f941ae8ce6d776f7704d0bb3d46b863e21fda491cdb2bdba6b8bc5fe7269", token: "MTA4NjEwNTYxMDUxMDE1NTg1Nw.GNt-U8.OSHy-g-5FlfESnu3Z9MEEMJLHiRthXajiXNwiE", mode: process.env.NODE_ENV === "development" ? ClientMode.NodeJS : ClientMode.CloudflareWorkers })` |
|
|
16
|
+
| `port` | `number` | The port to run the server on, if you are using [ClientMode.Bun](/carbon/api/enumerations/ClientMode) mode. |
|
|
17
|
+
| `publicKey` | `string` | The public key of the bot, used for interaction verification |
|
|
18
|
+
| `redirectUrl` | `string` | If you want to have the root route for the interaction handler redirect to a different URL, you can set this. |
|
|
19
|
+
| `requestOptions` | `RequestClientOptions` | The options used to initialize the request client, if you want to customize it. |
|
|
20
|
+
| `token` | `string` | The token of the bot |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: InteractionFileData
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> **InteractionFileData**: `object`
|
|
6
|
+
|
|
7
|
+
The data for a file to send in an interaction
|
|
8
|
+
|
|
9
|
+
## Type declaration
|
|
10
|
+
|
|
11
|
+
| Name | Type | Description |
|
|
12
|
+
| ------ | ------ | ------ |
|
|
13
|
+
| `data` | [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob) | The data of the file in a Blob |
|
|
14
|
+
| `description` | `string` | **`Alpha`** The alt text of the file, shown for accessibility This isn't implemented yet |
|
|
15
|
+
| `name` | `string` | The name of the file that will be given to Discord |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: InteractionReplyData
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> **InteractionReplyData**: `object`
|
|
6
|
+
|
|
7
|
+
The data to reply to an interaction
|
|
8
|
+
|
|
9
|
+
## Type declaration
|
|
10
|
+
|
|
11
|
+
| Name | Type | Description |
|
|
12
|
+
| ------ | ------ | ------ |
|
|
13
|
+
| `components` | [`Row`](/carbon/api/classes/Row)[] | The components to send in the message, listed in rows |
|
|
14
|
+
| `content` | `string` | The content of the message |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: InteractionReplyOptions
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> **InteractionReplyOptions**: `object`
|
|
6
|
+
|
|
7
|
+
Additional options for replying to an interaction
|
|
8
|
+
|
|
9
|
+
## Type declaration
|
|
10
|
+
|
|
11
|
+
| Name | Type | Description |
|
|
12
|
+
| ------ | ------ | ------ |
|
|
13
|
+
| `files` | [`InteractionFileData`](/carbon/api/type-aliases/InteractionFileData)[] | The files to send in the interaction |
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@buape/carbon",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/src/index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"discord-api-types": "0.37.98",
|
|
9
|
+
"discord-verify": "1.2.0",
|
|
10
|
+
"itty-router": "5.0.18",
|
|
11
|
+
"@buape/carbon-request": "0.1.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc -w",
|
|
16
|
+
"docs": "typedoc"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Folders
|
|
2
|
+
|
|
3
|
+
`abstracts/` - Abstract classes that are used to create other classes, with inheritance in mind.
|
|
4
|
+
`classes/` - Classes that the end user will import into their application code, such as the main client.
|
|
5
|
+
`factories/` - Classes that are used to create structures from api-like data, such as the `channelFactory` function.
|
|
6
|
+
`internals/` - Classes that represent the internal structure of the framework, such as the `Base` class.
|
|
7
|
+
`structures/` - Classes that are used for api-like structures, such as the `CommandInteraction` class.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
APIChannelSelectComponent,
|
|
3
|
+
APIMentionableSelectComponent,
|
|
4
|
+
APIRoleSelectComponent,
|
|
5
|
+
APISelectMenuComponent,
|
|
6
|
+
APIStringSelectComponent,
|
|
7
|
+
APIUserSelectComponent,
|
|
8
|
+
ComponentType
|
|
9
|
+
} from "discord-api-types/v10"
|
|
10
|
+
import type { AnySelectMenuInteraction } from "./AnySelectMenuInteraction.js"
|
|
11
|
+
import { BaseComponent } from "./BaseComponent.js"
|
|
12
|
+
|
|
13
|
+
export type AnySelectMenuComponentType =
|
|
14
|
+
| ComponentType.ChannelSelect
|
|
15
|
+
| ComponentType.RoleSelect
|
|
16
|
+
| ComponentType.StringSelect
|
|
17
|
+
| ComponentType.UserSelect
|
|
18
|
+
| ComponentType.MentionableSelect
|
|
19
|
+
|
|
20
|
+
export abstract class AnySelectMenu extends BaseComponent {
|
|
21
|
+
abstract type: AnySelectMenuComponentType
|
|
22
|
+
abstract run(interaction: AnySelectMenuInteraction): Promise<void>
|
|
23
|
+
|
|
24
|
+
minValues?: number
|
|
25
|
+
maxValues?: number
|
|
26
|
+
disabled?: boolean
|
|
27
|
+
placeholder?: string
|
|
28
|
+
|
|
29
|
+
serialize = (): APISelectMenuComponent => {
|
|
30
|
+
const options = this.serializeOptions()
|
|
31
|
+
return {
|
|
32
|
+
...options,
|
|
33
|
+
custom_id: this.customId,
|
|
34
|
+
disabled: this.disabled,
|
|
35
|
+
placeholder: this.placeholder,
|
|
36
|
+
min_values: this.minValues,
|
|
37
|
+
max_values: this.maxValues
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
abstract serializeOptions():
|
|
42
|
+
| {
|
|
43
|
+
type: ComponentType.ChannelSelect
|
|
44
|
+
channel_types: APIChannelSelectComponent["channel_types"]
|
|
45
|
+
default_values: APIChannelSelectComponent["default_values"]
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
type: ComponentType.StringSelect
|
|
49
|
+
options: APIStringSelectComponent["options"]
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
type: ComponentType.RoleSelect
|
|
53
|
+
default_values: APIRoleSelectComponent["default_values"]
|
|
54
|
+
}
|
|
55
|
+
| {
|
|
56
|
+
type: ComponentType.UserSelect
|
|
57
|
+
default_values: APIUserSelectComponent["default_values"]
|
|
58
|
+
}
|
|
59
|
+
| {
|
|
60
|
+
type: ComponentType.MentionableSelect
|
|
61
|
+
default_values: APIMentionableSelectComponent["default_values"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type APIMessageComponentSelectMenuInteraction,
|
|
3
|
+
type APIMessageSelectMenuInteractionData,
|
|
4
|
+
InteractionType
|
|
5
|
+
} from "discord-api-types/v10"
|
|
6
|
+
import type { Client } from "../classes/Client.js"
|
|
7
|
+
import { splitCustomId } from "../utils.js"
|
|
8
|
+
import { BaseComponentInteraction } from "./BaseComponentInteraction.js"
|
|
9
|
+
|
|
10
|
+
export abstract class AnySelectMenuInteraction extends BaseComponentInteraction {
|
|
11
|
+
customId: string = splitCustomId(
|
|
12
|
+
(this.rawData.data as APIMessageSelectMenuInteractionData).custom_id
|
|
13
|
+
)[0]
|
|
14
|
+
constructor(client: Client, data: APIMessageComponentSelectMenuInteraction) {
|
|
15
|
+
super(client, data)
|
|
16
|
+
if (!data.data)
|
|
17
|
+
throw new Error("Invalid interaction data was used to create this class")
|
|
18
|
+
if (data.type !== InteractionType.MessageComponent) {
|
|
19
|
+
throw new Error("Invalid interaction type was used to create this class")
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The raw IDs of the selected options (either role/string/channel IDs or the IDs you provided in your options)
|
|
25
|
+
*/
|
|
26
|
+
get values(): string[] {
|
|
27
|
+
return (this.rawData.data as APIMessageSelectMenuInteractionData).values
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type APIChannel,
|
|
3
|
+
type ChannelType,
|
|
4
|
+
Routes
|
|
5
|
+
} from "discord-api-types/v10"
|
|
6
|
+
import type { Client } from "../classes/Client.js"
|
|
7
|
+
import { Base } from "./Base.js"
|
|
8
|
+
|
|
9
|
+
export abstract class BaseChannel<Type extends ChannelType> extends Base {
|
|
10
|
+
/**
|
|
11
|
+
* The id of the channel.
|
|
12
|
+
*/
|
|
13
|
+
id: string
|
|
14
|
+
/**
|
|
15
|
+
* Whether the channel is a partial channel (meaning it does not have all the data).
|
|
16
|
+
* If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
|
|
17
|
+
*/
|
|
18
|
+
partial: boolean
|
|
19
|
+
/**
|
|
20
|
+
* The type of the channel.
|
|
21
|
+
*/
|
|
22
|
+
type?: Type
|
|
23
|
+
/**
|
|
24
|
+
* The flags of the channel in a bitfield.
|
|
25
|
+
* @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
|
26
|
+
*/
|
|
27
|
+
flags?: number | null
|
|
28
|
+
/**
|
|
29
|
+
* The raw data of the channel.
|
|
30
|
+
*/
|
|
31
|
+
protected rawData: Extract<APIChannel, { type: Type }> | null = null
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
client: Client,
|
|
35
|
+
rawDataOrId: Extract<APIChannel, { type: Type }> | string
|
|
36
|
+
) {
|
|
37
|
+
super(client)
|
|
38
|
+
if (typeof rawDataOrId === "string") {
|
|
39
|
+
this.id = rawDataOrId
|
|
40
|
+
this.partial = true
|
|
41
|
+
} else {
|
|
42
|
+
this.rawData = rawDataOrId
|
|
43
|
+
this.id = rawDataOrId.id
|
|
44
|
+
this.partial = false
|
|
45
|
+
this.setData(rawDataOrId)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected setData(data: Extract<APIChannel, { type: Type }>) {
|
|
50
|
+
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
51
|
+
this.rawData = data
|
|
52
|
+
this.type = data.type
|
|
53
|
+
this.partial = false
|
|
54
|
+
this.setSpecificData(data)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected abstract setSpecificData(
|
|
58
|
+
data: Extract<APIChannel, { type: Type }>
|
|
59
|
+
): void
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Fetches the channel from the API.
|
|
63
|
+
* @returns The channel data.
|
|
64
|
+
*/
|
|
65
|
+
async fetch() {
|
|
66
|
+
const newData = (await this.client.rest.get(
|
|
67
|
+
Routes.channel(this.id)
|
|
68
|
+
)) as Extract<APIChannel, { type: Type }>
|
|
69
|
+
if (!newData) throw new Error(`Channel ${this.id} not found`)
|
|
70
|
+
|
|
71
|
+
this.setData(newData)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApplicationCommandType,
|
|
3
|
+
type RESTPostAPIApplicationCommandsJSONBody
|
|
4
|
+
} from "discord-api-types/v10"
|
|
5
|
+
import { ApplicationIntegrationType, InteractionContextType } from "../index.js"
|
|
6
|
+
import type { BaseComponent } from "./BaseComponent.js"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the base data of a command that the user creates
|
|
10
|
+
*/
|
|
11
|
+
export abstract class BaseCommand {
|
|
12
|
+
/**
|
|
13
|
+
* The name of the command (e.g. "ping" for /ping)
|
|
14
|
+
*/
|
|
15
|
+
abstract name: string
|
|
16
|
+
/**
|
|
17
|
+
* A description of the command
|
|
18
|
+
*/
|
|
19
|
+
abstract description: string
|
|
20
|
+
/**
|
|
21
|
+
* Whether the command response should be automatically deferred
|
|
22
|
+
*/
|
|
23
|
+
defer = false
|
|
24
|
+
/**
|
|
25
|
+
* Whether the command response should be ephemeral
|
|
26
|
+
*/
|
|
27
|
+
ephemeral = false
|
|
28
|
+
/**
|
|
29
|
+
* The type of the command
|
|
30
|
+
*/
|
|
31
|
+
abstract type: ApplicationCommandType
|
|
32
|
+
/**
|
|
33
|
+
* The places this command can be used in
|
|
34
|
+
* @beta API types are not finalized
|
|
35
|
+
*/
|
|
36
|
+
integrationTypes: ApplicationIntegrationType[] = [
|
|
37
|
+
ApplicationIntegrationType.GuildInstall,
|
|
38
|
+
ApplicationIntegrationType.UserInstall
|
|
39
|
+
]
|
|
40
|
+
/**
|
|
41
|
+
* The contexts this command can be used in
|
|
42
|
+
* @beta API types are not finalized
|
|
43
|
+
*/
|
|
44
|
+
contexts: InteractionContextType[] = [
|
|
45
|
+
InteractionContextType.Guild,
|
|
46
|
+
InteractionContextType.BotDM,
|
|
47
|
+
InteractionContextType.PrivateChannel
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* All the components that the command is able to use.
|
|
52
|
+
* You mount these here so the handler can access them
|
|
53
|
+
*/
|
|
54
|
+
components?: BaseComponent[] = []
|
|
55
|
+
/**
|
|
56
|
+
* All the paginators that the command is able to use.
|
|
57
|
+
* You mount these here so the handler can access them
|
|
58
|
+
*/
|
|
59
|
+
// paginators?: Paginator[] = []
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Serializes the command into a JSON object that can be sent to Discord
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
serialize() {
|
|
66
|
+
// Only chat input commands can have descriptions
|
|
67
|
+
if (this.type === ApplicationCommandType.ChatInput) {
|
|
68
|
+
const data: RESTPostAPIApplicationCommandsJSONBody = {
|
|
69
|
+
name: this.name,
|
|
70
|
+
type: this.type,
|
|
71
|
+
description: this.description,
|
|
72
|
+
options: this.serializeOptions(),
|
|
73
|
+
integration_types: this.integrationTypes,
|
|
74
|
+
contexts: this.contexts
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return data
|
|
78
|
+
}
|
|
79
|
+
const data: RESTPostAPIApplicationCommandsJSONBody = {
|
|
80
|
+
name: this.name,
|
|
81
|
+
type: this.type,
|
|
82
|
+
options: this.serializeOptions(),
|
|
83
|
+
integration_types: this.integrationTypes,
|
|
84
|
+
contexts: this.contexts
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return data
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Serializes the options of the command into a JSON object that can be sent to Discord
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
abstract serializeOptions(): RESTPostAPIApplicationCommandsJSONBody["options"]
|
|
95
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { APIBaseComponent, ComponentType } from "discord-api-types/v10"
|
|
2
|
+
|
|
3
|
+
export type ComponentAdditionalData = {
|
|
4
|
+
[key: string]: string | number | boolean
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export abstract class BaseComponent {
|
|
8
|
+
constructor(data?: {
|
|
9
|
+
additionalData?: ComponentAdditionalData
|
|
10
|
+
}) {
|
|
11
|
+
if (data?.additionalData) this.additionalData = data.additionalData
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether the component response should be automatically deferred
|
|
16
|
+
*/
|
|
17
|
+
defer = false
|
|
18
|
+
/**
|
|
19
|
+
* Whether the component response should be ephemeral
|
|
20
|
+
*/
|
|
21
|
+
ephemeral = false
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The type of the component
|
|
25
|
+
*/
|
|
26
|
+
abstract type: ComponentType
|
|
27
|
+
/**
|
|
28
|
+
* The custom ID of the component
|
|
29
|
+
*/
|
|
30
|
+
abstract customId: string
|
|
31
|
+
|
|
32
|
+
additionalData: ComponentAdditionalData | null = null
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a custom ID to use for this component that embeds additional data that you want to be handed
|
|
36
|
+
* @param additionalData The additional data that you want to be passed in this component's custom ID
|
|
37
|
+
* @returns The custom ID to use
|
|
38
|
+
*/
|
|
39
|
+
public createId = (additionalData: typeof this.additionalData) => {
|
|
40
|
+
if (!additionalData) return this.customId
|
|
41
|
+
// id:arg1=1;arg2=2
|
|
42
|
+
const id = `${this.customId}:${Object.entries(additionalData)
|
|
43
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
44
|
+
.join(";")}`
|
|
45
|
+
return id
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
abstract serialize: () => APIBaseComponent<typeof this.type>
|
|
49
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
APIMessageComponentInteraction,
|
|
3
|
+
ComponentType
|
|
4
|
+
} from "discord-api-types/v10"
|
|
5
|
+
import type { Client } from "../classes/Client.js"
|
|
6
|
+
import { splitCustomId } from "../utils.js"
|
|
7
|
+
import { BaseInteraction } from "./BaseInteraction.js"
|
|
8
|
+
|
|
9
|
+
export class BaseComponentInteraction extends BaseInteraction<APIMessageComponentInteraction> {
|
|
10
|
+
customId: string
|
|
11
|
+
componentType: ComponentType
|
|
12
|
+
constructor(client: Client, data: APIMessageComponentInteraction) {
|
|
13
|
+
super(client, data)
|
|
14
|
+
if (!data.data)
|
|
15
|
+
throw new Error("Invalid interaction data was used to create this class")
|
|
16
|
+
this.customId = splitCustomId(data.data.custom_id)[0]
|
|
17
|
+
this.componentType = data.data.component_type
|
|
18
|
+
}
|
|
19
|
+
}
|