@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,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type APIGroupDMChannel,
|
|
3
|
+
ChannelType,
|
|
4
|
+
Routes
|
|
5
|
+
} from "discord-api-types/v10"
|
|
6
|
+
import { BaseChannel } from "../abstracts/BaseChannel.js"
|
|
7
|
+
import { Message } from "./Message.js"
|
|
8
|
+
import { User } from "./User.js"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents a group DM channel.
|
|
12
|
+
*/
|
|
13
|
+
export class GroupDmChannel extends BaseChannel<ChannelType.GroupDM> {
|
|
14
|
+
/**
|
|
15
|
+
* The name of the channel.
|
|
16
|
+
*/
|
|
17
|
+
name?: string | null
|
|
18
|
+
/**
|
|
19
|
+
* The recipients of the channel.
|
|
20
|
+
*/
|
|
21
|
+
recipients?: User[]
|
|
22
|
+
type: ChannelType.GroupDM = ChannelType.GroupDM
|
|
23
|
+
/**
|
|
24
|
+
* The ID of the application that created the channel, if it was created by a bot.
|
|
25
|
+
*/
|
|
26
|
+
applicationId?: string | null
|
|
27
|
+
/**
|
|
28
|
+
* The icon hash of the channel.
|
|
29
|
+
*/
|
|
30
|
+
icon?: string | null
|
|
31
|
+
/**
|
|
32
|
+
* The ID of the user who created the channel.
|
|
33
|
+
*/
|
|
34
|
+
ownerId?: string | null
|
|
35
|
+
/**
|
|
36
|
+
* The ID of the last message sent in the channel.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
|
|
40
|
+
*/
|
|
41
|
+
lastMessageId?: string | null
|
|
42
|
+
/**
|
|
43
|
+
* Whether the channel is managed by an Oauth2 application.
|
|
44
|
+
*/
|
|
45
|
+
managed?: boolean | null
|
|
46
|
+
|
|
47
|
+
protected setSpecificData(data: APIGroupDMChannel) {
|
|
48
|
+
this.name = data.name
|
|
49
|
+
this.recipients = data.recipients?.map((x) => new User(this.client, x))
|
|
50
|
+
this.applicationId = data.application_id
|
|
51
|
+
this.icon = data.icon
|
|
52
|
+
this.ownerId = data.owner_id
|
|
53
|
+
this.lastMessageId = data.last_message_id
|
|
54
|
+
this.managed = data.managed
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the URL of the channel's icon.
|
|
59
|
+
*/
|
|
60
|
+
get iconUrl(): string | null {
|
|
61
|
+
return this.icon
|
|
62
|
+
? `https://cdn.discordapp.com/channel-icons/${this.id}/${this.icon}.png`
|
|
63
|
+
: null
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get the owner of the channel.
|
|
68
|
+
*/
|
|
69
|
+
get owner(): User {
|
|
70
|
+
if (!this.ownerId) throw new Error("Cannot get owner without owner ID")
|
|
71
|
+
return new User(this.client, this.ownerId)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The last message sent in the channel.
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
|
|
79
|
+
* This will always return a partial message, so you can use {@link Message.fetch} to get the full message data.
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
get lastMessage() {
|
|
83
|
+
if (!this.lastMessageId) return null
|
|
84
|
+
return new Message(this.client, {
|
|
85
|
+
id: this.lastMessageId,
|
|
86
|
+
channel_id: this.id
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Set the name of the channel
|
|
92
|
+
* @param name The new name of the channel
|
|
93
|
+
*/
|
|
94
|
+
async setName(name: string) {
|
|
95
|
+
await this.client.rest.patch(Routes.channel(this.id), {
|
|
96
|
+
body: {
|
|
97
|
+
name
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
this.name = name
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async addRecipient(user: User | string) {
|
|
104
|
+
await this.client.rest.put(
|
|
105
|
+
Routes.channelRecipient(
|
|
106
|
+
this.id,
|
|
107
|
+
typeof user === "string" ? user : user.id
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
if (this.recipients)
|
|
111
|
+
this.recipients.push(
|
|
112
|
+
typeof user === "string" ? new User(this.client, user) : user
|
|
113
|
+
)
|
|
114
|
+
else
|
|
115
|
+
this.recipients = [
|
|
116
|
+
typeof user === "string" ? new User(this.client, user) : user
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async removeRecipient(user: User | string) {
|
|
121
|
+
await this.client.rest.delete(
|
|
122
|
+
Routes.channelRecipient(
|
|
123
|
+
this.id,
|
|
124
|
+
typeof user === "string" ? user : user.id
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
if (this.recipients)
|
|
128
|
+
this.recipients = this.recipients.filter(
|
|
129
|
+
(x) => x.id !== (typeof user === "string" ? user : user.id)
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type APIChannel,
|
|
3
|
+
type APIGuild,
|
|
4
|
+
type APIRole,
|
|
5
|
+
type RESTPostAPIGuildRoleJSONBody,
|
|
6
|
+
Routes
|
|
7
|
+
} from "discord-api-types/v10"
|
|
8
|
+
import { Base } from "../abstracts/Base.js"
|
|
9
|
+
import type { Client } from "../classes/Client.js"
|
|
10
|
+
import { channelFactory } from "../factories/channelFactory.js"
|
|
11
|
+
import { Role } from "./Role.js"
|
|
12
|
+
|
|
13
|
+
export class Guild extends Base {
|
|
14
|
+
/**
|
|
15
|
+
* The ID of the guild
|
|
16
|
+
*/
|
|
17
|
+
id: string
|
|
18
|
+
/**
|
|
19
|
+
* The name of the guild.
|
|
20
|
+
*/
|
|
21
|
+
name?: string
|
|
22
|
+
/**
|
|
23
|
+
* The description of the guild.
|
|
24
|
+
*/
|
|
25
|
+
description?: string | null
|
|
26
|
+
/**
|
|
27
|
+
* The icon hash of the guild.
|
|
28
|
+
* You can use {@link Guild.iconUrl} to get the URL of the icon.
|
|
29
|
+
*/
|
|
30
|
+
icon?: string | null
|
|
31
|
+
/**
|
|
32
|
+
* The splash hash of the guild.
|
|
33
|
+
* You can use {@link Guild.splashUrl} to get the URL of the splash.
|
|
34
|
+
*/
|
|
35
|
+
splash?: string | null
|
|
36
|
+
/**
|
|
37
|
+
* The ID of the owner of the guild.
|
|
38
|
+
*/
|
|
39
|
+
ownerId?: string
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether the guild is a partial guild (meaning it does not have all the data).
|
|
43
|
+
* If this is true, you should use {@link Guild.fetch} to get the full data of the guild.
|
|
44
|
+
*/
|
|
45
|
+
partial: boolean
|
|
46
|
+
|
|
47
|
+
private rawData: APIGuild | null = null
|
|
48
|
+
|
|
49
|
+
constructor(client: Client, rawDataOrId: APIGuild | string) {
|
|
50
|
+
super(client)
|
|
51
|
+
if (typeof rawDataOrId === "string") {
|
|
52
|
+
this.id = rawDataOrId
|
|
53
|
+
this.partial = true
|
|
54
|
+
} else {
|
|
55
|
+
this.rawData = rawDataOrId
|
|
56
|
+
this.id = rawDataOrId.id
|
|
57
|
+
this.partial = false
|
|
58
|
+
this.setData(rawDataOrId)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private setData(data: typeof this.rawData) {
|
|
63
|
+
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
64
|
+
this.rawData = data
|
|
65
|
+
this.name = data.name
|
|
66
|
+
this.description = data.description
|
|
67
|
+
this.icon = data.icon
|
|
68
|
+
this.splash = data.splash
|
|
69
|
+
this.ownerId = data.owner_id
|
|
70
|
+
this.partial = false
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Fetch updated data for this guild.
|
|
75
|
+
* If the guild is partial, this will fetch all the data for the guild and populate the fields.
|
|
76
|
+
* If the guild is not partial, all fields will be updated with new values from Discord.
|
|
77
|
+
*/
|
|
78
|
+
async fetch() {
|
|
79
|
+
const newData = (await this.client.rest.get(
|
|
80
|
+
Routes.guild(this.id)
|
|
81
|
+
)) as APIGuild
|
|
82
|
+
if (!newData) throw new Error(`Guild ${this.id}not found`)
|
|
83
|
+
|
|
84
|
+
this.setData(newData)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Leave the guild
|
|
89
|
+
*/
|
|
90
|
+
async leave() {
|
|
91
|
+
return await this.client.rest.delete(Routes.guild(this.id))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Create a role in the guild
|
|
96
|
+
*/
|
|
97
|
+
async createRole(data: RESTPostAPIGuildRoleJSONBody) {
|
|
98
|
+
const role = (await this.client.rest.post(Routes.guildRoles(this.id), {
|
|
99
|
+
body: {
|
|
100
|
+
...data
|
|
101
|
+
}
|
|
102
|
+
})) as APIRole
|
|
103
|
+
return new Role(this.client, role)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get the URL of the guild's icon
|
|
108
|
+
*/
|
|
109
|
+
get iconUrl(): string | null {
|
|
110
|
+
return this.icon
|
|
111
|
+
? `https://cdn.discordapp.com/icons/${this.id}/${this.icon}.png`
|
|
112
|
+
: null
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get the URL of the guild's splash
|
|
117
|
+
*/
|
|
118
|
+
get splashUrl(): string | null {
|
|
119
|
+
return this.splash
|
|
120
|
+
? `https://cdn.discordapp.com/splashes/${this.id}/${this.splash}.png`
|
|
121
|
+
: null
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get all roles in the guild
|
|
126
|
+
*/
|
|
127
|
+
get roles() {
|
|
128
|
+
const roles = this.rawData?.roles
|
|
129
|
+
if (!roles) throw new Error("Cannot get roles without having data... smh")
|
|
130
|
+
return roles.map((role) => new Role(this.client, role))
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Fetch a channel from the guild by ID
|
|
135
|
+
*/
|
|
136
|
+
async fetchChannel(channelId: string) {
|
|
137
|
+
const channel = (await this.client.rest.get(
|
|
138
|
+
Routes.channel(channelId)
|
|
139
|
+
)) as APIChannel
|
|
140
|
+
return channelFactory(this.client, channel)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChannelType, Routes } from "discord-api-types/v10"
|
|
2
|
+
import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js"
|
|
3
|
+
import type { GuildTextChannel } from "./GuildTextChannel.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a guild announcement channel.
|
|
7
|
+
*/
|
|
8
|
+
export class GuildAnnouncementChannel extends BaseGuildTextChannel<ChannelType.GuildAnnouncement> {
|
|
9
|
+
type: ChannelType.GuildAnnouncement = ChannelType.GuildAnnouncement
|
|
10
|
+
protected setMoreSpecificData() {}
|
|
11
|
+
|
|
12
|
+
async follow(targetChannel: GuildTextChannel | string) {
|
|
13
|
+
await this.client.rest.put(Routes.channelFollowers(this.id), {
|
|
14
|
+
body: {
|
|
15
|
+
webhook_channel_id:
|
|
16
|
+
typeof targetChannel === "string" ? targetChannel : targetChannel.id
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChannelType } from "discord-api-types/v10"
|
|
2
|
+
import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a guild category channel.
|
|
6
|
+
*/
|
|
7
|
+
export class GuildCategoryChannel extends BaseGuildChannel<ChannelType.GuildCategory> {
|
|
8
|
+
protected setSpecificData() {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* You cannot send a message to a category channel, so this method throws an error
|
|
12
|
+
*/
|
|
13
|
+
override async send(): Promise<void> {
|
|
14
|
+
throw new Error("Category channels cannot be sent to")
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
APIGuildForumChannel,
|
|
3
|
+
ChannelType,
|
|
4
|
+
ForumLayoutType
|
|
5
|
+
} from "discord-api-types/v10"
|
|
6
|
+
import { GuildThreadOnlyChannel } from "../abstracts/GuildThreadOnlyChannel.js"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents a guild forum channel.
|
|
10
|
+
*/
|
|
11
|
+
export class GuildForumChannel extends GuildThreadOnlyChannel<ChannelType.GuildForum> {
|
|
12
|
+
/**
|
|
13
|
+
* The default forum layout of the channel.
|
|
14
|
+
*/
|
|
15
|
+
defaultForumLayout?: ForumLayoutType
|
|
16
|
+
|
|
17
|
+
protected setMoreSpecificData(data: APIGuildForumChannel) {
|
|
18
|
+
this.defaultForumLayout = data.default_forum_layout
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChannelType, ForumLayoutType } from "discord-api-types/v10"
|
|
2
|
+
import { GuildThreadOnlyChannel } from "../abstracts/GuildThreadOnlyChannel.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a guild media channel (a forum channel )
|
|
6
|
+
*/
|
|
7
|
+
export class GuildMediaChannel extends GuildThreadOnlyChannel<ChannelType.GuildMedia> {
|
|
8
|
+
/**
|
|
9
|
+
* The default forum layout of the channel.
|
|
10
|
+
*/
|
|
11
|
+
defaultForumLayout?: ForumLayoutType
|
|
12
|
+
protected setMoreSpecificData() {}
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
APIGuildStageVoiceChannel,
|
|
3
|
+
APIGuildVoiceChannel,
|
|
4
|
+
ChannelType,
|
|
5
|
+
VideoQualityMode
|
|
6
|
+
} from "discord-api-types/v10"
|
|
7
|
+
import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
|
|
8
|
+
|
|
9
|
+
export abstract class GuildStageOrVoiceChannel<
|
|
10
|
+
Type extends ChannelType.GuildStageVoice | ChannelType.GuildVoice
|
|
11
|
+
> extends BaseGuildChannel<Type> {
|
|
12
|
+
/**
|
|
13
|
+
* The bitrate of the channel.
|
|
14
|
+
*/
|
|
15
|
+
bitrate?: number | null
|
|
16
|
+
/**
|
|
17
|
+
* The user limit of the channel.
|
|
18
|
+
*/
|
|
19
|
+
userLimit?: number | null
|
|
20
|
+
/**
|
|
21
|
+
* The RTC region of the channel.
|
|
22
|
+
* This is automatic when set to `null`.
|
|
23
|
+
*/
|
|
24
|
+
rtcRegion?: string | null
|
|
25
|
+
/**
|
|
26
|
+
* The video quality mode of the channel.
|
|
27
|
+
* 1 when not present.
|
|
28
|
+
*/
|
|
29
|
+
videoQualityMode?: VideoQualityMode | null
|
|
30
|
+
|
|
31
|
+
protected setSpecificData(
|
|
32
|
+
data: APIGuildStageVoiceChannel | APIGuildVoiceChannel
|
|
33
|
+
) {
|
|
34
|
+
this.bitrate = data.bitrate
|
|
35
|
+
this.userLimit = data.user_limit
|
|
36
|
+
this.rtcRegion = data.rtc_region
|
|
37
|
+
this.videoQualityMode = data.video_quality_mode
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class GuildStageChannel extends BaseGuildChannel<ChannelType.GuildStageVoice> {
|
|
42
|
+
protected setSpecificData() {}
|
|
43
|
+
}
|
|
44
|
+
export class GuildVoiceChannel extends BaseGuildChannel<ChannelType.GuildVoice> {
|
|
45
|
+
protected setSpecificData() {}
|
|
46
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type APIGuildTextChannel, ChannelType } from "discord-api-types/v10"
|
|
2
|
+
import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js"
|
|
3
|
+
|
|
4
|
+
export class GuildTextChannel extends BaseGuildTextChannel<ChannelType.GuildText> {
|
|
5
|
+
type: ChannelType.GuildText = ChannelType.GuildText
|
|
6
|
+
/**
|
|
7
|
+
* The default auto archive duration of threads in the channel.
|
|
8
|
+
*/
|
|
9
|
+
defaultAutoArchiveDuration?: number | null
|
|
10
|
+
/**
|
|
11
|
+
* The default thread rate limit per user of the channel.
|
|
12
|
+
*/
|
|
13
|
+
defaultThreadRateLimitPerUser?: number | null
|
|
14
|
+
|
|
15
|
+
protected setMoreSpecificData(
|
|
16
|
+
data: APIGuildTextChannel<ChannelType.GuildText>
|
|
17
|
+
) {
|
|
18
|
+
this.defaultAutoArchiveDuration = data.default_auto_archive_duration
|
|
19
|
+
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type APIThreadChannel,
|
|
3
|
+
Routes,
|
|
4
|
+
type ThreadChannelType
|
|
5
|
+
} from "discord-api-types/v10"
|
|
6
|
+
import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
|
|
7
|
+
|
|
8
|
+
export class GuildThreadChannel<
|
|
9
|
+
Type extends ThreadChannelType
|
|
10
|
+
> extends BaseGuildChannel<Type> {
|
|
11
|
+
/**
|
|
12
|
+
* Whether the thread is archived.
|
|
13
|
+
*/
|
|
14
|
+
archived?: boolean
|
|
15
|
+
/**
|
|
16
|
+
* The duration until the thread is auto archived.
|
|
17
|
+
*/
|
|
18
|
+
autoArchiveDuration?: number
|
|
19
|
+
/**
|
|
20
|
+
* The timestamp of when the thread was archived.
|
|
21
|
+
*/
|
|
22
|
+
archiveTimestamp?: string
|
|
23
|
+
/**
|
|
24
|
+
* Whether the thread is locked.
|
|
25
|
+
*/
|
|
26
|
+
locked?: boolean
|
|
27
|
+
/**
|
|
28
|
+
* Whether non-moderators can add other non-moderators to a thread; only available on private threads
|
|
29
|
+
*/
|
|
30
|
+
invitable?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* The timestamp of when the thread was created.
|
|
33
|
+
*/
|
|
34
|
+
createTimestamp?: string
|
|
35
|
+
/**
|
|
36
|
+
* The number of messages in the thread.
|
|
37
|
+
*/
|
|
38
|
+
messageCount?: number
|
|
39
|
+
/**
|
|
40
|
+
* The number of members in the thread.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* This is only accurate until 50, after that, Discord stops counting.
|
|
44
|
+
*/
|
|
45
|
+
memberCount?: number
|
|
46
|
+
/**
|
|
47
|
+
* The ID of the owner of the thread.
|
|
48
|
+
*/
|
|
49
|
+
ownerId?: string
|
|
50
|
+
/**
|
|
51
|
+
* The number of messages sent in the thread.
|
|
52
|
+
*/
|
|
53
|
+
totalMessageSent?: number
|
|
54
|
+
/**
|
|
55
|
+
* The tags applied to the thread.
|
|
56
|
+
*/
|
|
57
|
+
appliedTags?: string[]
|
|
58
|
+
|
|
59
|
+
protected setSpecificData(data: APIThreadChannel) {
|
|
60
|
+
this.archived = data.thread_metadata?.archived
|
|
61
|
+
this.autoArchiveDuration = data.thread_metadata?.auto_archive_duration
|
|
62
|
+
this.archiveTimestamp = data.thread_metadata?.archive_timestamp
|
|
63
|
+
this.locked = data.thread_metadata?.locked
|
|
64
|
+
this.invitable = data.thread_metadata?.invitable
|
|
65
|
+
this.createTimestamp = data.thread_metadata?.create_timestamp
|
|
66
|
+
this.messageCount = data.message_count
|
|
67
|
+
this.memberCount = data.member_count
|
|
68
|
+
this.ownerId = data.owner_id
|
|
69
|
+
this.totalMessageSent = data.total_message_sent
|
|
70
|
+
this.appliedTags = data.applied_tags
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Join the thread
|
|
75
|
+
*/
|
|
76
|
+
async join() {
|
|
77
|
+
await this.addMember("@me")
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Add a member to the thread
|
|
82
|
+
*/
|
|
83
|
+
async addMember(userId: string) {
|
|
84
|
+
await this.client.rest.put(Routes.threadMembers(this.id, userId))
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Leave the thread
|
|
89
|
+
*/
|
|
90
|
+
async leave() {
|
|
91
|
+
await this.removeMember("@me")
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the pinned messages in the thread
|
|
96
|
+
*/
|
|
97
|
+
async removeMember(userId: string) {
|
|
98
|
+
await this.client.rest.delete(Routes.threadMembers(this.id, userId))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Archive the thread
|
|
103
|
+
*/
|
|
104
|
+
async archive() {
|
|
105
|
+
await this.client.rest.patch(Routes.channel(this.id), {
|
|
106
|
+
body: { archive: true }
|
|
107
|
+
})
|
|
108
|
+
this.archived = true
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Unarchive the thread
|
|
113
|
+
*/
|
|
114
|
+
async unarchive() {
|
|
115
|
+
await this.client.rest.patch(Routes.channel(this.id), {
|
|
116
|
+
body: { archive: false }
|
|
117
|
+
})
|
|
118
|
+
this.archived = false
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Set the auto archive duration of the thread
|
|
123
|
+
*/
|
|
124
|
+
async setAutoArchiveDuration(duration: number) {
|
|
125
|
+
await this.client.rest.patch(Routes.channel(this.id), {
|
|
126
|
+
body: { auto_archive_duration: duration }
|
|
127
|
+
})
|
|
128
|
+
this.autoArchiveDuration = duration
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Lock the thread
|
|
133
|
+
*/
|
|
134
|
+
async lock() {
|
|
135
|
+
await this.client.rest.put(Routes.channel(this.id), {
|
|
136
|
+
body: { locked: true }
|
|
137
|
+
})
|
|
138
|
+
this.locked = true
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Unlock the thread
|
|
143
|
+
*/
|
|
144
|
+
async unlock() {
|
|
145
|
+
await this.client.rest.put(Routes.channel(this.id), {
|
|
146
|
+
body: { locked: false }
|
|
147
|
+
})
|
|
148
|
+
this.locked = false
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type APIChannel,
|
|
3
|
+
type APIMessage,
|
|
4
|
+
type APIThreadChannel,
|
|
5
|
+
type RESTPostAPIChannelThreadsJSONBody,
|
|
6
|
+
Routes
|
|
7
|
+
} from "discord-api-types/v10"
|
|
8
|
+
import { Base } from "../abstracts/Base.js"
|
|
9
|
+
import type { Client } from "../classes/Client.js"
|
|
10
|
+
import { channelFactory } from "../factories/channelFactory.js"
|
|
11
|
+
import { GuildThreadChannel } from "./GuildThreadChannel.js"
|
|
12
|
+
import { User } from "./User.js"
|
|
13
|
+
|
|
14
|
+
export class Message extends Base {
|
|
15
|
+
/**
|
|
16
|
+
* The ID of the message
|
|
17
|
+
*/
|
|
18
|
+
id: string
|
|
19
|
+
/**
|
|
20
|
+
* The ID of the channel the message is in
|
|
21
|
+
*/
|
|
22
|
+
channelId: string
|
|
23
|
+
/**
|
|
24
|
+
* Whether the message is a partial message (meaning it does not have all the data).
|
|
25
|
+
* If this is true, you should use {@link Message.fetch} to get the full data of the message.
|
|
26
|
+
*/
|
|
27
|
+
partial: boolean
|
|
28
|
+
|
|
29
|
+
private rawData: APIMessage | null = null
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
client: Client,
|
|
33
|
+
rawDataOrIds:
|
|
34
|
+
| APIMessage
|
|
35
|
+
| {
|
|
36
|
+
id: string
|
|
37
|
+
channel_id: string
|
|
38
|
+
}
|
|
39
|
+
) {
|
|
40
|
+
super(client)
|
|
41
|
+
this.id = rawDataOrIds.id
|
|
42
|
+
this.channelId = rawDataOrIds.channel_id
|
|
43
|
+
if (Object.keys(rawDataOrIds).length === 2) {
|
|
44
|
+
this.partial = true
|
|
45
|
+
} else {
|
|
46
|
+
this.partial = false
|
|
47
|
+
this.setData(rawDataOrIds as APIMessage)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private setData(data: typeof this.rawData) {
|
|
52
|
+
this.rawData = data
|
|
53
|
+
if (!data) throw new Error("Cannot set data without having data... smh")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Fetch updated data for this message.
|
|
58
|
+
* If the message is partial, this will fetch all the data for the message and populate the fields.
|
|
59
|
+
* If the message is not partial, all fields will be updated with new values from Discord.
|
|
60
|
+
*/
|
|
61
|
+
async fetch() {
|
|
62
|
+
const newData = (await this.client.rest.get(
|
|
63
|
+
Routes.channelMessage(this.channelId, this.id)
|
|
64
|
+
)) as APIMessage
|
|
65
|
+
if (!newData) throw new Error(`Message ${this.id} not found`)
|
|
66
|
+
|
|
67
|
+
this.setData(newData)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Delete this message from Discord
|
|
72
|
+
*/
|
|
73
|
+
async delete() {
|
|
74
|
+
return await this.client.rest.delete(
|
|
75
|
+
Routes.channelMessage(this.channelId, this.id)
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get author(): User | null {
|
|
80
|
+
if (this.rawData?.webhook_id) return null // TODO: Add webhook user
|
|
81
|
+
// Check if we have an additional property on the author object, in which case we have a full user object
|
|
82
|
+
if (this.rawData?.author.username)
|
|
83
|
+
return new User(this.client, this.rawData.author)
|
|
84
|
+
// This means we only have a partial user object
|
|
85
|
+
if (this.rawData?.author.id)
|
|
86
|
+
return new User(this.client, this.rawData.author.id)
|
|
87
|
+
return null
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async fetchChannel() {
|
|
91
|
+
const data = (await this.client.rest.get(
|
|
92
|
+
Routes.channel(this.channelId)
|
|
93
|
+
)) as APIChannel
|
|
94
|
+
return channelFactory(this.client, data)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Pin this message
|
|
99
|
+
*/
|
|
100
|
+
async pin() {
|
|
101
|
+
await this.client.rest.put(Routes.channelPin(this.channelId, this.id))
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Unpin this message
|
|
106
|
+
*/
|
|
107
|
+
async unpin() {
|
|
108
|
+
await this.client.rest.delete(Routes.channelPin(this.channelId, this.id))
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Start a thread with this message as the associated start message.
|
|
113
|
+
* If you want to start a thread without a start message, use {@link BaseGuildTextChannel.startThread}
|
|
114
|
+
*/
|
|
115
|
+
async startThread(data: RESTPostAPIChannelThreadsJSONBody) {
|
|
116
|
+
const thread = (await this.client.rest.post(
|
|
117
|
+
Routes.threads(this.channelId, this.id),
|
|
118
|
+
{
|
|
119
|
+
body: { ...data }
|
|
120
|
+
}
|
|
121
|
+
)) as APIThreadChannel
|
|
122
|
+
return new GuildThreadChannel(this.client, thread)
|
|
123
|
+
}
|
|
124
|
+
}
|