seyfert 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +57 -0
  3. package/lib/api/CDN.d.ts +220 -0
  4. package/lib/api/CDN.js +236 -0
  5. package/lib/api/REST.d.ts +127 -0
  6. package/lib/api/REST.js +424 -0
  7. package/lib/api/Router.d.ts +17 -0
  8. package/lib/api/Router.js +63 -0
  9. package/lib/api/Routes/applications.d.ts +46 -0
  10. package/lib/api/Routes/applications.js +2 -0
  11. package/lib/api/Routes/cdn.d.ts +66 -0
  12. package/lib/api/Routes/cdn.js +2 -0
  13. package/lib/api/Routes/channels.d.ts +109 -0
  14. package/lib/api/Routes/channels.js +2 -0
  15. package/lib/api/Routes/gateway.d.ts +11 -0
  16. package/lib/api/Routes/gateway.js +2 -0
  17. package/lib/api/Routes/guilds.d.ts +171 -0
  18. package/lib/api/Routes/guilds.js +2 -0
  19. package/lib/api/Routes/index.d.ts +13 -0
  20. package/lib/api/Routes/index.js +17 -0
  21. package/lib/api/Routes/interactions.d.ts +14 -0
  22. package/lib/api/Routes/interactions.js +2 -0
  23. package/lib/api/Routes/invites.d.ts +9 -0
  24. package/lib/api/Routes/invites.js +2 -0
  25. package/lib/api/Routes/stage-instances.d.ts +13 -0
  26. package/lib/api/Routes/stage-instances.js +2 -0
  27. package/lib/api/Routes/stickers.d.ts +11 -0
  28. package/lib/api/Routes/stickers.js +2 -0
  29. package/lib/api/Routes/users.d.ts +35 -0
  30. package/lib/api/Routes/users.js +2 -0
  31. package/lib/api/Routes/voice.d.ts +10 -0
  32. package/lib/api/Routes/voice.js +2 -0
  33. package/lib/api/Routes/webhooks.d.ts +29 -0
  34. package/lib/api/Routes/webhooks.js +2 -0
  35. package/lib/api/errors/DiscordAPIError.d.ts +51 -0
  36. package/lib/api/errors/DiscordAPIError.js +81 -0
  37. package/lib/api/errors/HTTPError.d.ts +20 -0
  38. package/lib/api/errors/HTTPError.js +28 -0
  39. package/lib/api/errors/RateLimitError.d.ts +19 -0
  40. package/lib/api/errors/RateLimitError.js +37 -0
  41. package/lib/api/handlers/BurstHandler.d.ts +51 -0
  42. package/lib/api/handlers/BurstHandler.js +124 -0
  43. package/lib/api/handlers/SequentialHandler.d.ts +81 -0
  44. package/lib/api/handlers/SequentialHandler.js +365 -0
  45. package/lib/api/handlers/Shared.d.ts +14 -0
  46. package/lib/api/handlers/Shared.js +125 -0
  47. package/lib/api/index.d.ts +5 -0
  48. package/lib/api/index.js +21 -0
  49. package/lib/api/interfaces/Handler.d.ts +21 -0
  50. package/lib/api/interfaces/Handler.js +2 -0
  51. package/lib/api/shared.d.ts +7 -0
  52. package/lib/api/shared.js +27 -0
  53. package/lib/api/utils/constants.d.ts +39 -0
  54. package/lib/api/utils/constants.js +50 -0
  55. package/lib/api/utils/types.d.ts +335 -0
  56. package/lib/api/utils/types.js +14 -0
  57. package/lib/api/utils/utils.d.ts +52 -0
  58. package/lib/api/utils/utils.js +159 -0
  59. package/lib/builders/ActionRow.d.ts +40 -0
  60. package/lib/builders/ActionRow.js +58 -0
  61. package/lib/builders/Attachment.d.ts +106 -0
  62. package/lib/builders/Attachment.js +196 -0
  63. package/lib/builders/Base.d.ts +10 -0
  64. package/lib/builders/Base.js +13 -0
  65. package/lib/builders/Button.d.ts +59 -0
  66. package/lib/builders/Button.js +94 -0
  67. package/lib/builders/MessageEmbed.d.ts +116 -0
  68. package/lib/builders/MessageEmbed.js +159 -0
  69. package/lib/builders/Modal.d.ts +111 -0
  70. package/lib/builders/Modal.js +162 -0
  71. package/lib/builders/SelectMenu.d.ts +201 -0
  72. package/lib/builders/SelectMenu.js +293 -0
  73. package/lib/builders/index.d.ts +12 -0
  74. package/lib/builders/index.js +54 -0
  75. package/lib/builders/types.d.ts +21 -0
  76. package/lib/builders/types.js +2 -0
  77. package/lib/cache/adapters/default.d.ts +24 -0
  78. package/lib/cache/adapters/default.js +118 -0
  79. package/lib/cache/adapters/index.d.ts +4 -0
  80. package/lib/cache/adapters/index.js +20 -0
  81. package/lib/cache/adapters/redis.d.ts +35 -0
  82. package/lib/cache/adapters/redis.js +180 -0
  83. package/lib/cache/adapters/types.d.ts +25 -0
  84. package/lib/cache/adapters/types.js +2 -0
  85. package/lib/cache/adapters/workeradapter.d.ts +24 -0
  86. package/lib/cache/adapters/workeradapter.js +76 -0
  87. package/lib/cache/index.d.ts +97 -0
  88. package/lib/cache/index.js +394 -0
  89. package/lib/cache/resources/channels.d.ts +7 -0
  90. package/lib/cache/resources/channels.js +20 -0
  91. package/lib/cache/resources/default/base.d.ts +25 -0
  92. package/lib/cache/resources/default/base.js +75 -0
  93. package/lib/cache/resources/default/guild-based.d.ts +33 -0
  94. package/lib/cache/resources/default/guild-based.js +91 -0
  95. package/lib/cache/resources/default/guild-related.d.ts +32 -0
  96. package/lib/cache/resources/default/guild-related.js +102 -0
  97. package/lib/cache/resources/emojis.d.ts +7 -0
  98. package/lib/cache/resources/emojis.js +17 -0
  99. package/lib/cache/resources/guilds.d.ts +10 -0
  100. package/lib/cache/resources/guilds.js +117 -0
  101. package/lib/cache/resources/members.d.ts +10 -0
  102. package/lib/cache/resources/members.js +41 -0
  103. package/lib/cache/resources/presence.d.ts +9 -0
  104. package/lib/cache/resources/presence.js +14 -0
  105. package/lib/cache/resources/roles.d.ts +7 -0
  106. package/lib/cache/resources/roles.js +17 -0
  107. package/lib/cache/resources/stage-instances.d.ts +5 -0
  108. package/lib/cache/resources/stage-instances.js +8 -0
  109. package/lib/cache/resources/stickers.d.ts +7 -0
  110. package/lib/cache/resources/stickers.js +17 -0
  111. package/lib/cache/resources/threads.d.ts +7 -0
  112. package/lib/cache/resources/threads.js +17 -0
  113. package/lib/cache/resources/users.d.ts +7 -0
  114. package/lib/cache/resources/users.js +17 -0
  115. package/lib/cache/resources/voice-states.d.ts +9 -0
  116. package/lib/cache/resources/voice-states.js +13 -0
  117. package/lib/client/base.d.ts +244 -0
  118. package/lib/client/base.js +178 -0
  119. package/lib/client/client.d.ts +32 -0
  120. package/lib/client/client.js +156 -0
  121. package/lib/client/httpclient.d.ts +21 -0
  122. package/lib/client/httpclient.js +143 -0
  123. package/lib/client/index.d.ts +4 -0
  124. package/lib/client/index.js +19 -0
  125. package/lib/client/oninteraction.d.ts +4 -0
  126. package/lib/client/oninteraction.js +180 -0
  127. package/lib/client/workerclient.d.ts +28 -0
  128. package/lib/client/workerclient.js +213 -0
  129. package/lib/collection.d.ts +233 -0
  130. package/lib/collection.js +371 -0
  131. package/lib/commands/applications/chat.d.ts +139 -0
  132. package/lib/commands/applications/chat.js +173 -0
  133. package/lib/commands/applications/chatcontext.d.ts +28 -0
  134. package/lib/commands/applications/chatcontext.js +53 -0
  135. package/lib/commands/applications/menu.d.ts +39 -0
  136. package/lib/commands/applications/menu.js +87 -0
  137. package/lib/commands/applications/menucontext.d.ts +25 -0
  138. package/lib/commands/applications/menucontext.js +64 -0
  139. package/lib/commands/applications/options.d.ts +67 -0
  140. package/lib/commands/applications/options.js +44 -0
  141. package/lib/commands/applications/shared.d.ts +35 -0
  142. package/lib/commands/applications/shared.js +2 -0
  143. package/lib/commands/decorators.d.ts +107 -0
  144. package/lib/commands/decorators.js +85 -0
  145. package/lib/commands/handler.d.ts +15 -0
  146. package/lib/commands/handler.js +140 -0
  147. package/lib/commands/index.d.ts +8 -0
  148. package/lib/commands/index.js +24 -0
  149. package/lib/commands/optionresolver.d.ts +49 -0
  150. package/lib/commands/optionresolver.js +146 -0
  151. package/lib/common/bot/watcher.d.ts +53 -0
  152. package/lib/common/bot/watcher.js +104 -0
  153. package/lib/common/index.d.ts +13 -0
  154. package/lib/common/index.js +30 -0
  155. package/lib/common/it/colors.d.ts +274 -0
  156. package/lib/common/it/colors.js +453 -0
  157. package/lib/common/it/constants.d.ts +36 -0
  158. package/lib/common/it/constants.js +40 -0
  159. package/lib/common/it/logger.d.ts +114 -0
  160. package/lib/common/it/logger.js +189 -0
  161. package/lib/common/it/utils.d.ts +107 -0
  162. package/lib/common/it/utils.js +275 -0
  163. package/lib/common/shorters/base.d.ts +5 -0
  164. package/lib/common/shorters/base.js +10 -0
  165. package/lib/common/shorters/channels.d.ts +90 -0
  166. package/lib/common/shorters/channels.js +95 -0
  167. package/lib/common/shorters/guilds.d.ts +389 -0
  168. package/lib/common/shorters/guilds.js +350 -0
  169. package/lib/common/shorters/members.d.ts +115 -0
  170. package/lib/common/shorters/members.js +179 -0
  171. package/lib/common/shorters/messages.d.ts +27 -0
  172. package/lib/common/shorters/messages.js +117 -0
  173. package/lib/common/shorters/roles.d.ts +12 -0
  174. package/lib/common/shorters/roles.js +51 -0
  175. package/lib/common/shorters/templates.d.ts +12 -0
  176. package/lib/common/shorters/templates.js +29 -0
  177. package/lib/common/shorters/users.d.ts +11 -0
  178. package/lib/common/shorters/users.js +42 -0
  179. package/lib/common/shorters/webhook.d.ts +33 -0
  180. package/lib/common/shorters/webhook.js +69 -0
  181. package/lib/common/types/options.d.ts +10 -0
  182. package/lib/common/types/options.js +2 -0
  183. package/lib/common/types/resolvables.d.ts +10 -0
  184. package/lib/common/types/resolvables.js +2 -0
  185. package/lib/common/types/util.d.ts +90 -0
  186. package/lib/common/types/util.js +2 -0
  187. package/lib/common/types/write.d.ts +21 -0
  188. package/lib/common/types/write.js +2 -0
  189. package/lib/components/ActionRow.d.ts +10 -0
  190. package/lib/components/ActionRow.js +13 -0
  191. package/lib/components/ButtonComponent.d.ts +19 -0
  192. package/lib/components/ButtonComponent.js +34 -0
  193. package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
  194. package/lib/components/ChannelSelectMenuComponent.js +12 -0
  195. package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
  196. package/lib/components/MentionableSelectMenuComponent.js +7 -0
  197. package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
  198. package/lib/components/RoleSelectMenuComponent.js +7 -0
  199. package/lib/components/StringSelectMenuComponent.d.ts +6 -0
  200. package/lib/components/StringSelectMenuComponent.js +12 -0
  201. package/lib/components/TextInputComponent.d.ts +7 -0
  202. package/lib/components/TextInputComponent.js +14 -0
  203. package/lib/components/UserSelectMenuComponent.d.ts +4 -0
  204. package/lib/components/UserSelectMenuComponent.js +7 -0
  205. package/lib/components/command.d.ts +23 -0
  206. package/lib/components/command.js +15 -0
  207. package/lib/components/handler.d.ts +48 -0
  208. package/lib/components/handler.js +231 -0
  209. package/lib/components/index.d.ts +20 -0
  210. package/lib/components/index.js +55 -0
  211. package/lib/components/listener.d.ts +11 -0
  212. package/lib/components/listener.js +18 -0
  213. package/lib/events/event.d.ts +23 -0
  214. package/lib/events/event.js +2 -0
  215. package/lib/events/handler.d.ts +19 -0
  216. package/lib/events/handler.js +112 -0
  217. package/lib/events/hooks/application_command.d.ts +12 -0
  218. package/lib/events/hooks/application_command.js +8 -0
  219. package/lib/events/hooks/auto_moderation.d.ts +22 -0
  220. package/lib/events/hooks/auto_moderation.js +21 -0
  221. package/lib/events/hooks/channel.d.ts +11 -0
  222. package/lib/events/hooks/channel.js +24 -0
  223. package/lib/events/hooks/custom.d.ts +4 -0
  224. package/lib/events/hooks/custom.js +11 -0
  225. package/lib/events/hooks/dispatch.d.ts +5 -0
  226. package/lib/events/hooks/dispatch.js +12 -0
  227. package/lib/events/hooks/entitlement.d.ts +35 -0
  228. package/lib/events/hooks/entitlement.js +16 -0
  229. package/lib/events/hooks/guild.d.ts +228 -0
  230. package/lib/events/hooks/guild.js +101 -0
  231. package/lib/events/hooks/index.d.ts +23 -0
  232. package/lib/events/hooks/index.js +34 -0
  233. package/lib/events/hooks/integration.d.ts +94 -0
  234. package/lib/events/hooks/integration.js +27 -0
  235. package/lib/events/hooks/interactions.d.ts +4 -0
  236. package/lib/events/hooks/interactions.js +8 -0
  237. package/lib/events/hooks/invite.d.ts +21 -0
  238. package/lib/events/hooks/invite.js +12 -0
  239. package/lib/events/hooks/message.d.ts +69 -0
  240. package/lib/events/hooks/message.js +37 -0
  241. package/lib/events/hooks/presence.d.ts +27 -0
  242. package/lib/events/hooks/presence.js +8 -0
  243. package/lib/events/hooks/stage.d.ts +29 -0
  244. package/lib/events/hooks/stage.js +16 -0
  245. package/lib/events/hooks/thread.d.ts +198 -0
  246. package/lib/events/hooks/thread.js +29 -0
  247. package/lib/events/hooks/typing.d.ts +16 -0
  248. package/lib/events/hooks/typing.js +14 -0
  249. package/lib/events/hooks/user.d.ts +4 -0
  250. package/lib/events/hooks/user.js +8 -0
  251. package/lib/events/hooks/voice.d.ts +37 -0
  252. package/lib/events/hooks/voice.js +18 -0
  253. package/lib/events/hooks/webhook.d.ts +6 -0
  254. package/lib/events/hooks/webhook.js +8 -0
  255. package/lib/events/index.d.ts +2 -0
  256. package/lib/events/index.js +18 -0
  257. package/lib/index.d.ts +79 -0
  258. package/lib/index.js +104 -0
  259. package/lib/langs/handler.d.ts +11 -0
  260. package/lib/langs/handler.js +34 -0
  261. package/lib/langs/index.d.ts +2 -0
  262. package/lib/langs/index.js +18 -0
  263. package/lib/langs/router.d.ts +18 -0
  264. package/lib/langs/router.js +42 -0
  265. package/lib/structures/AnonymousGuild.d.ts +7 -0
  266. package/lib/structures/AnonymousGuild.js +11 -0
  267. package/lib/structures/AutoModerationRule.d.ts +22 -0
  268. package/lib/structures/AutoModerationRule.js +34 -0
  269. package/lib/structures/ClientUser.d.ts +25 -0
  270. package/lib/structures/ClientUser.js +52 -0
  271. package/lib/structures/Guild.d.ts +86 -0
  272. package/lib/structures/Guild.js +66 -0
  273. package/lib/structures/GuildEmoji.d.ts +29 -0
  274. package/lib/structures/GuildEmoji.js +47 -0
  275. package/lib/structures/GuildMember.d.ts +92 -0
  276. package/lib/structures/GuildMember.js +137 -0
  277. package/lib/structures/GuildPreview.d.ts +10 -0
  278. package/lib/structures/GuildPreview.js +14 -0
  279. package/lib/structures/GuildRole.d.ts +21 -0
  280. package/lib/structures/GuildRole.js +32 -0
  281. package/lib/structures/GuildTemplate.d.ts +23 -0
  282. package/lib/structures/GuildTemplate.js +36 -0
  283. package/lib/structures/Interaction.d.ts +152 -0
  284. package/lib/structures/Interaction.js +409 -0
  285. package/lib/structures/Message.d.ts +53 -0
  286. package/lib/structures/Message.js +123 -0
  287. package/lib/structures/Sticker.d.ts +27 -0
  288. package/lib/structures/Sticker.js +44 -0
  289. package/lib/structures/User.d.ts +20 -0
  290. package/lib/structures/User.js +37 -0
  291. package/lib/structures/Webhook.d.ts +42 -0
  292. package/lib/structures/Webhook.js +63 -0
  293. package/lib/structures/channels.d.ts +232 -0
  294. package/lib/structures/channels.js +366 -0
  295. package/lib/structures/extra/Base.d.ts +7 -0
  296. package/lib/structures/extra/Base.js +39 -0
  297. package/lib/structures/extra/BaseComponent.d.ts +9 -0
  298. package/lib/structures/extra/BaseComponent.js +12 -0
  299. package/lib/structures/extra/BaseGuild.d.ts +40 -0
  300. package/lib/structures/extra/BaseGuild.js +71 -0
  301. package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
  302. package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
  303. package/lib/structures/extra/BitField.d.ts +14 -0
  304. package/lib/structures/extra/BitField.js +56 -0
  305. package/lib/structures/extra/DiscordBase.d.ts +18 -0
  306. package/lib/structures/extra/DiscordBase.js +28 -0
  307. package/lib/structures/extra/Permissions.d.ts +54 -0
  308. package/lib/structures/extra/Permissions.js +9 -0
  309. package/lib/structures/extra/functions.d.ts +11 -0
  310. package/lib/structures/extra/functions.js +69 -0
  311. package/lib/structures/index.d.ts +15 -0
  312. package/lib/structures/index.js +31 -0
  313. package/lib/websocket/SharedTypes.d.ts +128 -0
  314. package/lib/websocket/SharedTypes.js +2 -0
  315. package/lib/websocket/constants/index.d.ts +26 -0
  316. package/lib/websocket/constants/index.js +31 -0
  317. package/lib/websocket/discord/basesocket.d.ts +12 -0
  318. package/lib/websocket/discord/basesocket.js +37 -0
  319. package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
  320. package/lib/websocket/discord/events/memberUpdate.js +47 -0
  321. package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
  322. package/lib/websocket/discord/events/presenceUpdate.js +46 -0
  323. package/lib/websocket/discord/handlemessage.d.ts +0 -0
  324. package/lib/websocket/discord/handlemessage.js +1 -0
  325. package/lib/websocket/discord/index.d.ts +4 -0
  326. package/lib/websocket/discord/index.js +20 -0
  327. package/lib/websocket/discord/memberUpdate.d.ts +16 -0
  328. package/lib/websocket/discord/memberUpdate.js +47 -0
  329. package/lib/websocket/discord/shard.d.ts +46 -0
  330. package/lib/websocket/discord/shard.js +278 -0
  331. package/lib/websocket/discord/sharder.d.ts +25 -0
  332. package/lib/websocket/discord/sharder.js +153 -0
  333. package/lib/websocket/discord/shared.d.ts +99 -0
  334. package/lib/websocket/discord/shared.js +8 -0
  335. package/lib/websocket/discord/worker.d.ts +43 -0
  336. package/lib/websocket/discord/worker.js +2 -0
  337. package/lib/websocket/discord/workermanager.d.ts +69 -0
  338. package/lib/websocket/discord/workermanager.js +273 -0
  339. package/lib/websocket/index.d.ts +3 -0
  340. package/lib/websocket/index.js +19 -0
  341. package/lib/websocket/structures/index.d.ts +117 -0
  342. package/lib/websocket/structures/index.js +261 -0
  343. package/lib/websocket/structures/timeout.d.ts +20 -0
  344. package/lib/websocket/structures/timeout.js +75 -0
  345. package/package.json +70 -0
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Embed = void 0;
4
+ const common_1 = require("../common");
5
+ /**
6
+ * Represents a message embed.
7
+ * @example
8
+ * const embed = new MessageEmbed();
9
+ * embed.setTitle('Seyfert');
10
+ * embed.setDescription('Better than discord.js');
11
+ * embed.setColor('Green');
12
+ * const embedJSON = embed.json();
13
+ */
14
+ class Embed {
15
+ data;
16
+ /**
17
+ * Creates a new instance of MessageEmbed.
18
+ * @param data - The initial data for the embed.
19
+ * @example
20
+ * const embed = new MessageEmbed({ title: 'Hello', description: 'This is an example embed' });
21
+ */
22
+ constructor(data = {}) {
23
+ this.data = data;
24
+ if (!data.fields)
25
+ this.data.fields = [];
26
+ }
27
+ /**
28
+ * Sets the author of the embed.
29
+ * @param author - The author information.
30
+ * @returns The updated MessageEmbed instance.
31
+ * @example
32
+ * embed.setAuthor({ name: 'John Doe', iconURL: 'https://example.com/avatar.png' });
33
+ */
34
+ setAuthor(author) {
35
+ this.data.author = (0, common_1.toSnakeCase)(author);
36
+ return this;
37
+ }
38
+ /**
39
+ * Sets the color of the embed.
40
+ * @param color - The color of the embed.
41
+ * @returns The updated MessageEmbed instance.
42
+ * @example
43
+ * embed.setColor('#FF0000');
44
+ * embed.setColor('Blurple');
45
+ */
46
+ setColor(color) {
47
+ this.data.color = (0, common_1.resolveColor)(color);
48
+ return this;
49
+ }
50
+ /**
51
+ * Sets the description of the embed.
52
+ * @param desc - The description of the embed.
53
+ * @returns The updated MessageEmbed instance.
54
+ * @example
55
+ * embed.setDescription('This is the description of the embed');
56
+ */
57
+ setDescription(desc) {
58
+ this.data.description = desc;
59
+ return this;
60
+ }
61
+ /**
62
+ * Adds one or more fields to the embed.
63
+ * @param fields - The fields to add to the embed.
64
+ * @returns The updated MessageEmbed instance.
65
+ * @example
66
+ * embed.addFields({ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' });
67
+ */
68
+ addFields(...fields) {
69
+ this.data.fields = this.data.fields.concat((0, common_1.fastFlat)(fields));
70
+ return this;
71
+ }
72
+ /**
73
+ * Sets the fields of the embed.
74
+ * @param fields - The fields of the embed.
75
+ * @returns The updated MessageEmbed instance.
76
+ * @example
77
+ * embed.setFields([{ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' }]);
78
+ */
79
+ setFields(fields) {
80
+ this.data.fields = fields;
81
+ return this;
82
+ }
83
+ /**
84
+ * Sets the footer of the embed.
85
+ * @param footer - The footer information.
86
+ * @returns The updated MessageEmbed instance.
87
+ * @example
88
+ * embed.setFooter({ text: 'This is the footer', iconURL: 'https://example.com/footer.png' });
89
+ */
90
+ setFooter(footer) {
91
+ this.data.footer = (0, common_1.toSnakeCase)(footer);
92
+ return this;
93
+ }
94
+ /**
95
+ * Sets the image of the embed.
96
+ * @param url - The URL of the image.
97
+ * @returns The updated MessageEmbed instance.
98
+ * @example
99
+ * embed.setImage('https://example.com/image.png');
100
+ */
101
+ setImage(url) {
102
+ this.data.image = { url };
103
+ return this;
104
+ }
105
+ /**
106
+ * Sets the timestamp of the embed.
107
+ * @param time - The timestamp value.
108
+ * @returns The updated MessageEmbed instance.
109
+ * @example
110
+ * embed.setTimestamp();
111
+ * embed.setTimestamp(1628761200000);
112
+ * embed.setTimestamp(new Date());
113
+ */
114
+ setTimestamp(time = Date.now()) {
115
+ this.data.timestamp = new Date(time).toISOString();
116
+ return this;
117
+ }
118
+ /**
119
+ * Sets the title of the embed.
120
+ * @param title - The title of the embed.
121
+ * @returns The updated MessageEmbed instance.
122
+ * @example
123
+ * embed.setTitle('This is the title');
124
+ */
125
+ setTitle(title) {
126
+ this.data.title = title;
127
+ return this;
128
+ }
129
+ /**
130
+ * Sets the URL of the embed.
131
+ * @param url - The URL of the embed.
132
+ * @returns The updated MessageEmbed instance.
133
+ * @example
134
+ * embed.setURL('https://seyfert.com');
135
+ */
136
+ setURL(url) {
137
+ this.data.url = url;
138
+ return this;
139
+ }
140
+ /**
141
+ * Sets the thumbnail of the embed.
142
+ * @param url - The URL of the thumbnail.
143
+ * @returns The updated MessageEmbed instance.
144
+ * @example
145
+ * embed.setThumbnail('https://example.com/thumbnail.png');
146
+ */
147
+ setThumbnail(url) {
148
+ this.data.thumbnail = url ? { url } : undefined;
149
+ return this;
150
+ }
151
+ /**
152
+ * Converts the MessageEmbed instance to a JSON object.
153
+ * @returns The JSON representation of the MessageEmbed instance.
154
+ */
155
+ toJSON() {
156
+ return { ...this.data };
157
+ }
158
+ }
159
+ exports.Embed = Embed;
@@ -0,0 +1,111 @@
1
+ import { type APIModalInteractionResponseCallbackData, type APITextInputComponent, type RestOrArray, type TextInputStyle } from '../common';
2
+ import type { ActionRow } from './ActionRow';
3
+ import { BaseComponentBuilder, type OptionValuesLength } from './Base';
4
+ import type { ModalBuilderComponents, ModalSubmitCallback } from './types';
5
+ /**
6
+ * Represents a modal for user interactions.
7
+ * @template T - The type of components allowed in the modal.
8
+ * @example
9
+ * const modal = new Modal();
10
+ * modal.setTitle("Sample Modal");
11
+ * modal.addComponents(new TextInput().setLabel("Enter text"));
12
+ * modal.run((interaction) => {
13
+ * // Handle modal submission
14
+ * });
15
+ * const json = modal.toJSON();
16
+ */
17
+ export declare class Modal<T extends ModalBuilderComponents = TextInput> {
18
+ data: Partial<APIModalInteractionResponseCallbackData>;
19
+ components: ActionRow<T>[];
20
+ /**
21
+ * Creates a new Modal instance.
22
+ * @param data - Optional data for the modal.
23
+ */
24
+ constructor(data?: Partial<APIModalInteractionResponseCallbackData>);
25
+ /**
26
+ * Adds components to the modal.
27
+ * @param components - Components to be added to the modal.
28
+ * @returns The current Modal instance.
29
+ */
30
+ addComponents(...components: RestOrArray<ActionRow<T>>): this;
31
+ /**
32
+ * Sets the title of the modal.
33
+ * @param title - The title of the modal.
34
+ * @returns The current Modal instance.
35
+ */
36
+ setTitle(title: string): this;
37
+ /**
38
+ * Sets the custom ID of the modal.
39
+ * @param id - The custom ID for the modal.
40
+ * @returns The current Modal instance.
41
+ */
42
+ setCustomId(id: string): this;
43
+ /**
44
+ * Sets the callback function to be executed when the modal is submitted.
45
+ * @param func - The callback function.
46
+ * @returns The current Modal instance.
47
+ */
48
+ run(func: ModalSubmitCallback): this;
49
+ /**
50
+ * Converts the modal to JSON format.
51
+ * @returns The modal data in JSON format.
52
+ */
53
+ toJSON(): APIModalInteractionResponseCallbackData;
54
+ }
55
+ /**
56
+ * Represents a text input component builder.
57
+ * @example
58
+ * const textInput = new TextInput().setLabel("Enter text");
59
+ * textInput.setStyle(TextInputStyle.FULL);
60
+ * textInput.setPlaceholder("Type here");
61
+ * const json = textInput.toJSON();
62
+ */
63
+ export declare class TextInput extends BaseComponentBuilder<APITextInputComponent> {
64
+ /**
65
+ * Creates a new TextInput instance.
66
+ * @param data - Optional data for the text input.
67
+ */
68
+ constructor(data?: Partial<APITextInputComponent>);
69
+ /**
70
+ * Sets the style of the text input.
71
+ * @param style - The style of the text input.
72
+ * @returns The current TextInput instance.
73
+ */
74
+ setStyle(style: TextInputStyle): this;
75
+ /**
76
+ * Sets the label of the text input.
77
+ * @param label - The label of the text input.
78
+ * @returns The current TextInput instance.
79
+ */
80
+ setLabel(label: string): this;
81
+ /**
82
+ * Sets the placeholder of the text input.
83
+ * @param placeholder - The placeholder text.
84
+ * @returns The current TextInput instance.
85
+ */
86
+ setPlaceholder(placeholder: string): this;
87
+ /**
88
+ * Sets the length constraints for the text input.
89
+ * @param options - The length constraints.
90
+ * @returns The current TextInput instance.
91
+ */
92
+ setLength({ max, min }: Partial<OptionValuesLength>): this;
93
+ /**
94
+ * Sets the custom ID of the text input.
95
+ * @param id - The custom ID for the text input.
96
+ * @returns The current TextInput instance.
97
+ */
98
+ setCustomId(id: string): this;
99
+ /**
100
+ * Sets the initial value of the text input.
101
+ * @param value - The initial value.
102
+ * @returns The current TextInput instance.
103
+ */
104
+ setValue(value: string): this;
105
+ /**
106
+ * Sets whether the text input is required.
107
+ * @param required - Indicates whether the text input is required.
108
+ * @returns The current TextInput instance.
109
+ */
110
+ setRequired(required?: boolean): this;
111
+ }
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextInput = exports.Modal = void 0;
4
+ const common_1 = require("../common");
5
+ const Base_1 = require("./Base");
6
+ const index_1 = require("./index");
7
+ /**
8
+ * Represents a modal for user interactions.
9
+ * @template T - The type of components allowed in the modal.
10
+ * @example
11
+ * const modal = new Modal();
12
+ * modal.setTitle("Sample Modal");
13
+ * modal.addComponents(new TextInput().setLabel("Enter text"));
14
+ * modal.run((interaction) => {
15
+ * // Handle modal submission
16
+ * });
17
+ * const json = modal.toJSON();
18
+ */
19
+ class Modal {
20
+ data;
21
+ /** @internal */
22
+ __exec;
23
+ components = [];
24
+ /**
25
+ * Creates a new Modal instance.
26
+ * @param data - Optional data for the modal.
27
+ */
28
+ constructor(data = {}) {
29
+ this.data = data;
30
+ this.components = this.components.concat(data.components?.map(index_1.fromComponent) ?? []);
31
+ }
32
+ /**
33
+ * Adds components to the modal.
34
+ * @param components - Components to be added to the modal.
35
+ * @returns The current Modal instance.
36
+ */
37
+ addComponents(...components) {
38
+ this.components = this.components.concat((0, common_1.fastFlat)(components));
39
+ return this;
40
+ }
41
+ /**
42
+ * Sets the title of the modal.
43
+ * @param title - The title of the modal.
44
+ * @returns The current Modal instance.
45
+ */
46
+ setTitle(title) {
47
+ this.data.title = title;
48
+ return this;
49
+ }
50
+ /**
51
+ * Sets the custom ID of the modal.
52
+ * @param id - The custom ID for the modal.
53
+ * @returns The current Modal instance.
54
+ */
55
+ setCustomId(id) {
56
+ this.data.custom_id = id;
57
+ return this;
58
+ }
59
+ /**
60
+ * Sets the callback function to be executed when the modal is submitted.
61
+ * @param func - The callback function.
62
+ * @returns The current Modal instance.
63
+ */
64
+ run(func) {
65
+ this.__exec = func;
66
+ return this;
67
+ }
68
+ /**
69
+ * Converts the modal to JSON format.
70
+ * @returns The modal data in JSON format.
71
+ */
72
+ toJSON() {
73
+ return {
74
+ custom_id: this.data.custom_id,
75
+ title: this.data.title,
76
+ components: this.components.map(x => x.toJSON()),
77
+ };
78
+ }
79
+ }
80
+ exports.Modal = Modal;
81
+ /**
82
+ * Represents a text input component builder.
83
+ * @example
84
+ * const textInput = new TextInput().setLabel("Enter text");
85
+ * textInput.setStyle(TextInputStyle.FULL);
86
+ * textInput.setPlaceholder("Type here");
87
+ * const json = textInput.toJSON();
88
+ */
89
+ class TextInput extends Base_1.BaseComponentBuilder {
90
+ /**
91
+ * Creates a new TextInput instance.
92
+ * @param data - Optional data for the text input.
93
+ */
94
+ constructor(data = {}) {
95
+ super({ ...data, type: common_1.ComponentType.TextInput });
96
+ }
97
+ /**
98
+ * Sets the style of the text input.
99
+ * @param style - The style of the text input.
100
+ * @returns The current TextInput instance.
101
+ */
102
+ setStyle(style) {
103
+ this.data.style = style;
104
+ return this;
105
+ }
106
+ /**
107
+ * Sets the label of the text input.
108
+ * @param label - The label of the text input.
109
+ * @returns The current TextInput instance.
110
+ */
111
+ setLabel(label) {
112
+ this.data.label = label;
113
+ return this;
114
+ }
115
+ /**
116
+ * Sets the placeholder of the text input.
117
+ * @param placeholder - The placeholder text.
118
+ * @returns The current TextInput instance.
119
+ */
120
+ setPlaceholder(placeholder) {
121
+ this.data.placeholder = placeholder;
122
+ return this;
123
+ }
124
+ /**
125
+ * Sets the length constraints for the text input.
126
+ * @param options - The length constraints.
127
+ * @returns The current TextInput instance.
128
+ */
129
+ setLength({ max, min }) {
130
+ this.data.max_length = max;
131
+ this.data.min_length = min;
132
+ return this;
133
+ }
134
+ /**
135
+ * Sets the custom ID of the text input.
136
+ * @param id - The custom ID for the text input.
137
+ * @returns The current TextInput instance.
138
+ */
139
+ setCustomId(id) {
140
+ this.data.custom_id = id;
141
+ return this;
142
+ }
143
+ /**
144
+ * Sets the initial value of the text input.
145
+ * @param value - The initial value.
146
+ * @returns The current TextInput instance.
147
+ */
148
+ setValue(value) {
149
+ this.data.value = value;
150
+ return this;
151
+ }
152
+ /**
153
+ * Sets whether the text input is required.
154
+ * @param required - Indicates whether the text input is required.
155
+ * @returns The current TextInput instance.
156
+ */
157
+ setRequired(required = true) {
158
+ this.data.required = required;
159
+ return this;
160
+ }
161
+ }
162
+ exports.TextInput = TextInput;
@@ -0,0 +1,201 @@
1
+ import { type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIMessageComponentEmoji, type APIRoleSelectComponent, type APISelectMenuComponent, type APISelectMenuOption, type APIStringSelectComponent, type APIUserSelectComponent, type ChannelType, type RestOrArray } from '../common';
2
+ import type { ChannelSelectMenuInteraction, ComponentInteraction, MentionableSelectMenuInteraction, RoleSelectMenuInteraction, StringSelectMenuInteraction, UserSelectMenuInteraction } from '../structures';
3
+ import { BaseComponentBuilder, type OptionValuesLength } from './Base';
4
+ import type { ComponentCallback } from './types';
5
+ export type BuilderSelectMenus = RoleSelectMenu | UserSelectMenu | MentionableSelectMenu | ChannelSelectMenu | StringSelectMenu;
6
+ /**
7
+ * Represents a base class for building Select Menus.
8
+ * @template Select - The type of APISelectMenuComponent.
9
+ * @template Interaction - The type of interaction.
10
+ * @example
11
+ * const selectMenu = new SelectMenu<APIUserSelectComponent, UserSelectMenuInteraction>();
12
+ * selectMenu.setCustomId("user-select-menu");
13
+ * selectMenu.setPlaceholder("Select a user");
14
+ * selectMenu.run((interaction) => {
15
+ * // Handle select menu interaction
16
+ * });
17
+ */
18
+ export declare class SelectMenu<Select extends APISelectMenuComponent = APISelectMenuComponent, Interaction = ComponentInteraction> extends BaseComponentBuilder<Select> {
19
+ /**
20
+ * Sets the custom ID for the select menu.
21
+ * @param id - The custom ID for the select menu.
22
+ * @returns The current SelectMenu instance.
23
+ */
24
+ setCustomId(id: string): this;
25
+ /**
26
+ * Sets the placeholder text for the select menu.
27
+ * @param placeholder - The placeholder text.
28
+ * @returns The current SelectMenu instance.
29
+ */
30
+ setPlaceholder(placeholder: string): this;
31
+ /**
32
+ * Sets the maximum and minimum number of selected values for the select menu.
33
+ * @param options - The maximum and minimum values.
34
+ * @returns The current SelectMenu instance.
35
+ */
36
+ setValuesLength({ max, min }: Partial<OptionValuesLength>): this;
37
+ /**
38
+ * Sets whether the select menu is disabled.
39
+ * [disabled=true] - Indicates whether the select menu is disabled.
40
+ * @returns The current SelectMenu instance.
41
+ */
42
+ setDisabled(disabled?: boolean): this;
43
+ /**
44
+ * Sets the callback function to be executed when the select menu is interacted with.
45
+ * func - The callback function.
46
+ * @returns The current SelectMenu instance.
47
+ */
48
+ run(func: ComponentCallback<Interaction>): this;
49
+ }
50
+ /**
51
+ * Represents a Select Menu for selecting users.
52
+ * @example
53
+ * const userSelectMenu = new UserSelectMenu();
54
+ * userSelectMenu.setCustomId("user-select");
55
+ * userSelectMenu.addDefaultUsers("123456789", "987654321");
56
+ */
57
+ export declare class UserSelectMenu extends SelectMenu<APIUserSelectComponent, UserSelectMenuInteraction> {
58
+ constructor(data?: Partial<APIUserSelectComponent>);
59
+ /**
60
+ * Adds default selected users to the select menu.
61
+ * @param users - User IDs to be added as default.
62
+ * @returns The current UserSelectMenu instance.
63
+ */
64
+ addDefaultUsers(...users: RestOrArray<string>): this;
65
+ /**
66
+ * Sets the default selected users for the select menu.
67
+ * @param users - User IDs to be set as default.
68
+ * @returns The current UserSelectMenu instance.
69
+ */
70
+ setDefaultUsers(...users: RestOrArray<string>): this;
71
+ }
72
+ /**
73
+ * Represents a Select Menu for selecting roles.
74
+ * @example
75
+ * const roleSelectMenu = new RoleSelectMenu();
76
+ * roleSelectMenu.setCustomId("role-select");
77
+ * roleSelectMenu.addDefaultRoles("123456789", "987654321");
78
+ */
79
+ export declare class RoleSelectMenu extends SelectMenu<APIRoleSelectComponent, RoleSelectMenuInteraction> {
80
+ constructor(data?: Partial<APIRoleSelectComponent>);
81
+ /**
82
+ * Adds default selected roles to the select menu.
83
+ * @param roles - Role IDs to be added as default.
84
+ * @returns The current RoleSelectMenu instance.
85
+ */
86
+ addDefaultRoles(...roles: RestOrArray<string>): this;
87
+ /**
88
+ * Sets the default selected roles for the select menu.
89
+ * @param roles - Role IDs to be set as default.
90
+ * @returns The current RoleSelectMenu instance.
91
+ */
92
+ setDefaultRoles(...roles: RestOrArray<string>): this;
93
+ }
94
+ /**
95
+ * Represents a Select Menu for selecting mentionable entities.
96
+ * @example
97
+ * const mentionableSelectMenu = new MentionableSelectMenu();
98
+ * mentionableSelectMenu.setCustomId("mentionable-select");
99
+ */
100
+ export declare class MentionableSelectMenu extends SelectMenu<APIMentionableSelectComponent, MentionableSelectMenuInteraction> {
101
+ constructor(data?: Partial<APIMentionableSelectComponent>);
102
+ }
103
+ /**
104
+ * Represents a Select Menu for selecting channels.
105
+ * @example
106
+ * const channelSelectMenu = new ChannelSelectMenu();
107
+ * channelSelectMenu.setCustomId("channel-select");
108
+ * channelSelectMenu.addDefaultChannels("123456789", "987654321");
109
+ * channelSelectMenu.setChannelTypes([ChannelType.GuildText, ChannelType.GuildVoice]);
110
+ */
111
+ export declare class ChannelSelectMenu extends SelectMenu<APIChannelSelectComponent, ChannelSelectMenuInteraction> {
112
+ constructor(data?: Partial<APIChannelSelectComponent>);
113
+ /**
114
+ * Adds default selected channels to the select menu.
115
+ * @param channels - Channel IDs to be added as default.
116
+ * @returns The current ChannelSelectMenu instance.
117
+ */
118
+ addDefaultChannels(...channels: RestOrArray<string>): this;
119
+ /**
120
+ * Sets the default selected channels for the select menu.
121
+ * @param channels - Channel IDs to be set as default.
122
+ * @returns The current ChannelSelectMenu instance.
123
+ */
124
+ setDefaultChannels(...channels: RestOrArray<string>): this;
125
+ /**
126
+ * Sets the types of channels that can be selected in the menu.
127
+ * types - The types of channels.
128
+ * @returns The current ChannelSelectMenu instance.
129
+ */
130
+ setChannelTypes(types: ChannelType[]): this;
131
+ }
132
+ /**
133
+ * Represents a Select Menu for selecting string options.
134
+ * @example
135
+ * const stringSelectMenu = new StringSelectMenu();
136
+ * stringSelectMenu.setCustomId("string-select");
137
+ * stringSelectMenu.addOption(new StringSelectOption().setLabel("Option 1").setValue("option_1"));
138
+ * stringSelectMenu.setOptions([
139
+ * { label: "Option 2", value: "option_2" },
140
+ * { label: "Option 3", value: "option_3" },
141
+ * ]);
142
+ */
143
+ export declare class StringSelectMenu extends SelectMenu<APIStringSelectComponent, StringSelectMenuInteraction> {
144
+ constructor(data?: Partial<APIStringSelectComponent>);
145
+ /**
146
+ * Adds options to the string select menu.
147
+ * @param {...RestOrArray<APISelectMenuOption>} options - Options to be added.
148
+ * @returns The current StringSelectMenu instance.
149
+ */
150
+ addOption(...options: RestOrArray<APISelectMenuOption>): this;
151
+ /**
152
+ * Sets the options for the string select menu.
153
+ * options - Options to be set.
154
+ * @returns The current StringSelectMenu instance.
155
+ */
156
+ setOptions(options: APISelectMenuOption[]): this;
157
+ }
158
+ /**
159
+ * Represents an individual option for a string select menu.
160
+ * @example
161
+ * const option = new StringSelectOption().setLabel("Option 1").setValue("option_1");
162
+ */
163
+ export declare class StringSelectOption {
164
+ data: Partial<APISelectMenuOption>;
165
+ constructor(data?: Partial<APISelectMenuOption>);
166
+ /**
167
+ * Sets the label for the option.
168
+ * label - The label for the option.
169
+ * @returns The current StringSelectOption instance.
170
+ */
171
+ setLabel(label: string): this;
172
+ /**
173
+ * Sets the value for the option.
174
+ * value - The value for the option.
175
+ * @returns The current StringSelectOption instance.
176
+ */
177
+ setValue(value: string): this;
178
+ /**
179
+ * Sets the description for the option.
180
+ * description - The description for the option.
181
+ * @returns The current StringSelectOption instance.
182
+ */
183
+ setDescription(description: string): this;
184
+ /**
185
+ * Sets whether the option is the default.
186
+ * [Default=true] - Indicates whether the option is the default.
187
+ * @returns The current StringSelectOption instance.
188
+ */
189
+ setDefault(Default?: boolean): this;
190
+ /**
191
+ * Sets the emoji for the option.
192
+ * emoji - The emoji for the option.
193
+ * @returns The current StringSelectOption instance.
194
+ */
195
+ setEmoji(emoji: APIMessageComponentEmoji): this;
196
+ /**
197
+ * Converts the option to JSON format.
198
+ * @returns The option data in JSON format.
199
+ */
200
+ toJSON(): APISelectMenuOption;
201
+ }