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,350 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.GuildShorter = void 0;
7
+ const builders_1 = require("../../builders");
8
+ const structures_1 = require("../../structures");
9
+ const channels_1 = __importDefault(require("../../structures/channels"));
10
+ const base_1 = require("./base");
11
+ class GuildShorter extends base_1.BaseShorter {
12
+ /**
13
+ * Provides access to guild-related functionality.
14
+ */
15
+ get guilds() {
16
+ return {
17
+ /**
18
+ * Creates a new guild.
19
+ * @param body The data for creating the guild.
20
+ * @returns A Promise that resolves to the created guild.
21
+ */
22
+ create: async (body) => {
23
+ const guild = await this.client.proxy.guilds.post({ body });
24
+ await this.client.cache.guilds?.setIfNI('Guilds', guild.id, guild);
25
+ return new structures_1.Guild(this.client, guild);
26
+ },
27
+ /**
28
+ * Fetches a guild by its ID.
29
+ * @param id The ID of the guild to fetch.
30
+ * @param force Whether to force fetching the guild from the API even if it exists in the cache.
31
+ * @returns A Promise that resolves to the fetched guild.
32
+ */
33
+ fetch: async (id, force = false) => {
34
+ if (!force) {
35
+ const guild = await this.client.cache.guilds?.get(id);
36
+ if (guild)
37
+ return guild;
38
+ }
39
+ const data = await this.client.proxy.guilds(id).get();
40
+ await this.client.cache.guilds?.patch(id, data);
41
+ return (await this.client.cache.guilds?.get(id)) ?? new structures_1.Guild(this.client, data);
42
+ },
43
+ /**
44
+ * Generates the widget URL for the guild.
45
+ * @param id The ID of the guild.
46
+ * @param style The style of the widget.
47
+ * @returns The generated widget URL.
48
+ */
49
+ widgetURL: (id, style) => {
50
+ const query = new URLSearchParams();
51
+ if (style) {
52
+ query.append('style', style);
53
+ }
54
+ return this.client.proxy.guilds(id).widget.get({ query });
55
+ },
56
+ channels: this.channels,
57
+ moderation: this.moderation,
58
+ stickers: this.stickers,
59
+ emojis: this.emojis,
60
+ };
61
+ }
62
+ /**
63
+ * Provides access to emoji-related functionality in a guild.
64
+ */
65
+ get emojis() {
66
+ return {
67
+ /**
68
+ * Retrieves a list of emojis in the guild.
69
+ * @param guildId The ID of the guild.
70
+ * @param force Whether to force fetching emojis from the API even if they exist in the cache.
71
+ * @returns A Promise that resolves to an array of emojis.
72
+ */
73
+ list: async (guildId, force = false) => {
74
+ let emojis;
75
+ if (!force) {
76
+ emojis = (await this.client.cache.emojis?.values(guildId)) ?? [];
77
+ if (emojis.length) {
78
+ return emojis;
79
+ }
80
+ }
81
+ emojis = await this.client.proxy.guilds(guildId).emojis.get();
82
+ await this.client.cache.emojis?.set(emojis.map(x => [x.id, x]), guildId);
83
+ return emojis.map(m => new structures_1.GuildEmoji(this.client, m, guildId));
84
+ },
85
+ /**
86
+ * Creates a new emoji in the guild.
87
+ * @param guildId The ID of the guild.
88
+ * @param body The data for creating the emoji.
89
+ * @returns A Promise that resolves to the created emoji.
90
+ */
91
+ create: async (guildId, body) => {
92
+ const bodyResolved = { ...body, image: await (0, builders_1.resolveImage)(body.image) };
93
+ const emoji = await this.client.proxy.guilds(guildId).emojis.post({
94
+ body: bodyResolved,
95
+ });
96
+ await this.client.cache.channels?.setIfNI('GuildEmojisAndStickers', emoji.id, guildId, emoji);
97
+ },
98
+ /**
99
+ * Fetches an emoji by its ID.
100
+ * @param guildId The ID of the guild.
101
+ * @param emojiId The ID of the emoji to fetch.
102
+ * @param force Whether to force fetching the emoji from the API even if it exists in the cache.
103
+ * @returns A Promise that resolves to the fetched emoji.
104
+ */
105
+ fetch: async (guildId, emojiId, force = false) => {
106
+ let emoji;
107
+ if (!force) {
108
+ emoji = await this.client.cache.emojis?.get(emojiId);
109
+ if (emoji)
110
+ return emoji;
111
+ }
112
+ emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).get();
113
+ return new structures_1.GuildEmoji(this.client, emoji, guildId);
114
+ },
115
+ /**
116
+ * Deletes an emoji from the guild.
117
+ * @param guildId The ID of the guild.
118
+ * @param emojiId The ID of the emoji to delete.
119
+ * @param reason The reason for deleting the emoji.
120
+ */
121
+ delete: async (guildId, emojiId, reason) => {
122
+ await this.client.proxy.guilds(guildId).emojis(emojiId).delete({ reason });
123
+ await this.client.cache.channels?.removeIfNI('GuildEmojisAndStickers', emojiId, guildId);
124
+ },
125
+ /**
126
+ * Edits an emoji in the guild.
127
+ * @param guildId The ID of the guild.
128
+ * @param emojiId The ID of the emoji to edit.
129
+ * @param body The data to update the emoji with.
130
+ * @param reason The reason for editing the emoji.
131
+ * @returns A Promise that resolves to the edited emoji.
132
+ */
133
+ edit: async (guildId, emojiId, body, reason) => {
134
+ const emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).patch({ body, reason });
135
+ await this.client.cache.channels?.setIfNI('GuildEmojisAndStickers', emoji.id, guildId, emoji);
136
+ return new structures_1.GuildEmoji(this.client, emoji, guildId);
137
+ },
138
+ };
139
+ }
140
+ /**
141
+ * Provides access to channel-related functionality in a guild.
142
+ */
143
+ get channels() {
144
+ return {
145
+ /**
146
+ * Retrieves a list of channels in the guild.
147
+ * @param guildId The ID of the guild.
148
+ * @param force Whether to force fetching channels from the API even if they exist in the cache.
149
+ * @returns A Promise that resolves to an array of channels.
150
+ */
151
+ list: async (guildId, force = false) => {
152
+ let channels;
153
+ if (!force) {
154
+ channels = (await this.client.cache.channels?.values(guildId)) ?? [];
155
+ if (channels.length) {
156
+ return channels;
157
+ }
158
+ }
159
+ channels = await this.client.proxy.guilds(guildId).channels.get();
160
+ await this.client.cache.channels?.set(channels.map(x => [x.id, x]), guildId);
161
+ return channels.map(m => (0, channels_1.default)(m, this.client));
162
+ },
163
+ /**
164
+ * Fetches a channel by its ID.
165
+ * @param guildId The ID of the guild.
166
+ * @param channelId The ID of the channel to fetch.
167
+ * @param force Whether to force fetching the channel from the API even if it exists in the cache.
168
+ * @returns A Promise that resolves to the fetched channel.
169
+ */
170
+ fetch: async (guildId, channelId, force) => {
171
+ let channel;
172
+ if (!force) {
173
+ channel = await this.client.cache.channels?.get(channelId);
174
+ if (channel)
175
+ return channel;
176
+ }
177
+ channel = await this.client.proxy.channels(channelId).get();
178
+ await this.client.cache.channels?.patch(channelId, guildId, channel);
179
+ return (0, channels_1.default)(channel, this.client);
180
+ },
181
+ /**
182
+ * Creates a new channel in the guild.
183
+ * @param guildId The ID of the guild.
184
+ * @param body The data for creating the channel.
185
+ * @returns A Promise that resolves to the created channel.
186
+ */
187
+ create: async (guildId, body) => {
188
+ const res = await this.client.proxy.guilds(guildId).channels.post({ body });
189
+ await this.client.cache.channels?.setIfNI(structures_1.BaseChannel.__intent__(guildId), res.id, guildId, res);
190
+ return (0, channels_1.default)(res, this.client);
191
+ },
192
+ /**
193
+ * Deletes a channel from the guild.
194
+ * @param guildId The ID of the guild.
195
+ * @param channelId The ID of the channel to delete.
196
+ * @param reason The reason for deleting the channel.
197
+ * @returns A Promise that resolves to the deleted channel.
198
+ */
199
+ delete: async (guildId, channelId, reason) => {
200
+ const res = await this.client.proxy.channels(channelId).delete({ reason });
201
+ await this.client.cache.channels?.removeIfNI(structures_1.BaseChannel.__intent__(guildId), res.id, guildId);
202
+ return (0, channels_1.default)(res, this.client);
203
+ },
204
+ /**
205
+ * Edits a channel in the guild.
206
+ * @param guildchannelId The ID of the guild.
207
+ * @param channelId The ID of the channel to edit.
208
+ * @param body The data to update the channel with.
209
+ * @param reason The reason for editing the channel.
210
+ * @returns A Promise that resolves to the edited channel.
211
+ */
212
+ edit: async (guildchannelId, channelId, body, reason) => {
213
+ const res = await this.client.proxy.channels(channelId).patch({ body, reason });
214
+ await this.client.cache.channels?.setIfNI(structures_1.BaseChannel.__intent__(guildchannelId), res.id, guildchannelId, res);
215
+ return (0, channels_1.default)(res, this.client);
216
+ },
217
+ /**
218
+ * Edits the positions of channels in the guild.
219
+ * @param guildId The ID of the guild.
220
+ * @param body The data containing the new positions of channels.
221
+ */
222
+ editPositions: (guildId, body) => this.client.proxy.guilds(guildId).channels.patch({ body }),
223
+ };
224
+ }
225
+ /**
226
+ * Provides access to auto-moderation rule-related functionality in a guild.
227
+ */
228
+ get moderation() {
229
+ return {
230
+ /**
231
+ * Retrieves a list of auto-moderation rules in the guild.
232
+ * @param guildId The ID of the guild.
233
+ * @returns A Promise that resolves to an array of auto-moderation rules.
234
+ */
235
+ list: (guildId) => this.client.proxy.guilds(guildId)['auto-moderation'].rules.get(),
236
+ /**
237
+ * Creates a new auto-moderation rule in the guild.
238
+ * @param guildId The ID of the guild.
239
+ * @param body The data for creating the auto-moderation rule.
240
+ * @returns A Promise that resolves to the created auto-moderation rule.
241
+ */
242
+ create: (guildId, body) => this.client.proxy.guilds(guildId)['auto-moderation'].rules.post({ body }),
243
+ /**
244
+ * Deletes an auto-moderation rule from the guild.
245
+ * @param guildId The ID of the guild.
246
+ * @param ruleId The ID of the rule to delete.
247
+ * @param reason The reason for deleting the rule.
248
+ * @returns A Promise that resolves once the rule is deleted.
249
+ */
250
+ delete: (guildId, ruleId, reason) => {
251
+ return this.client.proxy.guilds(guildId)['auto-moderation'].rules(ruleId).delete({ reason });
252
+ },
253
+ /**
254
+ * Fetches an auto-moderation rule by its ID.
255
+ * @param guildId The ID of the guild.
256
+ * @param ruleId The ID of the rule to fetch.
257
+ * @returns A Promise that resolves to the fetched auto-moderation rule.
258
+ */
259
+ fetch: (guildId, ruleId) => {
260
+ return this.client.proxy.guilds(guildId)['auto-moderation'].rules(ruleId).get();
261
+ },
262
+ /**
263
+ * Edits an auto-moderation rule in the guild.
264
+ * @param guildId The ID of the guild.
265
+ * @param ruleId The ID of the rule to edit.
266
+ * @param body The data to update the rule with.
267
+ * @param reason The reason for editing the rule.
268
+ * @returns A Promise that resolves to the edited auto-moderation rule.
269
+ */
270
+ edit: (guildId, ruleId, body, reason) => {
271
+ return this.client.proxy.guilds(guildId)['auto-moderation'].rules(ruleId).patch({ body, reason });
272
+ },
273
+ };
274
+ }
275
+ /**
276
+ * Provides access to sticker-related functionality in a guild.
277
+ */
278
+ get stickers() {
279
+ return {
280
+ /**
281
+ * Retrieves a list of stickers in the guild.
282
+ * @param guildId The ID of the guild.
283
+ * @returns A Promise that resolves to an array of stickers.
284
+ */
285
+ list: async (guildId) => {
286
+ const stickers = await this.client.proxy.guilds(guildId).stickers.get();
287
+ await this.client.cache.stickers?.set(stickers.map(st => [st.id, st]), guildId);
288
+ return stickers.map(st => new structures_1.Sticker(this.client, st));
289
+ },
290
+ /**
291
+ * Creates a new sticker in the guild.
292
+ * @param guildId The ID of the guild.
293
+ * @param request The request body for creating the sticker.
294
+ * @param reason The reason for creating the sticker.
295
+ * @returns A Promise that resolves to the created sticker.
296
+ */
297
+ create: async (guildId, { file, ...json }, reason) => {
298
+ const fileResolve = await (0, builders_1.resolveFiles)([file]);
299
+ const sticker = await this.client.proxy
300
+ .guilds(guildId)
301
+ .stickers.post({ reason, body: json, files: [{ ...fileResolve[0], key: 'file' }], appendToFormData: true });
302
+ await this.client.cache.stickers?.setIfNI('GuildEmojisAndStickers', sticker.id, guildId, sticker);
303
+ return new structures_1.Sticker(this.client, sticker);
304
+ },
305
+ /**
306
+ * Edits an existing sticker in the guild.
307
+ * @param guildId The ID of the guild.
308
+ * @param stickerId The ID of the sticker to edit.
309
+ * @param body The data to update the sticker with.
310
+ * @param reason The reason for editing the sticker.
311
+ * @returns A Promise that resolves to the edited sticker.
312
+ */
313
+ edit: async (guildId, stickerId, body, reason) => {
314
+ const sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).patch({ body, reason });
315
+ await this.client.cache.stickers?.setIfNI('GuildEmojisAndStickers', stickerId, guildId, sticker);
316
+ return new structures_1.Sticker(this.client, sticker);
317
+ },
318
+ /**
319
+ * Fetches a sticker by its ID from the guild.
320
+ * @param guildId The ID of the guild.
321
+ * @param stickerId The ID of the sticker to fetch.
322
+ * @param force Whether to force fetching the sticker from the API even if it exists in the cache.
323
+ * @returns A Promise that resolves to the fetched sticker.
324
+ */
325
+ fetch: async (guildId, stickerId, force = false) => {
326
+ let sticker;
327
+ if (!force) {
328
+ sticker = await this.client.cache.stickers?.get(stickerId);
329
+ if (sticker)
330
+ return sticker;
331
+ }
332
+ sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).get();
333
+ await this.client.cache.stickers?.patch(stickerId, guildId, sticker);
334
+ return new structures_1.Sticker(this.client, sticker);
335
+ },
336
+ /**
337
+ * Deletes a sticker from the guild.
338
+ * @param guildId The ID of the guild.
339
+ * @param stickerId The ID of the sticker to delete.
340
+ * @param reason The reason for deleting the sticker.
341
+ * @returns A Promise that resolves once the sticker is deleted.
342
+ */
343
+ delete: async (guildId, stickerId, reason) => {
344
+ await this.client.proxy.guilds(guildId).stickers(stickerId).delete({ reason });
345
+ await this.client.cache.stickers?.removeIfNI('GuildEmojisAndStickers', stickerId, guildId);
346
+ },
347
+ };
348
+ }
349
+ }
350
+ exports.GuildShorter = GuildShorter;
@@ -0,0 +1,115 @@
1
+ import { type GuildMemberResolvable, type RESTGetAPIGuildMembersQuery, type RESTGetAPIGuildMembersSearchQuery, type RESTPatchAPIGuildMemberJSONBody, type RESTPutAPIGuildBanJSONBody, type RESTPutAPIGuildMemberJSONBody } from '..';
2
+ import { GuildMember } from '../../structures';
3
+ import { BaseShorter } from './base';
4
+ export declare class MemberShorter extends BaseShorter {
5
+ /**
6
+ * Provides access to member-related functionality in a guild.
7
+ */
8
+ get members(): {
9
+ /**
10
+ * Resolves a member in the guild based on the provided GuildMemberResolvable.
11
+ * @param guildId The ID of the guild.
12
+ * @param resolve The GuildMemberResolvable to resolve.
13
+ * @returns A Promise that resolves to the resolved member.
14
+ */
15
+ resolve: (guildId: string, resolve: GuildMemberResolvable) => Promise<GuildMember | undefined>;
16
+ /**
17
+ * Searches for members in the guild based on the provided query.
18
+ * @param guildId The ID of the guild.
19
+ * @param query The query parameters for searching members.
20
+ * @returns A Promise that resolves to an array of matched members.
21
+ */
22
+ search: (guildId: string, query?: RESTGetAPIGuildMembersSearchQuery) => Promise<GuildMember[]>;
23
+ /**
24
+ * Unbans a member from the guild.
25
+ * @param guildId The ID of the guild.
26
+ * @param memberId The ID of the member to unban.
27
+ * @param body The request body for unbanning the member.
28
+ * @param reason The reason for unbanning the member.
29
+ */
30
+ unban: (guildId: string, memberId: string, body?: RESTPutAPIGuildBanJSONBody, reason?: string) => Promise<void>;
31
+ /**
32
+ * Bans a member from the guild.
33
+ * @param guildId The ID of the guild.
34
+ * @param memberId The ID of the member to ban.
35
+ * @param body The request body for banning the member.
36
+ * @param reason The reason for banning the member.
37
+ */
38
+ ban: (guildId: string, memberId: string, body?: RESTPutAPIGuildBanJSONBody, reason?: string) => Promise<void>;
39
+ /**
40
+ * Kicks a member from the guild.
41
+ * @param guildId The ID of the guild.
42
+ * @param memberId The ID of the member to kick.
43
+ * @param reason The reason for kicking the member.
44
+ */
45
+ kick: (guildId: string, memberId: string, reason?: string) => Promise<void>;
46
+ /**
47
+ * Edits a member in the guild.
48
+ * @param guildId The ID of the guild.
49
+ * @param memberId The ID of the member to edit.
50
+ * @param body The data to update the member with.
51
+ * @param reason The reason for editing the member.
52
+ * @returns A Promise that resolves to the edited member.
53
+ */
54
+ edit: (guildId: string, memberId: string, body: RESTPatchAPIGuildMemberJSONBody, reason?: string) => Promise<GuildMember>;
55
+ /**
56
+ * Adds a member to the guild.
57
+ * @param guildId The ID of the guild.
58
+ * @param memberId The ID of the member to add.
59
+ * @param body The request body for adding the member.
60
+ * @returns A Promise that resolves to the added member.
61
+ */
62
+ add: (guildId: string, memberId: string, body: RESTPutAPIGuildMemberJSONBody) => Promise<GuildMember | undefined>;
63
+ /**
64
+ * Fetches a member from the guild.
65
+ * @param guildId The ID of the guild.
66
+ * @param memberId The ID of the member to fetch.
67
+ * @param force Whether to force fetching the member from the API even if it exists in the cache.
68
+ * @returns A Promise that resolves to the fetched member.
69
+ */
70
+ fetch: (guildId: string, memberId: string, force?: boolean) => Promise<GuildMember>;
71
+ /**
72
+ * Lists members in the guild based on the provided query.
73
+ * @param guildId The ID of the guild.
74
+ * @param query The query parameters for listing members.
75
+ * @param force Whether to force listing members from the API even if they exist in the cache.
76
+ * @returns A Promise that resolves to an array of listed members.
77
+ */
78
+ list: (guildId: string, query?: RESTGetAPIGuildMembersQuery, force?: boolean) => Promise<GuildMember[]>;
79
+ /**
80
+ * Provides methods to add and remove roles from a guild member.
81
+ */
82
+ roles: {
83
+ /**
84
+ * Adds a role to a guild member.
85
+ * @param guildId The ID of the guild.
86
+ * @param memberId The ID of the member to add the role to.
87
+ * @param id The ID of the role to add.
88
+ */
89
+ add: (guildId: string, memberId: string, id: string) => Promise<void>;
90
+ /**
91
+ * Removes a role from a guild member.
92
+ * @param guildId The ID of the guild.
93
+ * @param memberId The ID of the member to remove the role from.
94
+ * @param id The ID of the role to remove.
95
+ */
96
+ remove: (guildId: string, memberId: string, id: string) => Promise<void>;
97
+ };
98
+ };
99
+ get roles(): {
100
+ /**
101
+ * Adds a role to a guild member.
102
+ * @param guildId The ID of the guild.
103
+ * @param memberId The ID of the member to add the role to.
104
+ * @param id The ID of the role to add.
105
+ */
106
+ add: (guildId: string, memberId: string, id: string) => Promise<void>;
107
+ /**
108
+ * Removes a role from a guild member.
109
+ * @param guildId The ID of the guild.
110
+ * @param memberId The ID of the member to remove the role from.
111
+ * @param id The ID of the role to remove.
112
+ */
113
+ remove: (guildId: string, memberId: string, id: string) => Promise<void>;
114
+ };
115
+ }
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemberShorter = void 0;
4
+ const __1 = require("..");
5
+ const structures_1 = require("../../structures");
6
+ const base_1 = require("./base");
7
+ class MemberShorter extends base_1.BaseShorter {
8
+ /**
9
+ * Provides access to member-related functionality in a guild.
10
+ */
11
+ get members() {
12
+ return {
13
+ /**
14
+ * Resolves a member in the guild based on the provided GuildMemberResolvable.
15
+ * @param guildId The ID of the guild.
16
+ * @param resolve The GuildMemberResolvable to resolve.
17
+ * @returns A Promise that resolves to the resolved member.
18
+ */
19
+ resolve: async (guildId, resolve) => {
20
+ if (typeof resolve === 'string') {
21
+ const match = resolve.match(__1.FormattingPatterns.User)?.groups;
22
+ if (match?.id) {
23
+ return this.members.fetch(guildId, match.id);
24
+ }
25
+ if (resolve.match(/\d{17,20}/)) {
26
+ return this.members.fetch(guildId, resolve);
27
+ }
28
+ return this.members.search(guildId, { query: resolve, limit: 1 }).then(x => x[0]);
29
+ }
30
+ if (resolve.id) {
31
+ return this.client.members.fetch(guildId, resolve.id);
32
+ }
33
+ return resolve.displayName
34
+ ? this.members.search(guildId, { query: resolve.displayName, limit: 1 }).then(x => x[0])
35
+ : undefined;
36
+ },
37
+ /**
38
+ * Searches for members in the guild based on the provided query.
39
+ * @param guildId The ID of the guild.
40
+ * @param query The query parameters for searching members.
41
+ * @returns A Promise that resolves to an array of matched members.
42
+ */
43
+ search: async (guildId, query) => {
44
+ const members = await this.client.proxy.guilds(guildId).members.search.get({
45
+ query,
46
+ });
47
+ await this.client.cache.members?.set(members.map(x => [x.user.id, x]), guildId);
48
+ return members.map(m => new structures_1.GuildMember(this.client, m, m.user, guildId));
49
+ },
50
+ /**
51
+ * Unbans a member from the guild.
52
+ * @param guildId The ID of the guild.
53
+ * @param memberId The ID of the member to unban.
54
+ * @param body The request body for unbanning the member.
55
+ * @param reason The reason for unbanning the member.
56
+ */
57
+ unban: async (guildId, memberId, body, reason) => {
58
+ await this.client.proxy.guilds(guildId).bans(memberId).delete({ reason, body });
59
+ },
60
+ /**
61
+ * Bans a member from the guild.
62
+ * @param guildId The ID of the guild.
63
+ * @param memberId The ID of the member to ban.
64
+ * @param body The request body for banning the member.
65
+ * @param reason The reason for banning the member.
66
+ */
67
+ ban: async (guildId, memberId, body, reason) => {
68
+ await this.client.proxy.guilds(guildId).bans(memberId).put({ reason, body });
69
+ await this.client.cache.members?.removeIfNI('GuildBans', memberId, guildId);
70
+ },
71
+ /**
72
+ * Kicks a member from the guild.
73
+ * @param guildId The ID of the guild.
74
+ * @param memberId The ID of the member to kick.
75
+ * @param reason The reason for kicking the member.
76
+ */
77
+ kick: async (guildId, memberId, reason) => {
78
+ await this.client.proxy.guilds(guildId).members(memberId).delete({ reason });
79
+ await this.client.cache.members?.removeIfNI('GuildMembers', memberId, guildId);
80
+ },
81
+ /**
82
+ * Edits a member in the guild.
83
+ * @param guildId The ID of the guild.
84
+ * @param memberId The ID of the member to edit.
85
+ * @param body The data to update the member with.
86
+ * @param reason The reason for editing the member.
87
+ * @returns A Promise that resolves to the edited member.
88
+ */
89
+ edit: async (guildId, memberId, body, reason) => {
90
+ const member = await this.client.proxy.guilds(guildId).members(memberId).patch({ body, reason });
91
+ await this.client.cache.members?.setIfNI('GuildMembers', memberId, guildId, member);
92
+ return new structures_1.GuildMember(this.client, member, member.user, guildId);
93
+ },
94
+ /**
95
+ * Adds a member to the guild.
96
+ * @param guildId The ID of the guild.
97
+ * @param memberId The ID of the member to add.
98
+ * @param body The request body for adding the member.
99
+ * @returns A Promise that resolves to the added member.
100
+ */
101
+ add: async (guildId, memberId, body) => {
102
+ const member = await this.client.proxy.guilds(guildId).members(memberId).put({
103
+ body,
104
+ });
105
+ // Thanks dapi-types, fixed
106
+ if (!member) {
107
+ return;
108
+ }
109
+ await this.client.cache.members?.setIfNI('GuildMembers', member.user.id, guildId, member);
110
+ return new structures_1.GuildMember(this.client, member, member.user, guildId);
111
+ },
112
+ /**
113
+ * Fetches a member from the guild.
114
+ * @param guildId The ID of the guild.
115
+ * @param memberId The ID of the member to fetch.
116
+ * @param force Whether to force fetching the member from the API even if it exists in the cache.
117
+ * @returns A Promise that resolves to the fetched member.
118
+ */
119
+ fetch: async (guildId, memberId, force = false) => {
120
+ let member;
121
+ if (!force) {
122
+ member = await this.client.cache.members?.get(memberId, guildId);
123
+ if (member)
124
+ return member;
125
+ }
126
+ member = await this.client.proxy.guilds(guildId).members(memberId).get();
127
+ await this.client.cache.members?.set(member.user.id, guildId, member);
128
+ return new structures_1.GuildMember(this.client, member, member.user, guildId);
129
+ },
130
+ /**
131
+ * Lists members in the guild based on the provided query.
132
+ * @param guildId The ID of the guild.
133
+ * @param query The query parameters for listing members.
134
+ * @param force Whether to force listing members from the API even if they exist in the cache.
135
+ * @returns A Promise that resolves to an array of listed members.
136
+ */
137
+ list: async (guildId, query, force = false) => {
138
+ let members;
139
+ if (!force) {
140
+ members = (await this.client.cache.members?.values(guildId)) ?? [];
141
+ if (members.length)
142
+ return members;
143
+ }
144
+ members = await this.client.proxy.guilds(guildId).members.get({
145
+ query,
146
+ });
147
+ await this.client.cache.members?.set(members.map(x => [x.user.id, x]), guildId);
148
+ return members.map(m => new structures_1.GuildMember(this.client, m, m.user, guildId));
149
+ },
150
+ /**
151
+ * Provides methods to add and remove roles from a guild member.
152
+ */
153
+ roles: this.roles,
154
+ };
155
+ }
156
+ get roles() {
157
+ return {
158
+ /**
159
+ * Adds a role to a guild member.
160
+ * @param guildId The ID of the guild.
161
+ * @param memberId The ID of the member to add the role to.
162
+ * @param id The ID of the role to add.
163
+ */
164
+ add: async (guildId, memberId, id) => {
165
+ await this.client.proxy.guilds(guildId).members(memberId).roles(id).put({});
166
+ },
167
+ /**
168
+ * Removes a role from a guild member.
169
+ * @param guildId The ID of the guild.
170
+ * @param memberId The ID of the member to remove the role from.
171
+ * @param id The ID of the role to remove.
172
+ */
173
+ remove: async (guildId, memberId, id) => {
174
+ await this.client.proxy.guilds(guildId).members(memberId).roles(id).delete();
175
+ },
176
+ };
177
+ }
178
+ }
179
+ exports.MemberShorter = MemberShorter;
@@ -0,0 +1,27 @@
1
+ import type { RESTGetAPIChannelMessageReactionUsersQuery } from 'discord-api-types/v10';
2
+ import { Message, User } from '../../structures';
3
+ import type { EmojiResolvable } from '../types/resolvables';
4
+ import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../types/write';
5
+ import { BaseShorter } from './base';
6
+ export declare class MessageShorter extends BaseShorter {
7
+ get messages(): {
8
+ write: (channelId: string, { files, ...body }: MessageCreateBodyRequest) => Promise<Message>;
9
+ edit: (messageId: string, channelId: string, { files, ...body }: MessageUpdateBodyRequest) => Promise<Message>;
10
+ crosspost: (messageId: string, channelId: string, reason?: string) => Promise<Message>;
11
+ delete: (messageId: string, channelId: string, reason?: string) => Promise<void>;
12
+ fetch: (messageId: string, channelId: string) => Promise<Message>;
13
+ purge: (messages: string[], channelId: string, reason?: string) => Promise<never>;
14
+ reactions: {
15
+ add: (messageId: string, channelId: string, emoji: EmojiResolvable) => Promise<never>;
16
+ delete: (messageId: string, channelId: string, emoji: EmojiResolvable, userId?: string) => Promise<never>;
17
+ fetch: (messageId: string, channelId: string, emoji: EmojiResolvable, query?: RESTGetAPIChannelMessageReactionUsersQuery | undefined) => Promise<User[]>;
18
+ purge: (messageId: string, channelId: string, emoji?: EmojiResolvable | undefined) => Promise<never>;
19
+ };
20
+ };
21
+ get reactions(): {
22
+ add: (messageId: string, channelId: string, emoji: EmojiResolvable) => Promise<never>;
23
+ delete: (messageId: string, channelId: string, emoji: EmojiResolvable, userId?: string) => Promise<never>;
24
+ fetch: (messageId: string, channelId: string, emoji: EmojiResolvable, query?: RESTGetAPIChannelMessageReactionUsersQuery) => Promise<User[]>;
25
+ purge: (messageId: string, channelId: string, emoji?: EmojiResolvable) => Promise<never>;
26
+ };
27
+ }