@buape/carbon 0.0.0-beta-20241008010229

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.
Files changed (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -0
  3. package/dist/package.json +34 -0
  4. package/dist/src/abstracts/AnySelectMenu.d.ts +31 -0
  5. package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -0
  6. package/dist/src/abstracts/AnySelectMenu.js +19 -0
  7. package/dist/src/abstracts/AnySelectMenu.js.map +1 -0
  8. package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +13 -0
  9. package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -0
  10. package/dist/src/abstracts/AnySelectMenuInteraction.js +21 -0
  11. package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -0
  12. package/dist/src/abstracts/Base.d.ts +10 -0
  13. package/dist/src/abstracts/Base.d.ts.map +1 -0
  14. package/dist/src/abstracts/Base.js +11 -0
  15. package/dist/src/abstracts/Base.js.map +1 -0
  16. package/dist/src/abstracts/BaseChannel.d.ts +45 -0
  17. package/dist/src/abstracts/BaseChannel.d.ts.map +1 -0
  18. package/dist/src/abstracts/BaseChannel.js +68 -0
  19. package/dist/src/abstracts/BaseChannel.js.map +1 -0
  20. package/dist/src/abstracts/BaseCommand.d.ts +58 -0
  21. package/dist/src/abstracts/BaseCommand.d.ts.map +1 -0
  22. package/dist/src/abstracts/BaseCommand.js +72 -0
  23. package/dist/src/abstracts/BaseCommand.js.map +1 -0
  24. package/dist/src/abstracts/BaseComponent.d.ts +34 -0
  25. package/dist/src/abstracts/BaseComponent.d.ts.map +1 -0
  26. package/dist/src/abstracts/BaseComponent.js +30 -0
  27. package/dist/src/abstracts/BaseComponent.js.map +1 -0
  28. package/dist/src/abstracts/BaseComponentInteraction.d.ts +19 -0
  29. package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -0
  30. package/dist/src/abstracts/BaseComponentInteraction.js +42 -0
  31. package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -0
  32. package/dist/src/abstracts/BaseGuildChannel.d.ts +70 -0
  33. package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -0
  34. package/dist/src/abstracts/BaseGuildChannel.js +143 -0
  35. package/dist/src/abstracts/BaseGuildChannel.js.map +1 -0
  36. package/dist/src/abstracts/BaseGuildTextChannel.d.ts +46 -0
  37. package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -0
  38. package/dist/src/abstracts/BaseGuildTextChannel.js +77 -0
  39. package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -0
  40. package/dist/src/abstracts/BaseInteraction.d.ts +92 -0
  41. package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -0
  42. package/dist/src/abstracts/BaseInteraction.js +152 -0
  43. package/dist/src/abstracts/BaseInteraction.js.map +1 -0
  44. package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +43 -0
  45. package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -0
  46. package/dist/src/abstracts/GuildThreadOnlyChannel.js +69 -0
  47. package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -0
  48. package/dist/src/classes/Button.d.ts +49 -0
  49. package/dist/src/classes/Button.d.ts.map +1 -0
  50. package/dist/src/classes/Button.js +61 -0
  51. package/dist/src/classes/Button.js.map +1 -0
  52. package/dist/src/classes/ChannelSelectMenu.d.ts +15 -0
  53. package/dist/src/classes/ChannelSelectMenu.d.ts.map +1 -0
  54. package/dist/src/classes/ChannelSelectMenu.js +15 -0
  55. package/dist/src/classes/ChannelSelectMenu.js.map +1 -0
  56. package/dist/src/classes/Client.d.ts +180 -0
  57. package/dist/src/classes/Client.d.ts.map +1 -0
  58. package/dist/src/classes/Client.js +263 -0
  59. package/dist/src/classes/Client.js.map +1 -0
  60. package/dist/src/classes/Command.d.ts +33 -0
  61. package/dist/src/classes/Command.d.ts.map +1 -0
  62. package/dist/src/classes/Command.js +31 -0
  63. package/dist/src/classes/Command.js.map +1 -0
  64. package/dist/src/classes/CommandWithSubcommandGroups.d.ts +22 -0
  65. package/dist/src/classes/CommandWithSubcommandGroups.d.ts.map +1 -0
  66. package/dist/src/classes/CommandWithSubcommandGroups.js +31 -0
  67. package/dist/src/classes/CommandWithSubcommandGroups.js.map +1 -0
  68. package/dist/src/classes/CommandWithSubcommands.d.ts +19 -0
  69. package/dist/src/classes/CommandWithSubcommands.d.ts.map +1 -0
  70. package/dist/src/classes/CommandWithSubcommands.js +21 -0
  71. package/dist/src/classes/CommandWithSubcommands.js.map +1 -0
  72. package/dist/src/classes/Embed.d.ts +61 -0
  73. package/dist/src/classes/Embed.d.ts.map +1 -0
  74. package/dist/src/classes/Embed.js +75 -0
  75. package/dist/src/classes/Embed.js.map +1 -0
  76. package/dist/src/classes/MentionableSelectMenu.d.ts +13 -0
  77. package/dist/src/classes/MentionableSelectMenu.d.ts.map +1 -0
  78. package/dist/src/classes/MentionableSelectMenu.js +13 -0
  79. package/dist/src/classes/MentionableSelectMenu.js.map +1 -0
  80. package/dist/src/classes/Modal.d.ts +21 -0
  81. package/dist/src/classes/Modal.d.ts.map +1 -0
  82. package/dist/src/classes/Modal.js +14 -0
  83. package/dist/src/classes/Modal.js.map +1 -0
  84. package/dist/src/classes/RoleSelectMenu.d.ts +13 -0
  85. package/dist/src/classes/RoleSelectMenu.d.ts.map +1 -0
  86. package/dist/src/classes/RoleSelectMenu.js +13 -0
  87. package/dist/src/classes/RoleSelectMenu.js.map +1 -0
  88. package/dist/src/classes/Row.d.ts +25 -0
  89. package/dist/src/classes/Row.d.ts.map +1 -0
  90. package/dist/src/classes/Row.js +40 -0
  91. package/dist/src/classes/Row.js.map +1 -0
  92. package/dist/src/classes/StringSelectMenu.d.ts +13 -0
  93. package/dist/src/classes/StringSelectMenu.d.ts.map +1 -0
  94. package/dist/src/classes/StringSelectMenu.js +12 -0
  95. package/dist/src/classes/StringSelectMenu.js.map +1 -0
  96. package/dist/src/classes/TextInput.d.ts +40 -0
  97. package/dist/src/classes/TextInput.d.ts.map +1 -0
  98. package/dist/src/classes/TextInput.js +44 -0
  99. package/dist/src/classes/TextInput.js.map +1 -0
  100. package/dist/src/classes/UserSelectMenu.d.ts +13 -0
  101. package/dist/src/classes/UserSelectMenu.d.ts.map +1 -0
  102. package/dist/src/classes/UserSelectMenu.js +13 -0
  103. package/dist/src/classes/UserSelectMenu.js.map +1 -0
  104. package/dist/src/factories/channelFactory.d.ts +13 -0
  105. package/dist/src/factories/channelFactory.d.ts.map +1 -0
  106. package/dist/src/factories/channelFactory.js +39 -0
  107. package/dist/src/factories/channelFactory.js.map +1 -0
  108. package/dist/src/index.d.ts +55 -0
  109. package/dist/src/index.d.ts.map +1 -0
  110. package/dist/src/index.js +61 -0
  111. package/dist/src/index.js.map +1 -0
  112. package/dist/src/internals/AutocompleteInteraction.d.ts +33 -0
  113. package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -0
  114. package/dist/src/internals/AutocompleteInteraction.js +61 -0
  115. package/dist/src/internals/AutocompleteInteraction.js.map +1 -0
  116. package/dist/src/internals/ButtonInteraction.d.ts +9 -0
  117. package/dist/src/internals/ButtonInteraction.d.ts.map +1 -0
  118. package/dist/src/internals/ButtonInteraction.js +18 -0
  119. package/dist/src/internals/ButtonInteraction.js.map +1 -0
  120. package/dist/src/internals/ChannelSelectMenuInteraction.d.ts +8 -0
  121. package/dist/src/internals/ChannelSelectMenuInteraction.d.ts.map +1 -0
  122. package/dist/src/internals/ChannelSelectMenuInteraction.js +11 -0
  123. package/dist/src/internals/ChannelSelectMenuInteraction.js.map +1 -0
  124. package/dist/src/internals/CommandHandler.d.ts +12 -0
  125. package/dist/src/internals/CommandHandler.d.ts.map +1 -0
  126. package/dist/src/internals/CommandHandler.js +89 -0
  127. package/dist/src/internals/CommandHandler.js.map +1 -0
  128. package/dist/src/internals/CommandInteraction.d.ts +16 -0
  129. package/dist/src/internals/CommandInteraction.d.ts.map +1 -0
  130. package/dist/src/internals/CommandInteraction.js +23 -0
  131. package/dist/src/internals/CommandInteraction.js.map +1 -0
  132. package/dist/src/internals/ComponentHandler.d.ts +17 -0
  133. package/dist/src/internals/ComponentHandler.d.ts.map +1 -0
  134. package/dist/src/internals/ComponentHandler.js +75 -0
  135. package/dist/src/internals/ComponentHandler.js.map +1 -0
  136. package/dist/src/internals/FieldsHandler.d.ts +27 -0
  137. package/dist/src/internals/FieldsHandler.d.ts.map +1 -0
  138. package/dist/src/internals/FieldsHandler.js +37 -0
  139. package/dist/src/internals/FieldsHandler.js.map +1 -0
  140. package/dist/src/internals/MentionableSelectMenuInteraction.d.ts +9 -0
  141. package/dist/src/internals/MentionableSelectMenuInteraction.d.ts.map +1 -0
  142. package/dist/src/internals/MentionableSelectMenuInteraction.js +15 -0
  143. package/dist/src/internals/MentionableSelectMenuInteraction.js.map +1 -0
  144. package/dist/src/internals/ModalHandler.d.ts +17 -0
  145. package/dist/src/internals/ModalHandler.d.ts.map +1 -0
  146. package/dist/src/internals/ModalHandler.js +25 -0
  147. package/dist/src/internals/ModalHandler.js.map +1 -0
  148. package/dist/src/internals/ModalInteraction.d.ts +22 -0
  149. package/dist/src/internals/ModalInteraction.d.ts.map +1 -0
  150. package/dist/src/internals/ModalInteraction.js +42 -0
  151. package/dist/src/internals/ModalInteraction.js.map +1 -0
  152. package/dist/src/internals/OptionsHandler.d.ts +82 -0
  153. package/dist/src/internals/OptionsHandler.d.ts.map +1 -0
  154. package/dist/src/internals/OptionsHandler.js +127 -0
  155. package/dist/src/internals/OptionsHandler.js.map +1 -0
  156. package/dist/src/internals/RoleSelectMenuInteraction.d.ts +9 -0
  157. package/dist/src/internals/RoleSelectMenuInteraction.d.ts.map +1 -0
  158. package/dist/src/internals/RoleSelectMenuInteraction.js +14 -0
  159. package/dist/src/internals/RoleSelectMenuInteraction.js.map +1 -0
  160. package/dist/src/internals/StringSelectMenuInteraction.d.ts +9 -0
  161. package/dist/src/internals/StringSelectMenuInteraction.d.ts.map +1 -0
  162. package/dist/src/internals/StringSelectMenuInteraction.js +14 -0
  163. package/dist/src/internals/StringSelectMenuInteraction.js.map +1 -0
  164. package/dist/src/internals/UserSelectMenuInteraction.d.ts +9 -0
  165. package/dist/src/internals/UserSelectMenuInteraction.d.ts.map +1 -0
  166. package/dist/src/internals/UserSelectMenuInteraction.js +14 -0
  167. package/dist/src/internals/UserSelectMenuInteraction.js.map +1 -0
  168. package/dist/src/plugins/linked-roles/LinkedRoles.d.ts +49 -0
  169. package/dist/src/plugins/linked-roles/LinkedRoles.d.ts.map +1 -0
  170. package/dist/src/plugins/linked-roles/LinkedRoles.js +164 -0
  171. package/dist/src/plugins/linked-roles/LinkedRoles.js.map +1 -0
  172. package/dist/src/plugins/linked-roles/index.d.ts +3 -0
  173. package/dist/src/plugins/linked-roles/index.d.ts.map +1 -0
  174. package/dist/src/plugins/linked-roles/index.js +3 -0
  175. package/dist/src/plugins/linked-roles/index.js.map +1 -0
  176. package/dist/src/plugins/linked-roles/types.d.ts +88 -0
  177. package/dist/src/plugins/linked-roles/types.d.ts.map +1 -0
  178. package/dist/src/plugins/linked-roles/types.js +39 -0
  179. package/dist/src/plugins/linked-roles/types.js.map +1 -0
  180. package/dist/src/structures/DmChannel.d.ts +19 -0
  181. package/dist/src/structures/DmChannel.d.ts.map +1 -0
  182. package/dist/src/structures/DmChannel.js +25 -0
  183. package/dist/src/structures/DmChannel.js.map +1 -0
  184. package/dist/src/structures/GroupDmChannel.d.ts +65 -0
  185. package/dist/src/structures/GroupDmChannel.d.ts.map +1 -0
  186. package/dist/src/structures/GroupDmChannel.js +116 -0
  187. package/dist/src/structures/GroupDmChannel.js.map +1 -0
  188. package/dist/src/structures/Guild.d.ts +77 -0
  189. package/dist/src/structures/Guild.d.ts.map +1 -0
  190. package/dist/src/structures/Guild.js +156 -0
  191. package/dist/src/structures/Guild.js.map +1 -0
  192. package/dist/src/structures/GuildAnnouncementChannel.d.ts +11 -0
  193. package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -0
  194. package/dist/src/structures/GuildAnnouncementChannel.js +15 -0
  195. package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -0
  196. package/dist/src/structures/GuildCategoryChannel.d.ts +13 -0
  197. package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -0
  198. package/dist/src/structures/GuildCategoryChannel.js +13 -0
  199. package/dist/src/structures/GuildCategoryChannel.js.map +1 -0
  200. package/dist/src/structures/GuildForumChannel.d.ts +14 -0
  201. package/dist/src/structures/GuildForumChannel.d.ts.map +1 -0
  202. package/dist/src/structures/GuildForumChannel.js +15 -0
  203. package/dist/src/structures/GuildForumChannel.js.map +1 -0
  204. package/dist/src/structures/GuildMediaChannel.d.ts +9 -0
  205. package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -0
  206. package/dist/src/structures/GuildMediaChannel.js +7 -0
  207. package/dist/src/structures/GuildMediaChannel.js.map +1 -0
  208. package/dist/src/structures/GuildMember.d.ts +111 -0
  209. package/dist/src/structures/GuildMember.d.ts.map +1 -0
  210. package/dist/src/structures/GuildMember.js +224 -0
  211. package/dist/src/structures/GuildMember.js.map +1 -0
  212. package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +31 -0
  213. package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -0
  214. package/dist/src/structures/GuildStageOrVoiceChannel.js +43 -0
  215. package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -0
  216. package/dist/src/structures/GuildTextChannel.d.ts +15 -0
  217. package/dist/src/structures/GuildTextChannel.d.ts.map +1 -0
  218. package/dist/src/structures/GuildTextChannel.js +20 -0
  219. package/dist/src/structures/GuildTextChannel.js.map +1 -0
  220. package/dist/src/structures/GuildThreadChannel.d.ts +90 -0
  221. package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -0
  222. package/dist/src/structures/GuildThreadChannel.js +165 -0
  223. package/dist/src/structures/GuildThreadChannel.js.map +1 -0
  224. package/dist/src/structures/Message.d.ts +153 -0
  225. package/dist/src/structures/Message.d.ts.map +1 -0
  226. package/dist/src/structures/Message.js +296 -0
  227. package/dist/src/structures/Message.js.map +1 -0
  228. package/dist/src/structures/Role.d.ts +108 -0
  229. package/dist/src/structures/Role.d.ts.map +1 -0
  230. package/dist/src/structures/Role.js +220 -0
  231. package/dist/src/structures/Role.js.map +1 -0
  232. package/dist/src/structures/User.d.ts +82 -0
  233. package/dist/src/structures/User.d.ts.map +1 -0
  234. package/dist/src/structures/User.js +166 -0
  235. package/dist/src/structures/User.js.map +1 -0
  236. package/dist/src/types.d.ts +37 -0
  237. package/dist/src/types.d.ts.map +1 -0
  238. package/dist/src/types.js +2 -0
  239. package/dist/src/types.js.map +1 -0
  240. package/dist/src/utils.d.ts +22 -0
  241. package/dist/src/utils.d.ts.map +1 -0
  242. package/dist/src/utils.js +79 -0
  243. package/dist/src/utils.js.map +1 -0
  244. package/dist/tsconfig.tsbuildinfo +1 -0
  245. package/package.json +34 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Buape Studios
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Carbon
2
+
3
+ <div align="center">
4
+ <a href="https://go.buape.com/carbon"><img src="https://cdn.buape.com/CarbonWordmark.png" alt="Carbon Wordmark"></a>
5
+
6
+ <img alt="Discord" src="https://img.shields.io/discord/1280628625904894072?style=for-the-badge">
7
+ <img alt="NPM Version" src="https://img.shields.io/npm/v/@buape/carbon?style=for-the-badge">
8
+ <img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@buape/carbon?style=for-the-badge">
9
+ </div>
10
+
11
+ Carbon is a fully-featured framework for building HTTP Discord bots, built in TypeScript and designed to be easy to use and understand.
12
+
13
+ ## Features
14
+
15
+ - Fully up to date with the Discord API
16
+ - Build to be both flexible and powerful
17
+ - Easy to use class-based system for reusability
18
+ - Built in pagination support (Soon!)
19
+ - Integration with Discord's Monetization (Soon!)
20
+
21
+ ## Why Carbon?
22
+
23
+ Carbon is designed to be easy to use and understand, while still providing the flexibility and power needed to build complex bots.
24
+ With Carbon, you can deploy it to many platforms, both physical and serverless, and it's easy to integrate with other frameworks and libraries.
25
+
26
+ ## Installation
27
+
28
+ To get started with Carbon, you can check out the [Getting Started](https://carbon.buape.com/carbon/getting-started) guides for your preferred platform.
29
+
30
+ ## Useful Links
31
+
32
+ - [Documentation](https://carbon.buape.com/carbon)
33
+ - [Discord](https://go.buape.com/carbon)
34
+ - [NPM](https://www.npmjs.com/package/@buape/carbon)
35
+ - [Cloudflare Workers Demo](https://github.com/buape/carbon/tree/main/apps/cloudo)
36
+ - [Node.js Demo](https://github.com/buape/carbon/tree/main/apps/rocko)
37
+
38
+ ## Contributing
39
+
40
+ We welcome contributions to Carbon! If you're interested in contributing, please check out the [Contributing Guide](https://carbon.buape.com/carbon/helpful-guides/contributing) for more information, and join our [Discord](https://go.buape.com/carbon) to get involved!
41
+
42
+ ### All Contributors
43
+
44
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
45
+ <!-- prettier-ignore-start -->
46
+ <!-- markdownlint-disable -->
47
+
48
+
49
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
50
+
51
+ <!-- markdownlint-restore -->
52
+ <!-- prettier-ignore-end -->
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@buape/carbon",
3
+ "version": "0.0.0-beta-20241008010229",
4
+ "type": "module",
5
+ "main": "./dist/src/index.js",
6
+ "repository": "github:buape/carbon",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/src/index.d.ts",
10
+ "import": "./dist/src/index.js"
11
+ },
12
+ "./*": {
13
+ "types": "./dist/src/plugins/*/index.d.ts",
14
+ "import": "./dist/src/plugins/*/index.js"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "dev": "tsc -w",
20
+ "docs": "typedoc"
21
+ },
22
+ "license": "MIT",
23
+ "dependencies": {
24
+ "@buape/carbon-request": "workspace:*",
25
+ "@types/node": "^20",
26
+ "discord-api-types": "0.37.101",
27
+ "discord-verify": "1.2.0",
28
+ "itty-router": "5.0.18"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "LICENSE"
33
+ ]
34
+ }
@@ -0,0 +1,31 @@
1
+ import type { APIChannelSelectComponent, APIMentionableSelectComponent, APIRoleSelectComponent, APISelectMenuComponent, APIStringSelectComponent, APIUserSelectComponent, ComponentType } from "discord-api-types/v10";
2
+ import type { AnySelectMenuInteraction } from "./AnySelectMenuInteraction.js";
3
+ import { BaseComponent } from "./BaseComponent.js";
4
+ export type AnySelectMenuComponentType = ComponentType.ChannelSelect | ComponentType.RoleSelect | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.MentionableSelect;
5
+ export declare abstract class AnySelectMenu extends BaseComponent {
6
+ abstract type: AnySelectMenuComponentType;
7
+ abstract run(interaction: AnySelectMenuInteraction): Promise<void>;
8
+ minValues?: number;
9
+ maxValues?: number;
10
+ disabled?: boolean;
11
+ placeholder?: string;
12
+ serialize: () => APISelectMenuComponent;
13
+ abstract serializeOptions(): {
14
+ type: ComponentType.ChannelSelect;
15
+ channel_types: APIChannelSelectComponent["channel_types"];
16
+ default_values: APIChannelSelectComponent["default_values"];
17
+ } | {
18
+ type: ComponentType.StringSelect;
19
+ options: APIStringSelectComponent["options"];
20
+ } | {
21
+ type: ComponentType.RoleSelect;
22
+ default_values: APIRoleSelectComponent["default_values"];
23
+ } | {
24
+ type: ComponentType.UserSelect;
25
+ default_values: APIUserSelectComponent["default_values"];
26
+ } | {
27
+ type: ComponentType.MentionableSelect;
28
+ default_values: APIMentionableSelectComponent["default_values"];
29
+ };
30
+ }
31
+ //# sourceMappingURL=AnySelectMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnySelectMenu.d.ts","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,MAAM,MAAM,0BAA0B,GACnC,aAAa,CAAC,aAAa,GAC3B,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,YAAY,GAC1B,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,iBAAiB,CAAA;AAElC,8BAAsB,aAAc,SAAQ,aAAa;IACxD,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAA;IACzC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAElE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,SAAS,QAAO,sBAAsB,CAUrC;IAED,QAAQ,CAAC,gBAAgB,IACtB;QACA,IAAI,EAAE,aAAa,CAAC,aAAa,CAAA;QACjC,aAAa,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAA;QACzD,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;KAC1D,GACD;QACA,IAAI,EAAE,aAAa,CAAC,YAAY,CAAA;QAChC,OAAO,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAA;KAC3C,GACD;QACA,IAAI,EAAE,aAAa,CAAC,UAAU,CAAA;QAC9B,cAAc,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;KACvD,GACD;QACA,IAAI,EAAE,aAAa,CAAC,UAAU,CAAA;QAC9B,cAAc,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;KACvD,GACD;QACA,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAA;QACrC,cAAc,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAA;KAC9D;CACJ"}
@@ -0,0 +1,19 @@
1
+ import { BaseComponent } from "./BaseComponent.js";
2
+ export class AnySelectMenu extends BaseComponent {
3
+ minValues;
4
+ maxValues;
5
+ disabled;
6
+ placeholder;
7
+ serialize = () => {
8
+ const options = this.serializeOptions();
9
+ return {
10
+ ...options,
11
+ custom_id: this.customId,
12
+ disabled: this.disabled,
13
+ placeholder: this.placeholder,
14
+ min_values: this.minValues,
15
+ max_values: this.maxValues
16
+ };
17
+ };
18
+ }
19
+ //# sourceMappingURL=AnySelectMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnySelectMenu.js","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenu.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AASlD,MAAM,OAAgB,aAAc,SAAQ,aAAa;IAIxD,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,QAAQ,CAAU;IAClB,WAAW,CAAS;IAEpB,SAAS,GAAG,GAA2B,EAAE;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAA;QACvC,OAAO;YACN,GAAG,OAAO;YACV,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,UAAU,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAA;IACF,CAAC,CAAA;CAwBD"}
@@ -0,0 +1,13 @@
1
+ import { type APIMessageComponentSelectMenuInteraction } from "discord-api-types/v10";
2
+ import type { Client } from "../classes/Client.js";
3
+ import { BaseComponentInteraction } from "./BaseComponentInteraction.js";
4
+ import type { InteractionDefaults } from "./BaseInteraction.js";
5
+ export declare abstract class AnySelectMenuInteraction extends BaseComponentInteraction {
6
+ customId: string;
7
+ constructor(client: Client, data: APIMessageComponentSelectMenuInteraction, defaults: InteractionDefaults);
8
+ /**
9
+ * The raw IDs of the selected options (either role/string/channel IDs or the IDs you provided in your options)
10
+ */
11
+ get values(): string[];
12
+ }
13
+ //# sourceMappingURL=AnySelectMenuInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnySelectMenuInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,wCAAwC,EAG7C,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,8BAAsB,wBAAyB,SAAQ,wBAAwB;IAC9E,QAAQ,EAAE,MAAM,CAEZ;gBAEH,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,wCAAwC,EAC9C,QAAQ,EAAE,mBAAmB;IAU9B;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;CACD"}
@@ -0,0 +1,21 @@
1
+ import { InteractionType } from "discord-api-types/v10";
2
+ import { splitCustomId } from "../utils.js";
3
+ import { BaseComponentInteraction } from "./BaseComponentInteraction.js";
4
+ export class AnySelectMenuInteraction extends BaseComponentInteraction {
5
+ customId = splitCustomId(this.rawData.data.custom_id)[0];
6
+ constructor(client, data, defaults) {
7
+ super(client, data, defaults);
8
+ if (!data.data)
9
+ throw new Error("Invalid interaction data was used to create this class");
10
+ if (data.type !== InteractionType.MessageComponent) {
11
+ throw new Error("Invalid interaction type was used to create this class");
12
+ }
13
+ }
14
+ /**
15
+ * The raw IDs of the selected options (either role/string/channel IDs or the IDs you provided in your options)
16
+ */
17
+ get values() {
18
+ return this.rawData.data.values;
19
+ }
20
+ }
21
+ //# sourceMappingURL=AnySelectMenuInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnySelectMenuInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,eAAe,EACf,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAGxE,MAAM,OAAgB,wBAAyB,SAAQ,wBAAwB;IAC9E,QAAQ,GAAW,aAAa,CAC9B,IAAI,CAAC,OAAO,CAAC,IAA4C,CAAC,SAAS,CACpE,CAAC,CAAC,CAAC,CAAA;IACJ,YACC,MAAc,EACd,IAA8C,EAC9C,QAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI;YACb,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;IACF,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACT,OAAQ,IAAI,CAAC,OAAO,CAAC,IAA4C,CAAC,MAAM,CAAA;IACzE,CAAC;CACD"}
@@ -0,0 +1,10 @@
1
+ import type { Client } from "../classes/Client.js";
2
+ /**
3
+ * The base class that all classes extend from
4
+ * @hidden
5
+ */
6
+ export declare class Base {
7
+ client: Client;
8
+ constructor(client: Client);
9
+ }
10
+ //# sourceMappingURL=Base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../../src/abstracts/Base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD;;;GAGG;AACH,qBAAa,IAAI;IAChB,MAAM,EAAE,MAAM,CAAA;gBACF,MAAM,EAAE,MAAM;CAG1B"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The base class that all classes extend from
3
+ * @hidden
4
+ */
5
+ export class Base {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ }
11
+ //# sourceMappingURL=Base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../src/abstracts/Base.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,IAAI;IAChB,MAAM,CAAQ;IACd,YAAY,MAAc;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;CACD"}
@@ -0,0 +1,45 @@
1
+ import { type APIChannel, type ChannelFlags, type ChannelType } from "discord-api-types/v10";
2
+ import type { Client } from "../classes/Client.js";
3
+ import type { IfPartial } from "../utils.js";
4
+ import { Base } from "./Base.js";
5
+ export declare abstract class BaseChannel<Type extends ChannelType, IsPartial extends boolean = false> extends Base {
6
+ constructor(client: Client, rawDataOrId: IsPartial extends true ? string : Extract<APIChannel, {
7
+ type: Type;
8
+ }>);
9
+ /**
10
+ * The raw data of the channel.
11
+ */
12
+ protected rawData: Extract<APIChannel, {
13
+ type: Type;
14
+ }> | null;
15
+ protected setData(data: Extract<APIChannel, {
16
+ type: Type;
17
+ }>): void;
18
+ protected setField(field: keyof Extract<APIChannel, {
19
+ type: Type;
20
+ }>, value: unknown): void;
21
+ /**
22
+ * The id of the channel.
23
+ */
24
+ readonly id: string;
25
+ /**
26
+ * Whether the channel is a partial channel (meaning it does not have all the data).
27
+ * If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
28
+ */
29
+ get partial(): IsPartial;
30
+ /**
31
+ * The type of the channel.
32
+ */
33
+ get type(): IfPartial<IsPartial, Type>;
34
+ /**
35
+ * The flags of the channel in a bitfield.
36
+ * @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
37
+ */
38
+ get flags(): IfPartial<IsPartial, ChannelFlags | undefined>;
39
+ /**
40
+ * Fetches the channel from the API.
41
+ * @returns The channel data.
42
+ */
43
+ fetch(): Promise<void>;
44
+ }
45
+ //# sourceMappingURL=BaseChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,8BAAsB,WAAW,CAChC,IAAI,SAAS,WAAW,EACxB,SAAS,SAAS,OAAO,GAAG,KAAK,CAChC,SAAQ,IAAI;gBAEZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,SAAS,SAAS,IAAI,GAChC,MAAM,GACN,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAYvC;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,GAAG,IAAI,CAAO;IACpE,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAI3D,SAAS,CAAC,QAAQ,CACjB,KAAK,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,EAChD,KAAK,EAAE,OAAO;IAOf;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,IAAI,OAAO,IAAI,SAAS,CAEvB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAGrC;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,SAAS,CAAC,SAAS,EAAE,YAAY,GAAG,SAAS,CAAC,CAG1D;IAED;;;OAGG;IACG,KAAK;CAQX"}
@@ -0,0 +1,68 @@
1
+ import { Routes } from "discord-api-types/v10";
2
+ import { Base } from "./Base.js";
3
+ export class BaseChannel extends Base {
4
+ constructor(client, rawDataOrId) {
5
+ super(client);
6
+ if (typeof rawDataOrId === "string") {
7
+ this.id = rawDataOrId;
8
+ }
9
+ else {
10
+ this.rawData = rawDataOrId;
11
+ this.id = rawDataOrId.id;
12
+ this.setData(rawDataOrId);
13
+ }
14
+ }
15
+ /**
16
+ * The raw data of the channel.
17
+ */
18
+ rawData = null;
19
+ setData(data) {
20
+ if (!data)
21
+ throw new Error("Cannot set data without having data... smh");
22
+ this.rawData = data;
23
+ }
24
+ setField(field, value) {
25
+ if (!this.rawData)
26
+ throw new Error("Cannot set field without having data... smh");
27
+ this.rawData[field] = value;
28
+ }
29
+ /**
30
+ * The id of the channel.
31
+ */
32
+ id;
33
+ /**
34
+ * Whether the channel is a partial channel (meaning it does not have all the data).
35
+ * If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
36
+ */
37
+ get partial() {
38
+ return (this.rawData === null);
39
+ }
40
+ /**
41
+ * The type of the channel.
42
+ */
43
+ get type() {
44
+ if (!this.rawData)
45
+ return undefined;
46
+ return this.rawData.type;
47
+ }
48
+ /**
49
+ * The flags of the channel in a bitfield.
50
+ * @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
51
+ */
52
+ get flags() {
53
+ if (!this.rawData)
54
+ return undefined;
55
+ return this.rawData.flags;
56
+ }
57
+ /**
58
+ * Fetches the channel from the API.
59
+ * @returns The channel data.
60
+ */
61
+ async fetch() {
62
+ const newData = (await this.client.rest.get(Routes.channel(this.id)));
63
+ if (!newData)
64
+ throw new Error(`Channel ${this.id} not found`);
65
+ this.setData(newData);
66
+ }
67
+ }
68
+ //# sourceMappingURL=BaseChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseChannel.js","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,MAAM,EACN,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,OAAgB,WAGpB,SAAQ,IAAI;IACb,YACC,MAAc,EACd,WAEsC;QAEtC,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAA;QACtB,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,OAAO,GAAG,WAAoB,CAAA;YACnC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,EAAE,CAAA;YACxB,IAAI,CAAC,OAAO,CAAC,WAAoB,CAAC,CAAA;QACnC,CAAC;IACF,CAAC;IAED;;OAEG;IACO,OAAO,GAA+C,IAAI,CAAA;IAC1D,OAAO,CAAC,IAAyC;QAC1D,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;QACxE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;IACpB,CAAC;IACS,QAAQ,CACjB,KAAgD,EAChD,KAAc;QAEd,IAAI,CAAC,IAAI,CAAC,OAAO;YAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAC/D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAA;IAC5B,CAAC;IAED;;OAEG;IACM,EAAE,CAAQ;IAEnB;;;OAGG;IACH,IAAI,OAAO;QACV,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,CAAU,CAAA;IACxC,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACP,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IACzB,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACR,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAA;IAC1B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACV,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAC1C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CACvB,CAAwC,CAAA;QACzC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,EAAE,YAAY,CAAC,CAAA;QAE7D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACtB,CAAC;CACD"}
@@ -0,0 +1,58 @@
1
+ import { ApplicationCommandType, type RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10";
2
+ import { ApplicationIntegrationType, type BaseComponent, InteractionContextType, type Modal } from "../index.js";
3
+ /**
4
+ * Represents the base data of a command that the user creates
5
+ */
6
+ export declare abstract class BaseCommand {
7
+ /**
8
+ * The name of the command (e.g. "ping" for /ping)
9
+ */
10
+ abstract name: string;
11
+ /**
12
+ * A description of the command
13
+ */
14
+ abstract description: string;
15
+ /**
16
+ * Whether the command response should be automatically deferred
17
+ */
18
+ defer: boolean;
19
+ /**
20
+ * Whether the command response should be ephemeral
21
+ */
22
+ ephemeral: boolean;
23
+ /**
24
+ * The type of the command
25
+ */
26
+ abstract type: ApplicationCommandType;
27
+ /**
28
+ * The places this command can be used in
29
+ * @beta API types are not finalized
30
+ */
31
+ integrationTypes: ApplicationIntegrationType[];
32
+ /**
33
+ * The contexts this command can be used in
34
+ * @beta API types are not finalized
35
+ */
36
+ contexts: InteractionContextType[];
37
+ /**
38
+ * The components that the command is able to use.
39
+ * You pass these here so the handler can listen for them..
40
+ */
41
+ components: (new () => BaseComponent)[];
42
+ /**
43
+ * All the modals that the command is able to use.
44
+ * You pass these here so the handler can listen for them.
45
+ */
46
+ modals: (new () => Modal)[];
47
+ /**
48
+ * Serializes the command into a JSON object that can be sent to Discord
49
+ * @internal
50
+ */
51
+ serialize(): import("discord-api-types/v10").RESTPostAPIChatInputApplicationCommandsJSONBody | import("discord-api-types/v10").RESTPostAPIContextMenuApplicationCommandsJSONBody;
52
+ /**
53
+ * Serializes the options of the command into a JSON object that can be sent to Discord
54
+ * @internal
55
+ */
56
+ abstract serializeOptions(): RESTPostAPIApplicationCommandsJSONBody["options"];
57
+ }
58
+ //# sourceMappingURL=BaseCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseCommand.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,KAAK,sCAAsC,EAC3C,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,0BAA0B,EAC1B,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,KAAK,EACV,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,8BAAsB,WAAW;IAChC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,KAAK,UAAQ;IACb;;OAEG;IACH,SAAS,UAAQ;IACjB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;IACrC;;;OAGG;IACH,gBAAgB,EAAE,0BAA0B,EAAE,CAG7C;IACD;;;OAGG;IACH,QAAQ,EAAE,sBAAsB,EAAE,CAIjC;IAED;;;OAGG;IACH,UAAU,EAAE,CAAC,UAAU,aAAa,CAAC,EAAE,CAAK;IAE5C;;;OAGG;IACH,MAAM,EAAE,CAAC,UAAU,KAAK,CAAC,EAAE,CAAK;IAEhC;;;OAGG;IACH,SAAS;IA4BT;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,IAAI,sCAAsC,CAAC,SAAS,CAAC;CAC9E"}
@@ -0,0 +1,72 @@
1
+ import { ApplicationCommandType } from "discord-api-types/v10";
2
+ import { ApplicationIntegrationType, InteractionContextType } from "../index.js";
3
+ /**
4
+ * Represents the base data of a command that the user creates
5
+ */
6
+ export class BaseCommand {
7
+ /**
8
+ * Whether the command response should be automatically deferred
9
+ */
10
+ defer = false;
11
+ /**
12
+ * Whether the command response should be ephemeral
13
+ */
14
+ ephemeral = false;
15
+ /**
16
+ * The places this command can be used in
17
+ * @beta API types are not finalized
18
+ */
19
+ integrationTypes = [
20
+ ApplicationIntegrationType.GuildInstall,
21
+ ApplicationIntegrationType.UserInstall
22
+ ];
23
+ /**
24
+ * The contexts this command can be used in
25
+ * @beta API types are not finalized
26
+ */
27
+ contexts = [
28
+ InteractionContextType.Guild,
29
+ InteractionContextType.BotDM,
30
+ InteractionContextType.PrivateChannel
31
+ ];
32
+ /**
33
+ * The components that the command is able to use.
34
+ * You pass these here so the handler can listen for them..
35
+ */
36
+ components = [];
37
+ /**
38
+ * All the modals that the command is able to use.
39
+ * You pass these here so the handler can listen for them.
40
+ */
41
+ modals = [];
42
+ /**
43
+ * Serializes the command into a JSON object that can be sent to Discord
44
+ * @internal
45
+ */
46
+ serialize() {
47
+ if (this.type === ApplicationCommandType.PrimaryEntryPoint) {
48
+ throw new Error("Primary Entry Point commands cannot be serialized");
49
+ }
50
+ // Only chat input commands can have descriptions
51
+ if (this.type === ApplicationCommandType.ChatInput) {
52
+ const data = {
53
+ name: this.name,
54
+ type: this.type,
55
+ description: this.description,
56
+ options: this.serializeOptions(),
57
+ integration_types: this.integrationTypes,
58
+ contexts: this.contexts
59
+ };
60
+ return data;
61
+ }
62
+ const data = {
63
+ name: this.name,
64
+ type: this.type,
65
+ options: this.serializeOptions(),
66
+ integration_types: this.integrationTypes,
67
+ contexts: this.contexts
68
+ };
69
+ return data;
70
+ }
71
+ }
72
+ //# sourceMappingURL=BaseCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseCommand.js","sourceRoot":"","sources":["../../../src/abstracts/BaseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EAEtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,0BAA0B,EAE1B,sBAAsB,EAEtB,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,MAAM,OAAgB,WAAW;IAShC;;OAEG;IACH,KAAK,GAAG,KAAK,CAAA;IACb;;OAEG;IACH,SAAS,GAAG,KAAK,CAAA;IAKjB;;;OAGG;IACH,gBAAgB,GAAiC;QAChD,0BAA0B,CAAC,YAAY;QACvC,0BAA0B,CAAC,WAAW;KACtC,CAAA;IACD;;;OAGG;IACH,QAAQ,GAA6B;QACpC,sBAAsB,CAAC,KAAK;QAC5B,sBAAsB,CAAC,KAAK;QAC5B,sBAAsB,CAAC,cAAc;KACrC,CAAA;IAED;;;OAGG;IACH,UAAU,GAAgC,EAAE,CAAA;IAE5C;;;OAGG;IACH,MAAM,GAAwB,EAAE,CAAA;IAEhC;;;OAGG;IACH,SAAS;QACR,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,iBAAiB,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;QACrE,CAAC;QACD,iDAAiD;QACjD,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,SAAS,EAAE,CAAC;YACpD,MAAM,IAAI,GAA2C;gBACpD,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE;gBAChC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;gBACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACvB,CAAA;YAED,OAAO,IAAI,CAAA;QACZ,CAAC;QACD,MAAM,IAAI,GAA2C;YACpD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE;YAChC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;YACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAA;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;CAOD"}
@@ -0,0 +1,34 @@
1
+ import type { APIBaseComponent, ComponentType } from "discord-api-types/v10";
2
+ export type ComponentAdditionalData = {
3
+ [key: string]: string | number | boolean;
4
+ };
5
+ export declare abstract class BaseComponent {
6
+ constructor(data?: {
7
+ additionalData?: ComponentAdditionalData;
8
+ });
9
+ /**
10
+ * Whether the component response should be automatically deferred
11
+ */
12
+ defer: boolean;
13
+ /**
14
+ * Whether the component response should be ephemeral
15
+ */
16
+ ephemeral: boolean;
17
+ /**
18
+ * The type of the component
19
+ */
20
+ abstract type: ComponentType;
21
+ /**
22
+ * The custom ID of the component
23
+ */
24
+ abstract customId: string;
25
+ additionalData: ComponentAdditionalData | null;
26
+ /**
27
+ * Create a custom ID to use for this component that embeds additional data that you want to be handed
28
+ * @param additionalData The additional data that you want to be passed in this component's custom ID
29
+ * @returns The custom ID to use
30
+ */
31
+ createId: (additionalData: typeof this.additionalData) => string;
32
+ abstract serialize: () => APIBaseComponent<typeof this.type>;
33
+ }
34
+ //# sourceMappingURL=BaseComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE5E,MAAM,MAAM,uBAAuB,GAAG;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CACxC,CAAA;AAED,8BAAsB,aAAa;gBACtB,IAAI,CAAC,EAAE;QAClB,cAAc,CAAC,EAAE,uBAAuB,CAAA;KACxC;IAID;;OAEG;IACH,KAAK,UAAQ;IACb;;OAEG;IACH,SAAS,UAAQ;IAEjB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB,cAAc,EAAE,uBAAuB,GAAG,IAAI,CAAO;IAErD;;;;OAIG;IACI,QAAQ,mBAAoB,OAAO,IAAI,CAAC,cAAc,YAO5D;IAED,QAAQ,CAAC,SAAS,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAA;CAC5D"}
@@ -0,0 +1,30 @@
1
+ export class BaseComponent {
2
+ constructor(data) {
3
+ if (data?.additionalData)
4
+ this.additionalData = data.additionalData;
5
+ }
6
+ /**
7
+ * Whether the component response should be automatically deferred
8
+ */
9
+ defer = false;
10
+ /**
11
+ * Whether the component response should be ephemeral
12
+ */
13
+ ephemeral = false;
14
+ additionalData = null;
15
+ /**
16
+ * Create a custom ID to use for this component that embeds additional data that you want to be handed
17
+ * @param additionalData The additional data that you want to be passed in this component's custom ID
18
+ * @returns The custom ID to use
19
+ */
20
+ createId = (additionalData) => {
21
+ if (!additionalData)
22
+ return this.customId;
23
+ // id:arg1=1;arg2=2
24
+ const id = `${this.customId}:${Object.entries(additionalData)
25
+ .map(([key, value]) => `${key}=${value}`)
26
+ .join(";")}`;
27
+ return id;
28
+ };
29
+ }
30
+ //# sourceMappingURL=BaseComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseComponent.js","sourceRoot":"","sources":["../../../src/abstracts/BaseComponent.ts"],"names":[],"mappings":"AAMA,MAAM,OAAgB,aAAa;IAClC,YAAY,IAEX;QACA,IAAI,IAAI,EAAE,cAAc;YAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;IACpE,CAAC;IAED;;OAEG;IACH,KAAK,GAAG,KAAK,CAAA;IACb;;OAEG;IACH,SAAS,GAAG,KAAK,CAAA;IAWjB,cAAc,GAAmC,IAAI,CAAA;IAErD;;;;OAIG;IACI,QAAQ,GAAG,CAAC,cAA0C,EAAE,EAAE;QAChE,IAAI,CAAC,cAAc;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAA;QACzC,mBAAmB;QACnB,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;aAC3D,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;aACxC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;QACb,OAAO,EAAE,CAAA;IACV,CAAC,CAAA;CAGD"}
@@ -0,0 +1,19 @@
1
+ import { type APIMessageComponentInteraction, type ComponentType } from "discord-api-types/v10";
2
+ import type { Client } from "../classes/Client.js";
3
+ import type { MessagePayload } from "../types.js";
4
+ import { BaseInteraction, type InteractionDefaults, type InteractionReplyOptions } from "./BaseInteraction.js";
5
+ export declare class BaseComponentInteraction extends BaseInteraction<APIMessageComponentInteraction> {
6
+ customId: string;
7
+ componentType: ComponentType;
8
+ constructor(client: Client, data: APIMessageComponentInteraction, defaults: InteractionDefaults);
9
+ /**
10
+ * Acknowledge the interaction, the user does not see a loading state.
11
+ * This can only be used for component interactions
12
+ */
13
+ acknowledge(): Promise<void>;
14
+ /**
15
+ * Update the original message of the component
16
+ */
17
+ update(data: MessagePayload, options?: Pick<InteractionReplyOptions, "files">): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=BaseComponentInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseComponentInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseComponentInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,8BAA8B,EACnC,KAAK,aAAa,EAIlB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,MAAM,sBAAsB,CAAA;AAE7B,qBAAa,wBAAyB,SAAQ,eAAe,CAAC,8BAA8B,CAAC;IAC5F,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,aAAa,CAAA;gBAE3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,8BAA8B,EACpC,QAAQ,EAAE,mBAAmB;IAS9B;;;OAGG;IACG,WAAW;IAYjB;;OAEG;IACG,MAAM,CACX,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAM;CAgBrD"}