@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
@@ -0,0 +1,9 @@
1
+ import { type APIMessageComponentButtonInteraction } from "discord-api-types/v10";
2
+ import { BaseComponentInteraction } from "../abstracts/BaseComponentInteraction.js";
3
+ import type { InteractionDefaults } from "../abstracts/BaseInteraction.js";
4
+ import type { Client } from "../classes/Client.js";
5
+ export declare class ButtonInteraction extends BaseComponentInteraction {
6
+ customId: string;
7
+ constructor(client: Client, data: APIMessageComponentButtonInteraction, defaults: InteractionDefaults);
8
+ }
9
+ //# sourceMappingURL=ButtonInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/ButtonInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,oCAAoC,EAGzC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,qBAAa,iBAAkB,SAAQ,wBAAwB;IAC9D,QAAQ,EAAE,MAAM,CAEZ;gBAEH,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,oCAAoC,EAC1C,QAAQ,EAAE,mBAAmB;CAY9B"}
@@ -0,0 +1,18 @@
1
+ import { ComponentType, InteractionType } from "discord-api-types/v10";
2
+ import { BaseComponentInteraction } from "../abstracts/BaseComponentInteraction.js";
3
+ import { splitCustomId } from "../utils.js";
4
+ export class ButtonInteraction 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
+ if (data.data.component_type !== ComponentType.Button) {
14
+ throw new Error("Invalid component type was used to create this class");
15
+ }
16
+ }
17
+ }
18
+ //# sourceMappingURL=ButtonInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonInteraction.js","sourceRoot":"","sources":["../../../src/internals/ButtonInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,aAAa,EACb,eAAe,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAGnF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,OAAO,iBAAkB,SAAQ,wBAAwB;IAC9D,QAAQ,GAAW,aAAa,CAC9B,IAAI,CAAC,OAAO,CAAC,IAAwC,CAAC,SAAS,CAChE,CAAC,CAAC,CAAC,CAAA;IACJ,YACC,MAAc,EACd,IAA0C,EAC1C,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;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,aAAa,CAAC,MAAM,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACxE,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,8 @@
1
+ import { type APIMessageComponentSelectMenuInteraction } from "discord-api-types/v10";
2
+ import { AnySelectMenuInteraction } from "../abstracts/AnySelectMenuInteraction.js";
3
+ import type { InteractionDefaults } from "../abstracts/BaseInteraction.js";
4
+ import type { Client } from "../classes/Client.js";
5
+ export declare class ChannelSelectMenuInteraction extends AnySelectMenuInteraction {
6
+ constructor(client: Client, data: APIMessageComponentSelectMenuInteraction, defaults: InteractionDefaults);
7
+ }
8
+ //# sourceMappingURL=ChannelSelectMenuInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChannelSelectMenuInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/ChannelSelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,wCAAwC,EAE7C,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,qBAAa,4BAA6B,SAAQ,wBAAwB;gBAExE,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,wCAAwC,EAC9C,QAAQ,EAAE,mBAAmB;CAO9B"}
@@ -0,0 +1,11 @@
1
+ import { ComponentType } from "discord-api-types/v10";
2
+ import { AnySelectMenuInteraction } from "../abstracts/AnySelectMenuInteraction.js";
3
+ export class ChannelSelectMenuInteraction extends AnySelectMenuInteraction {
4
+ constructor(client, data, defaults) {
5
+ super(client, data, defaults);
6
+ if (data.data.component_type !== ComponentType.ChannelSelect) {
7
+ throw new Error("Invalid component type was used to create this class");
8
+ }
9
+ }
10
+ }
11
+ //# sourceMappingURL=ChannelSelectMenuInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChannelSelectMenuInteraction.js","sourceRoot":"","sources":["../../../src/internals/ChannelSelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAInF,MAAM,OAAO,4BAA6B,SAAQ,wBAAwB;IACzE,YACC,MAAc,EACd,IAA8C,EAC9C,QAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,aAAa,CAAC,aAAa,EAAE,CAAC;YAC9D,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACxE,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction } from "discord-api-types/v10";
2
+ import { Base } from "../abstracts/Base.js";
3
+ export declare class CommandHandler extends Base {
4
+ private getCommand;
5
+ /**
6
+ * Handle a command interaction
7
+ * @internal
8
+ */
9
+ handleCommandInteraction(rawInteraction: APIApplicationCommandInteraction): Promise<false | void>;
10
+ handleAutocompleteInteraction(rawInteraction: APIApplicationCommandAutocompleteInteraction): Promise<false | void>;
11
+ }
12
+ //# sourceMappingURL=CommandHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/CommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,4CAA4C,EACjD,KAAK,gCAAgC,EAIrC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAO3C,qBAAa,cAAe,SAAQ,IAAI;IACvC,OAAO,CAAC,UAAU;IAgElB;;;OAGG;IACG,wBAAwB,CAC7B,cAAc,EAAE,gCAAgC;IAqB3C,6BAA6B,CAClC,cAAc,EAAE,4CAA4C;CAmB7D"}
@@ -0,0 +1,89 @@
1
+ import { ApplicationCommandOptionType, ApplicationCommandType } from "discord-api-types/v10";
2
+ import { Base } from "../abstracts/Base.js";
3
+ import { Command } from "../classes/Command.js";
4
+ import { CommandWithSubcommandGroups } from "../classes/CommandWithSubcommandGroups.js";
5
+ import { CommandWithSubcommands } from "../classes/CommandWithSubcommands.js";
6
+ import { AutocompleteInteraction } from "./AutocompleteInteraction.js";
7
+ import { CommandInteraction } from "./CommandInteraction.js";
8
+ export class CommandHandler extends Base {
9
+ getCommand(rawInteraction) {
10
+ let command = this.client.commands.find((x) => x.name === rawInteraction.data.name);
11
+ if (!command)
12
+ command = this.client.commands.find((x) => x.name === "*");
13
+ if (!command)
14
+ throw new Error("Command not found");
15
+ if (command instanceof CommandWithSubcommandGroups) {
16
+ if (rawInteraction.data.type !== ApplicationCommandType.ChatInput) {
17
+ throw new Error("Subcommand groups must be used with ChatInput");
18
+ }
19
+ const data = rawInteraction.data;
20
+ const subcommandGroupName = data.options?.find((x) => x.type === ApplicationCommandOptionType.SubcommandGroup)?.name;
21
+ if (!subcommandGroupName)
22
+ throw new Error("No subcommand group name");
23
+ const subcommandGroup = command.subcommandGroups.find((x) => x.name === subcommandGroupName);
24
+ if (!subcommandGroup)
25
+ throw new Error("Subcommand group not found");
26
+ const subcommandName = (data.options?.find((x) => x.type === ApplicationCommandOptionType.SubcommandGroup)).options?.find((x) => x.type === ApplicationCommandOptionType.Subcommand)?.name;
27
+ if (!subcommandName)
28
+ throw new Error("No subcommand name");
29
+ const subcommand = subcommandGroup.subcommands.find((x) => x.name === subcommandName);
30
+ if (!subcommand)
31
+ throw new Error("Subcommand not found");
32
+ return subcommand;
33
+ }
34
+ if (command instanceof CommandWithSubcommands) {
35
+ if (rawInteraction.data.type !== ApplicationCommandType.ChatInput) {
36
+ throw new Error("Subcommands must be used with ChatInput");
37
+ }
38
+ const data = rawInteraction.data;
39
+ const subcommand = command.subcommands.find((x) => x.name === data.options?.[0]?.name);
40
+ if (!subcommand)
41
+ throw new Error("Subcommand not found");
42
+ return subcommand;
43
+ }
44
+ if (command instanceof Command) {
45
+ return command;
46
+ }
47
+ throw new Error("Command is not a valid command type");
48
+ }
49
+ /**
50
+ * Handle a command interaction
51
+ * @internal
52
+ */
53
+ async handleCommandInteraction(rawInteraction) {
54
+ const command = this.getCommand(rawInteraction);
55
+ if (!command)
56
+ return false;
57
+ const interaction = new CommandInteraction(this.client, rawInteraction, {
58
+ ephemeral: command.ephemeral
59
+ });
60
+ try {
61
+ const command = this.getCommand(rawInteraction);
62
+ if (command.defer) {
63
+ await interaction.defer();
64
+ }
65
+ return await command.run(interaction);
66
+ }
67
+ catch (e) {
68
+ if (e instanceof Error)
69
+ console.error(e.message);
70
+ console.error(e);
71
+ }
72
+ }
73
+ async handleAutocompleteInteraction(rawInteraction) {
74
+ const command = this.getCommand(rawInteraction);
75
+ if (!command)
76
+ return false;
77
+ const interaction = new AutocompleteInteraction(this.client, rawInteraction, { ephemeral: command.ephemeral });
78
+ try {
79
+ const command = this.getCommand(rawInteraction);
80
+ return await command.autocomplete(interaction);
81
+ }
82
+ catch (e) {
83
+ if (e instanceof Error)
84
+ console.error(e.message);
85
+ console.error(e);
86
+ }
87
+ }
88
+ }
89
+ //# sourceMappingURL=CommandHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandHandler.js","sourceRoot":"","sources":["../../../src/internals/CommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,4BAA4B,EAC5B,sBAAsB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAA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AM,EACX,cAAc,EACd,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAChC,CAAA;QAED,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;YAC/C,OAAO,MAAM,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAC/C,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,KAAK;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YAChD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,16 @@
1
+ import { type APIApplicationCommandInteraction } from "discord-api-types/v10";
2
+ import { BaseInteraction, type InteractionDefaults } from "../abstracts/BaseInteraction.js";
3
+ import type { Client } from "../classes/Client.js";
4
+ import { OptionsHandler } from "./OptionsHandler.js";
5
+ /**
6
+ * Represents a command interaction
7
+ */
8
+ export declare class CommandInteraction extends BaseInteraction<APIApplicationCommandInteraction> {
9
+ /**
10
+ * This is the options of the commands, parsed from the interaction data.
11
+ * It will not have any options in it if the command is not a ChatInput command.
12
+ */
13
+ options: OptionsHandler;
14
+ constructor(client: Client, data: APIApplicationCommandInteraction, defaults: InteractionDefaults);
15
+ }
16
+ //# sourceMappingURL=CommandInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/CommandInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gCAAgC,EAGrC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe,CAAC,gCAAgC,CAAC;IACxF;;;OAGG;IACH,OAAO,EAAE,cAAc,CAAA;gBAEtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gCAAgC,EACtC,QAAQ,EAAE,mBAAmB;CAa9B"}
@@ -0,0 +1,23 @@
1
+ import { ApplicationCommandType, InteractionType } from "discord-api-types/v10";
2
+ import { BaseInteraction } from "../abstracts/BaseInteraction.js";
3
+ import { OptionsHandler } from "./OptionsHandler.js";
4
+ /**
5
+ * Represents a command interaction
6
+ */
7
+ export class CommandInteraction extends BaseInteraction {
8
+ /**
9
+ * This is the options of the commands, parsed from the interaction data.
10
+ * It will not have any options in it if the command is not a ChatInput command.
11
+ */
12
+ options;
13
+ constructor(client, data, defaults) {
14
+ super(client, data, defaults);
15
+ if (data.type !== InteractionType.ApplicationCommand) {
16
+ throw new Error("Invalid interaction type was used to create this class");
17
+ }
18
+ this.options = new OptionsHandler(client, data.data.type === ApplicationCommandType.ChatInput
19
+ ? (data.data.options ?? [])
20
+ : []);
21
+ }
22
+ }
23
+ //# sourceMappingURL=CommandInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandInteraction.js","sourceRoot":"","sources":["../../../src/internals/CommandInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,sBAAsB,EACtB,eAAe,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,eAAe,EAEf,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,eAAiD;IACxF;;;OAGG;IACH,OAAO,CAAgB;IACvB,YACC,MAAc,EACd,IAAsC,EACtC,QAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,kBAAkB,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAChC,MAAM,EACN,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,SAAS;YAClD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;YAC3B,CAAC,CAAC,EAAE,CACL,CAAA;IACF,CAAC;CACD"}
@@ -0,0 +1,17 @@
1
+ import type { APIMessageComponentInteraction } from "discord-api-types/v10";
2
+ import { Base } from "../abstracts/Base.js";
3
+ import type { BaseComponent } from "../abstracts/BaseComponent.js";
4
+ export declare class ComponentHandler extends Base {
5
+ components: BaseComponent[];
6
+ /**
7
+ * Register a component with the handler
8
+ * @internal
9
+ */
10
+ registerComponent(component: BaseComponent): void;
11
+ /**
12
+ * Handle an interaction
13
+ * @internal
14
+ */
15
+ handleInteraction(data: APIMessageComponentInteraction): Promise<false | undefined>;
16
+ }
17
+ //# sourceMappingURL=ComponentHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/ComponentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,8BAA8B,EAE9B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAclE,qBAAa,gBAAiB,SAAQ,IAAI;IACzC,UAAU,EAAE,aAAa,EAAE,CAAK;IAChC;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,aAAa;IAK1C;;;OAGG;IACG,iBAAiB,CAAC,IAAI,EAAE,8BAA8B;CA8D5D"}
@@ -0,0 +1,75 @@
1
+ import { Base } from "../abstracts/Base.js";
2
+ import { Button } from "../classes/Button.js";
3
+ import { ChannelSelectMenu } from "../classes/ChannelSelectMenu.js";
4
+ import { MentionableSelectMenu } from "../classes/MentionableSelectMenu.js";
5
+ import { RoleSelectMenu } from "../classes/RoleSelectMenu.js";
6
+ import { StringSelectMenu } from "../classes/StringSelectMenu.js";
7
+ import { UserSelectMenu } from "../classes/UserSelectMenu.js";
8
+ import { ButtonInteraction } from "./ButtonInteraction.js";
9
+ import { ChannelSelectMenuInteraction } from "./ChannelSelectMenuInteraction.js";
10
+ import { MentionableSelectMenuInteraction } from "./MentionableSelectMenuInteraction.js";
11
+ import { RoleSelectMenuInteraction } from "./RoleSelectMenuInteraction.js";
12
+ import { StringSelectMenuInteraction } from "./StringSelectMenuInteraction.js";
13
+ import { UserSelectMenuInteraction } from "./UserSelectMenuInteraction.js";
14
+ export class ComponentHandler extends Base {
15
+ components = [];
16
+ /**
17
+ * Register a component with the handler
18
+ * @internal
19
+ */
20
+ registerComponent(component) {
21
+ if (!this.components.find((x) => x.customId === component.customId)) {
22
+ this.components.push(component);
23
+ }
24
+ }
25
+ /**
26
+ * Handle an interaction
27
+ * @internal
28
+ */
29
+ async handleInteraction(data) {
30
+ const component = this.components.find((x) => x.customId === data.data.custom_id &&
31
+ x.type === data.data.component_type);
32
+ if (!component)
33
+ return false;
34
+ if (component instanceof Button) {
35
+ const interaction = new ButtonInteraction(this.client, data, { ephemeral: component.ephemeral });
36
+ if (component.defer)
37
+ await interaction.defer();
38
+ await component.run(interaction);
39
+ }
40
+ else if (component instanceof RoleSelectMenu) {
41
+ const interaction = new RoleSelectMenuInteraction(this.client, data, { ephemeral: component.ephemeral });
42
+ if (component.defer)
43
+ await interaction.defer();
44
+ await component.run(interaction);
45
+ }
46
+ else if (component instanceof ChannelSelectMenu) {
47
+ const interaction = new ChannelSelectMenuInteraction(this.client, data, { ephemeral: component.ephemeral });
48
+ if (component.defer)
49
+ await interaction.defer();
50
+ await component.run(interaction);
51
+ }
52
+ else if (component instanceof MentionableSelectMenu) {
53
+ const interaction = new MentionableSelectMenuInteraction(this.client, data, { ephemeral: component.ephemeral });
54
+ if (component.defer)
55
+ await interaction.defer();
56
+ await component.run(interaction);
57
+ }
58
+ else if (component instanceof StringSelectMenu) {
59
+ const interaction = new StringSelectMenuInteraction(this.client, data, { ephemeral: component.ephemeral });
60
+ if (component.defer)
61
+ await interaction.defer();
62
+ await component.run(interaction);
63
+ }
64
+ else if (component instanceof UserSelectMenu) {
65
+ const interaction = new UserSelectMenuInteraction(this.client, data, { ephemeral: component.ephemeral });
66
+ if (component.defer)
67
+ await interaction.defer();
68
+ await component.run(interaction);
69
+ }
70
+ else {
71
+ throw new Error(`Unknown component with type ${data.data.component_type} and custom ID ${data.data.custom_id}`);
72
+ }
73
+ }
74
+ }
75
+ //# sourceMappingURL=ComponentHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentHandler.js","sourceRoot":"","sources":["../../../src/internals/ComponentHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAChF,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAA;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAA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AC,KAAK;gBAAE,MAAM,WAAW,CAAC,KAAK,EAAE,CAAA;YAC9C,MAAM,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;QACjC,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACd,+BAA+B,IAAI,CAAC,IAAI,CAAC,cAAc,kBAAkB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAC9F,CAAA;QACF,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,27 @@
1
+ import { Base } from "../abstracts/Base.js";
2
+ import type { APIModalSubmitInteraction, Client } from "../index.js";
3
+ /**
4
+ * This class is used to parse the options of a command, and provide errors for any missing or invalid options.
5
+ * It is used internally by the Command class.
6
+ */
7
+ export declare class FieldsHandler extends Base {
8
+ /**
9
+ * The raw options that were in the interaction data, before they were parsed.
10
+ */
11
+ readonly raw: {
12
+ [key: string]: string;
13
+ };
14
+ /**
15
+ * The errors that were encountered while parsing the options.
16
+ */
17
+ readonly errors: Array<string>;
18
+ constructor(client: Client, interaction: APIModalSubmitInteraction);
19
+ /**
20
+ * Get the value of a text input.
21
+ * @param key The name of the input to get the value of.
22
+ * @returns The value of the input, or undefined if the input was not provided.
23
+ */
24
+ getText(key: string, required?: false): string | undefined;
25
+ getText(key: string, required: true): string;
26
+ }
27
+ //# sourceMappingURL=FieldsHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldsHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/FieldsHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpE;;;GAGG;AACH,qBAAa,aAAc,SAAQ,IAAI;IACtC;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAK;IAC5C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAK;gBAEvB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,yBAAyB;IAWlE;;;;OAIG;IACI,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS;IAC1D,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM;CASnD"}
@@ -0,0 +1,37 @@
1
+ import { ComponentType } from "discord-api-types/v10";
2
+ import { Base } from "../abstracts/Base.js";
3
+ /**
4
+ * This class is used to parse the options of a command, and provide errors for any missing or invalid options.
5
+ * It is used internally by the Command class.
6
+ */
7
+ export class FieldsHandler extends Base {
8
+ /**
9
+ * The raw options that were in the interaction data, before they were parsed.
10
+ */
11
+ raw = {};
12
+ /**
13
+ * The errors that were encountered while parsing the options.
14
+ */
15
+ errors = [];
16
+ constructor(client, interaction) {
17
+ super(client);
18
+ interaction.data.components.map((row) => {
19
+ row.components.map((component) => {
20
+ if (component.type === ComponentType.TextInput) {
21
+ this.raw[component.custom_id] = component.value;
22
+ }
23
+ });
24
+ });
25
+ }
26
+ getText(key, required = false) {
27
+ const value = this.raw[key];
28
+ if (required) {
29
+ if (!value || typeof value !== "string")
30
+ throw new Error(`Missing required field: ${key}`);
31
+ }
32
+ else if (!value || typeof value !== "string")
33
+ return undefined;
34
+ return value;
35
+ }
36
+ }
37
+ //# sourceMappingURL=FieldsHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldsHandler.js","sourceRoot":"","sources":["../../../src/internals/FieldsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAG3C;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,IAAI;IACtC;;OAEG;IACM,GAAG,GAA8B,EAAE,CAAA;IAC5C;;OAEG;IACM,MAAM,GAAkB,EAAE,CAAA;IAEnC,YAAY,MAAc,EAAE,WAAsC;QACjE,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACvC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;gBAChC,IAAI,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,SAAS,EAAE,CAAC;oBAChD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,KAAK,CAAA;gBAChD,CAAC;YACF,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;IASM,OAAO,CAAC,GAAW,EAAE,QAAQ,GAAG,KAAK;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;gBACtC,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAA;QACnD,CAAC;aAAM,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAA;QAChE,OAAO,KAAK,CAAA;IACb,CAAC;CACD"}
@@ -0,0 +1,9 @@
1
+ import { type APIMessageComponentSelectMenuInteraction } from "discord-api-types/v10";
2
+ import { AnySelectMenuInteraction } from "../abstracts/AnySelectMenuInteraction.js";
3
+ import type { InteractionDefaults } from "../abstracts/BaseInteraction.js";
4
+ import type { Client } from "../classes/Client.js";
5
+ export declare class MentionableSelectMenuInteraction extends AnySelectMenuInteraction {
6
+ constructor(client: Client, data: APIMessageComponentSelectMenuInteraction, defaults: InteractionDefaults);
7
+ get values(): string[];
8
+ }
9
+ //# sourceMappingURL=MentionableSelectMenuInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentionableSelectMenuInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/MentionableSelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,wCAAwC,EAG7C,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,qBAAa,gCAAiC,SAAQ,wBAAwB;gBAE5E,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,wCAAwC,EAC9C,QAAQ,EAAE,mBAAmB;IAQ9B,IAAI,MAAM,IAAI,MAAM,EAAE,CAGrB;CACD"}
@@ -0,0 +1,15 @@
1
+ import { ComponentType } from "discord-api-types/v10";
2
+ import { AnySelectMenuInteraction } from "../abstracts/AnySelectMenuInteraction.js";
3
+ export class MentionableSelectMenuInteraction extends AnySelectMenuInteraction {
4
+ constructor(client, data, defaults) {
5
+ super(client, data, defaults);
6
+ if (data.data.component_type !== ComponentType.MentionableSelect) {
7
+ throw new Error("Invalid component type was used to create this class");
8
+ }
9
+ }
10
+ get values() {
11
+ return this.rawData.data
12
+ .values;
13
+ }
14
+ }
15
+ //# sourceMappingURL=MentionableSelectMenuInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentionableSelectMenuInteraction.js","sourceRoot":"","sources":["../../../src/internals/MentionableSelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAInF,MAAM,OAAO,gCAAiC,SAAQ,wBAAwB;IAC7E,YACC,MAAc,EACd,IAA8C,EAC9C,QAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,aAAa,CAAC,iBAAiB,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACxE,CAAC;IACF,CAAC;IAED,IAAI,MAAM;QACT,OAAQ,IAAI,CAAC,OAAO,CAAC,IAAmD;aACtE,MAAM,CAAA;IACT,CAAC;CACD"}
@@ -0,0 +1,17 @@
1
+ import type { APIModalSubmitInteraction } from "discord-api-types/v10";
2
+ import { Base } from "../abstracts/Base.js";
3
+ import type { Modal } from "../classes/Modal.js";
4
+ export declare class ModalHandler extends Base {
5
+ modals: Modal[];
6
+ /**
7
+ * Register a modal with the handler
8
+ * @internal
9
+ */
10
+ registerModal(modal: Modal): void;
11
+ /**
12
+ * Handle an interaction
13
+ * @internal
14
+ */
15
+ handleInteraction(data: APIModalSubmitInteraction): Promise<false | void>;
16
+ }
17
+ //# sourceMappingURL=ModalHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalHandler.d.ts","sourceRoot":"","sources":["../../../src/internals/ModalHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAGhD,qBAAa,YAAa,SAAQ,IAAI;IACrC,MAAM,EAAE,KAAK,EAAE,CAAK;IACpB;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,KAAK;IAK1B;;;OAGG;IACG,iBAAiB,CAAC,IAAI,EAAE,yBAAyB;CAMvD"}
@@ -0,0 +1,25 @@
1
+ import { Base } from "../abstracts/Base.js";
2
+ import { ModalInteraction } from "./ModalInteraction.js";
3
+ export class ModalHandler extends Base {
4
+ modals = [];
5
+ /**
6
+ * Register a modal with the handler
7
+ * @internal
8
+ */
9
+ registerModal(modal) {
10
+ if (!this.modals.find((x) => x.customId === modal.customId)) {
11
+ this.modals.push(modal);
12
+ }
13
+ }
14
+ /**
15
+ * Handle an interaction
16
+ * @internal
17
+ */
18
+ async handleInteraction(data) {
19
+ const modal = this.modals.find((x) => x.customId === data.data.custom_id);
20
+ if (!modal)
21
+ return false;
22
+ return await modal.run(new ModalInteraction(this.client, data, {}));
23
+ }
24
+ }
25
+ //# sourceMappingURL=ModalHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalHandler.js","sourceRoot":"","sources":["../../../src/internals/ModalHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,OAAO,YAAa,SAAQ,IAAI;IACrC,MAAM,GAAY,EAAE,CAAA;IACpB;;;OAGG;IACH,aAAa,CAAC,KAAY;QACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACxB,CAAC;IACF,CAAC;IACD;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CAAC,IAA+B;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACzE,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAA;QAExB,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAA;IACpE,CAAC;CACD"}
@@ -0,0 +1,22 @@
1
+ import { type APIModalSubmitInteraction } from "discord-api-types/v10";
2
+ import { BaseInteraction } from "../abstracts/BaseInteraction.js";
3
+ import type { InteractionReplyOptions } from "../abstracts/BaseInteraction.js";
4
+ import type { Client, InteractionDefaults } from "../index.js";
5
+ import type { MessagePayload } from "../types.js";
6
+ import { FieldsHandler } from "./FieldsHandler.js";
7
+ export declare class ModalInteraction extends BaseInteraction<APIModalSubmitInteraction> {
8
+ customId: string;
9
+ fields: FieldsHandler;
10
+ constructor(client: Client, data: APIModalSubmitInteraction, defaults: InteractionDefaults);
11
+ /**
12
+ * Acknowledge the interaction, the user does not see a loading state.
13
+ * This can only be used for modals triggered from components
14
+ */
15
+ acknowledge(): Promise<void>;
16
+ /**
17
+ * Update the original message of the component.
18
+ * This can only be used for modals triggered from components
19
+ */
20
+ update(data: MessagePayload, options?: Pick<InteractionReplyOptions, "files">): Promise<void>;
21
+ }
22
+ //# sourceMappingURL=ModalInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalInteraction.d.ts","sourceRoot":"","sources":["../../../src/internals/ModalInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,yBAAyB,EAI9B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,qBAAa,gBAAiB,SAAQ,eAAe,CAAC,yBAAyB,CAAC;IAC/E,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,aAAa,CAAA;gBAGpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,yBAAyB,EAC/B,QAAQ,EAAE,mBAAmB;IAQ9B;;;OAGG;IACG,WAAW;IAYjB;;;OAGG;IACG,MAAM,CACX,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAM;CAgBrD"}
@@ -0,0 +1,42 @@
1
+ import { InteractionResponseType, Routes } from "discord-api-types/v10";
2
+ import { BaseInteraction } from "../abstracts/BaseInteraction.js";
3
+ import { serializePayload } from "../utils.js";
4
+ import { FieldsHandler } from "./FieldsHandler.js";
5
+ export class ModalInteraction extends BaseInteraction {
6
+ customId;
7
+ fields;
8
+ constructor(client, data, defaults) {
9
+ super(client, data, defaults);
10
+ this.customId = data.data.custom_id;
11
+ this.fields = new FieldsHandler(client, data);
12
+ }
13
+ /**
14
+ * Acknowledge the interaction, the user does not see a loading state.
15
+ * This can only be used for modals triggered from components
16
+ */
17
+ async acknowledge() {
18
+ await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
19
+ body: {
20
+ type: InteractionResponseType.DeferredMessageUpdate
21
+ }
22
+ });
23
+ this._deferred = true;
24
+ }
25
+ /**
26
+ * Update the original message of the component.
27
+ * This can only be used for modals triggered from components
28
+ */
29
+ async update(data, options = {}) {
30
+ const serialized = serializePayload(data);
31
+ await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
32
+ body: {
33
+ type: InteractionResponseType.UpdateMessage,
34
+ data: {
35
+ ...serialized
36
+ }
37
+ },
38
+ files: options.files
39
+ });
40
+ }
41
+ }
42
+ //# sourceMappingURL=ModalInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalInteraction.js","sourceRoot":"","sources":["../../../src/internals/ModalInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,uBAAuB,EAEvB,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAIjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa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