discordeno 16.0.0 → 17.0.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 (255) hide show
  1. package/README.md +72 -69
  2. package/esm/gateway/shard/connect.js +7 -3
  3. package/esm/helpers/channels/mod.js +0 -1
  4. package/esm/helpers/guilds/invites/createInvite.js +1 -0
  5. package/esm/helpers/interactions/responses/editFollowupMessage.js +2 -1
  6. package/esm/helpers/interactions/responses/editOriginalInteractionResponse.js +7 -4
  7. package/esm/helpers/misc/getNitroStickerPacks.js +8 -1
  8. package/esm/helpers/mod.js +1 -0
  9. package/esm/helpers/stickers/createGuildSticker.js +25 -0
  10. package/esm/helpers/stickers/deleteGuildSticker.js +18 -0
  11. package/esm/helpers/stickers/editGuildSticker.js +22 -0
  12. package/esm/helpers/stickers/getGuildSticker.js +16 -0
  13. package/esm/helpers/stickers/getGuildStickers.js +19 -0
  14. package/esm/helpers/stickers/getSticker.js +13 -0
  15. package/esm/helpers/stickers/mod.js +6 -0
  16. package/esm/helpers/webhooks/editOriginalWebhookMessage.js +7 -4
  17. package/esm/helpers/webhooks/editWebhookMessage.js +7 -4
  18. package/esm/helpers/{channels → webhooks}/getChannelWebhooks.js +0 -0
  19. package/esm/helpers/webhooks/{getWebhooks.js → getGuildWebhooks.js} +1 -1
  20. package/esm/helpers/webhooks/mod.js +2 -1
  21. package/esm/plugins/permissions/mod.js +2 -0
  22. package/esm/plugins/permissions/src/channels/createChannel.js +2 -2
  23. package/esm/plugins/permissions/src/channels/deleteChannel.js +2 -2
  24. package/esm/plugins/permissions/src/channels/deleteChannelPermissionOverride.js +2 -2
  25. package/esm/plugins/permissions/src/channels/editChannel.js +2 -2
  26. package/esm/plugins/permissions/src/channels/editChannelPermissionOverrides.js +2 -2
  27. package/esm/plugins/permissions/src/channels/followAnnouncementChannel.js +4 -4
  28. package/esm/plugins/permissions/src/channels/forums/createForumThread.js +2 -2
  29. package/esm/plugins/permissions/src/channels/getChannelWebhooks.js +2 -2
  30. package/esm/plugins/permissions/src/channels/stages/createStageInstance.js +2 -2
  31. package/esm/plugins/permissions/src/channels/stages/deleteStageInstances.js +2 -2
  32. package/esm/plugins/permissions/src/channels/stages/editStageInstance.js +2 -2
  33. package/esm/plugins/permissions/src/channels/threads/addThreadMember.js +1 -1
  34. package/esm/plugins/permissions/src/channels/threads/getPrivateArchivedThreads.js +6 -2
  35. package/esm/plugins/permissions/src/channels/threads/getPrivateJoinedArchivedThreads.js +2 -2
  36. package/esm/plugins/permissions/src/channels/threads/getPublicArchivedThreads.js +2 -2
  37. package/esm/plugins/permissions/src/channels/threads/joinThread.js +2 -2
  38. package/esm/plugins/permissions/src/channels/threads/leaveThread.js +2 -2
  39. package/esm/plugins/permissions/src/channels/threads/removeThreadMember.js +1 -1
  40. package/esm/plugins/permissions/src/emojis/createEmoji.js +1 -1
  41. package/esm/plugins/permissions/src/emojis/deleteEmoji.js +1 -1
  42. package/esm/plugins/permissions/src/emojis/editEmoji.js +1 -1
  43. package/esm/plugins/permissions/src/guilds/automod/createAutomodRule.js +2 -2
  44. package/esm/plugins/permissions/src/guilds/automod/deleteAutomodRule.js +1 -1
  45. package/esm/plugins/permissions/src/guilds/automod/editAutomodRule.js +2 -2
  46. package/esm/plugins/permissions/src/guilds/automod/getAutomodRule.js +1 -1
  47. package/esm/plugins/permissions/src/guilds/automod/getAutomodRules.js +1 -1
  48. package/esm/plugins/permissions/src/guilds/deleteGuild.js +1 -1
  49. package/esm/plugins/permissions/src/guilds/editGuild.js +2 -2
  50. package/esm/plugins/permissions/src/guilds/editGuildMfaLevel.js +1 -1
  51. package/esm/plugins/permissions/src/guilds/editWelcomeScreen.js +1 -1
  52. package/esm/plugins/permissions/src/guilds/events/createScheduledEvent.js +7 -7
  53. package/esm/plugins/permissions/src/guilds/events/editScheduledEvent.js +7 -7
  54. package/esm/plugins/permissions/src/guilds/getAuditLog.js +1 -1
  55. package/esm/plugins/permissions/src/guilds/getBan.js +1 -1
  56. package/esm/plugins/permissions/src/guilds/getBans.js +1 -1
  57. package/esm/plugins/permissions/src/guilds/getPruneCount.js +1 -1
  58. package/esm/plugins/permissions/src/guilds/getVanityUrl.js +1 -1
  59. package/esm/plugins/permissions/src/guilds/getWelcomeScreen.js +2 -2
  60. package/esm/plugins/permissions/src/guilds/voice/connectToVoiceChannels.js +2 -2
  61. package/esm/plugins/permissions/src/guilds/widgets/editWidgetSettings.js +1 -1
  62. package/esm/plugins/permissions/src/integrations/deleteIntegrations.js +1 -1
  63. package/esm/plugins/permissions/src/integrations/getIntegrations.js +1 -1
  64. package/esm/plugins/permissions/src/members/banMember.js +1 -1
  65. package/esm/plugins/permissions/src/members/editBotMember.js +1 -1
  66. package/esm/plugins/permissions/src/members/editMember.js +4 -4
  67. package/esm/plugins/permissions/src/members/kickMember.js +1 -1
  68. package/esm/plugins/permissions/src/members/pruneMembers.js +1 -1
  69. package/esm/plugins/permissions/src/members/unbanMember.js +1 -1
  70. package/esm/plugins/permissions/src/messages/deleteMessage.js +2 -2
  71. package/esm/plugins/permissions/src/messages/deleteMessages.js +1 -1
  72. package/esm/plugins/permissions/src/messages/getMessage.js +1 -1
  73. package/esm/plugins/permissions/src/messages/getMessages.js +1 -1
  74. package/esm/plugins/permissions/src/messages/pinMessage.js +1 -1
  75. package/esm/plugins/permissions/src/messages/reactions/addReaction.js +1 -1
  76. package/esm/plugins/permissions/src/messages/reactions/addReactions.js +1 -1
  77. package/esm/plugins/permissions/src/messages/reactions/deleteReactionsAll.js +1 -1
  78. package/esm/plugins/permissions/src/messages/reactions/deleteReactionsEmoji.js +1 -1
  79. package/esm/plugins/permissions/src/messages/reactions/deleteUserReaction.ts.js +1 -1
  80. package/esm/plugins/permissions/src/messages/sendMessage.js +1 -1
  81. package/esm/plugins/permissions/src/messages/unpinMessage.js +1 -1
  82. package/esm/plugins/permissions/src/permissions.js +0 -20
  83. package/esm/plugins/permissions/src/roles/addRole.js +2 -2
  84. package/esm/plugins/permissions/src/roles/createRole.js +1 -1
  85. package/esm/plugins/permissions/src/roles/deleteRole.js +1 -1
  86. package/esm/plugins/permissions/src/roles/editRole.js +2 -2
  87. package/esm/plugins/permissions/src/roles/modifyRolePositions.js +1 -1
  88. package/esm/plugins/permissions/src/roles/removeRole.js +2 -2
  89. package/esm/plugins/permissions/src/stickers/createGuildSticker.js +8 -0
  90. package/esm/plugins/permissions/src/stickers/deleteGuildSticker.js +8 -0
  91. package/esm/plugins/permissions/src/stickers/editGuildSticker.js +8 -0
  92. package/esm/plugins/permissions/src/stickers/mod.js +8 -0
  93. package/esm/plugins/permissions/src/webhooks/createWebhook.js +1 -1
  94. package/esm/plugins/permissions/src/webhooks/deleteWebhook.js +1 -1
  95. package/esm/plugins/permissions/src/webhooks/editWebhook.js +6 -2
  96. package/esm/plugins/validations/mod.js +2 -0
  97. package/esm/plugins/validations/src/messages/deleteMessages.js +1 -1
  98. package/esm/plugins/validations/src/stickers/createGuildSticker.js +16 -0
  99. package/esm/plugins/validations/src/stickers/editGuildSticker.js +17 -0
  100. package/esm/plugins/validations/src/stickers/mod.js +6 -0
  101. package/esm/rest/createRequestBody.js +12 -4
  102. package/esm/rest/processGlobalQueue.js +4 -0
  103. package/esm/rest/runMethod.js +13 -1
  104. package/esm/rest/sendRequest.js +7 -0
  105. package/esm/transformers/component.js +2 -0
  106. package/esm/transformers/reverse/component.js +3 -0
  107. package/esm/transformers/toggles/guild.js +47 -20
  108. package/esm/types/shared.js +3 -5
  109. package/esm/util/constants.js +1 -1
  110. package/esm/util/routes.js +11 -2
  111. package/package.json +1 -1
  112. package/script/gateway/shard/connect.js +7 -3
  113. package/script/helpers/channels/mod.js +0 -1
  114. package/script/helpers/guilds/invites/createInvite.js +1 -0
  115. package/script/helpers/interactions/responses/editFollowupMessage.js +2 -1
  116. package/script/helpers/interactions/responses/editOriginalInteractionResponse.js +7 -4
  117. package/script/helpers/misc/getNitroStickerPacks.js +8 -1
  118. package/script/helpers/mod.js +1 -0
  119. package/script/helpers/stickers/createGuildSticker.js +29 -0
  120. package/script/helpers/stickers/deleteGuildSticker.js +22 -0
  121. package/script/helpers/stickers/editGuildSticker.js +26 -0
  122. package/script/helpers/stickers/getGuildSticker.js +20 -0
  123. package/script/helpers/stickers/getGuildStickers.js +23 -0
  124. package/script/helpers/stickers/getSticker.js +17 -0
  125. package/script/helpers/stickers/mod.js +22 -0
  126. package/script/helpers/webhooks/editOriginalWebhookMessage.js +7 -4
  127. package/script/helpers/webhooks/editWebhookMessage.js +7 -4
  128. package/script/helpers/{channels → webhooks}/getChannelWebhooks.js +0 -0
  129. package/script/helpers/webhooks/{getWebhooks.js → getGuildWebhooks.js} +3 -3
  130. package/script/helpers/webhooks/mod.js +2 -1
  131. package/script/plugins/permissions/mod.js +4 -2
  132. package/script/plugins/permissions/src/channels/createChannel.js +2 -2
  133. package/script/plugins/permissions/src/channels/deleteChannel.js +2 -2
  134. package/script/plugins/permissions/src/channels/deleteChannelPermissionOverride.js +2 -2
  135. package/script/plugins/permissions/src/channels/editChannel.js +2 -2
  136. package/script/plugins/permissions/src/channels/editChannelPermissionOverrides.js +2 -2
  137. package/script/plugins/permissions/src/channels/followAnnouncementChannel.js +4 -4
  138. package/script/plugins/permissions/src/channels/forums/createForumThread.js +2 -2
  139. package/script/plugins/permissions/src/channels/getChannelWebhooks.js +2 -2
  140. package/script/plugins/permissions/src/channels/stages/createStageInstance.js +2 -2
  141. package/script/plugins/permissions/src/channels/stages/deleteStageInstances.js +2 -2
  142. package/script/plugins/permissions/src/channels/stages/editStageInstance.js +2 -2
  143. package/script/plugins/permissions/src/channels/threads/addThreadMember.js +1 -1
  144. package/script/plugins/permissions/src/channels/threads/getPrivateArchivedThreads.js +6 -2
  145. package/script/plugins/permissions/src/channels/threads/getPrivateJoinedArchivedThreads.js +2 -2
  146. package/script/plugins/permissions/src/channels/threads/getPublicArchivedThreads.js +2 -2
  147. package/script/plugins/permissions/src/channels/threads/joinThread.js +2 -2
  148. package/script/plugins/permissions/src/channels/threads/leaveThread.js +2 -2
  149. package/script/plugins/permissions/src/channels/threads/removeThreadMember.js +1 -1
  150. package/script/plugins/permissions/src/emojis/createEmoji.js +1 -1
  151. package/script/plugins/permissions/src/emojis/deleteEmoji.js +1 -1
  152. package/script/plugins/permissions/src/emojis/editEmoji.js +1 -1
  153. package/script/plugins/permissions/src/guilds/automod/createAutomodRule.js +2 -2
  154. package/script/plugins/permissions/src/guilds/automod/deleteAutomodRule.js +1 -1
  155. package/script/plugins/permissions/src/guilds/automod/editAutomodRule.js +2 -2
  156. package/script/plugins/permissions/src/guilds/automod/getAutomodRule.js +1 -1
  157. package/script/plugins/permissions/src/guilds/automod/getAutomodRules.js +1 -1
  158. package/script/plugins/permissions/src/guilds/deleteGuild.js +1 -1
  159. package/script/plugins/permissions/src/guilds/editGuild.js +2 -2
  160. package/script/plugins/permissions/src/guilds/editGuildMfaLevel.js +1 -1
  161. package/script/plugins/permissions/src/guilds/editWelcomeScreen.js +1 -1
  162. package/script/plugins/permissions/src/guilds/events/createScheduledEvent.js +7 -7
  163. package/script/plugins/permissions/src/guilds/events/editScheduledEvent.js +7 -7
  164. package/script/plugins/permissions/src/guilds/getAuditLog.js +1 -1
  165. package/script/plugins/permissions/src/guilds/getBan.js +1 -1
  166. package/script/plugins/permissions/src/guilds/getBans.js +1 -1
  167. package/script/plugins/permissions/src/guilds/getPruneCount.js +1 -1
  168. package/script/plugins/permissions/src/guilds/getVanityUrl.js +1 -1
  169. package/script/plugins/permissions/src/guilds/getWelcomeScreen.js +2 -2
  170. package/script/plugins/permissions/src/guilds/voice/connectToVoiceChannels.js +2 -2
  171. package/script/plugins/permissions/src/guilds/widgets/editWidgetSettings.js +1 -1
  172. package/script/plugins/permissions/src/integrations/deleteIntegrations.js +1 -1
  173. package/script/plugins/permissions/src/integrations/getIntegrations.js +1 -1
  174. package/script/plugins/permissions/src/members/banMember.js +1 -1
  175. package/script/plugins/permissions/src/members/editBotMember.js +1 -1
  176. package/script/plugins/permissions/src/members/editMember.js +4 -4
  177. package/script/plugins/permissions/src/members/kickMember.js +1 -1
  178. package/script/plugins/permissions/src/members/pruneMembers.js +1 -1
  179. package/script/plugins/permissions/src/members/unbanMember.js +1 -1
  180. package/script/plugins/permissions/src/messages/deleteMessage.js +2 -2
  181. package/script/plugins/permissions/src/messages/deleteMessages.js +1 -1
  182. package/script/plugins/permissions/src/messages/getMessage.js +1 -1
  183. package/script/plugins/permissions/src/messages/getMessages.js +1 -1
  184. package/script/plugins/permissions/src/messages/pinMessage.js +1 -1
  185. package/script/plugins/permissions/src/messages/reactions/addReaction.js +1 -1
  186. package/script/plugins/permissions/src/messages/reactions/addReactions.js +1 -1
  187. package/script/plugins/permissions/src/messages/reactions/deleteReactionsAll.js +1 -1
  188. package/script/plugins/permissions/src/messages/reactions/deleteReactionsEmoji.js +1 -1
  189. package/script/plugins/permissions/src/messages/reactions/deleteUserReaction.ts.js +1 -1
  190. package/script/plugins/permissions/src/messages/sendMessage.js +1 -1
  191. package/script/plugins/permissions/src/messages/unpinMessage.js +1 -1
  192. package/script/plugins/permissions/src/permissions.js +1 -23
  193. package/script/plugins/permissions/src/roles/addRole.js +2 -2
  194. package/script/plugins/permissions/src/roles/createRole.js +1 -1
  195. package/script/plugins/permissions/src/roles/deleteRole.js +1 -1
  196. package/script/plugins/permissions/src/roles/editRole.js +2 -2
  197. package/script/plugins/permissions/src/roles/modifyRolePositions.js +1 -1
  198. package/script/plugins/permissions/src/roles/removeRole.js +2 -2
  199. package/script/plugins/permissions/src/stickers/createGuildSticker.js +12 -0
  200. package/script/plugins/permissions/src/stickers/deleteGuildSticker.js +12 -0
  201. package/script/plugins/permissions/src/stickers/editGuildSticker.js +12 -0
  202. package/script/plugins/permissions/src/stickers/mod.js +12 -0
  203. package/script/plugins/permissions/src/webhooks/createWebhook.js +1 -1
  204. package/script/plugins/permissions/src/webhooks/deleteWebhook.js +1 -1
  205. package/script/plugins/permissions/src/webhooks/editWebhook.js +6 -2
  206. package/script/plugins/validations/mod.js +4 -2
  207. package/script/plugins/validations/src/messages/deleteMessages.js +1 -1
  208. package/script/plugins/validations/src/stickers/createGuildSticker.js +20 -0
  209. package/script/plugins/validations/src/stickers/editGuildSticker.js +21 -0
  210. package/script/plugins/validations/src/stickers/mod.js +10 -0
  211. package/script/rest/createRequestBody.js +12 -4
  212. package/script/rest/processGlobalQueue.js +4 -0
  213. package/script/rest/runMethod.js +13 -1
  214. package/script/rest/sendRequest.js +7 -0
  215. package/script/transformers/component.js +2 -0
  216. package/script/transformers/reverse/component.js +3 -0
  217. package/script/transformers/toggles/guild.js +47 -20
  218. package/script/types/shared.js +3 -5
  219. package/script/util/constants.js +1 -1
  220. package/script/util/routes.js +11 -2
  221. package/types/bot.d.ts +25 -5
  222. package/types/helpers/channels/createChannel.d.ts +1 -1
  223. package/types/helpers/channels/mod.d.ts +0 -1
  224. package/types/helpers/misc/getNitroStickerPacks.d.ts +8 -1
  225. package/types/helpers/mod.d.ts +1 -0
  226. package/types/helpers/stickers/createGuildSticker.d.ts +29 -0
  227. package/types/helpers/stickers/deleteGuildSticker.d.ts +17 -0
  228. package/types/helpers/stickers/editGuildSticker.d.ts +26 -0
  229. package/types/helpers/stickers/getGuildSticker.d.ts +14 -0
  230. package/types/helpers/stickers/getGuildStickers.d.ts +14 -0
  231. package/types/helpers/stickers/getSticker.d.ts +12 -0
  232. package/types/helpers/stickers/mod.d.ts +6 -0
  233. package/types/helpers/{channels → webhooks}/getChannelWebhooks.d.ts +0 -0
  234. package/types/helpers/webhooks/{getWebhooks.d.ts → getGuildWebhooks.d.ts} +1 -1
  235. package/types/helpers/webhooks/mod.d.ts +2 -1
  236. package/types/plugins/cache/src/addCacheCollections.d.ts +2 -2
  237. package/types/plugins/permissions/src/permissions.d.ts +0 -4
  238. package/types/plugins/permissions/src/stickers/createGuildSticker.d.ts +2 -0
  239. package/types/plugins/permissions/src/stickers/deleteGuildSticker.d.ts +2 -0
  240. package/types/plugins/permissions/src/stickers/editGuildSticker.d.ts +2 -0
  241. package/types/plugins/permissions/src/stickers/mod.d.ts +2 -0
  242. package/types/plugins/validations/src/stickers/createGuildSticker.d.ts +2 -0
  243. package/types/plugins/validations/src/stickers/editGuildSticker.d.ts +2 -0
  244. package/types/plugins/validations/src/stickers/mod.d.ts +2 -0
  245. package/types/rest/createRequestBody.d.ts +1 -0
  246. package/types/rest/runMethod.d.ts +1 -1
  247. package/types/rest/sendRequest.d.ts +1 -0
  248. package/types/transformers/component.d.ts +6 -0
  249. package/types/transformers/interaction.d.ts +222 -48
  250. package/types/transformers/message.d.ts +3 -0
  251. package/types/transformers/toggles/guild.d.ts +8 -11
  252. package/types/types/discord.d.ts +10 -2
  253. package/types/types/shared.d.ts +4 -6
  254. package/types/util/constants.d.ts +1 -1
  255. package/types/util/routes.d.ts +3 -0
package/README.md CHANGED
@@ -6,88 +6,90 @@ Discord API library for [Deno](https://deno.land)
6
6
 
7
7
  Discordeno follows [semantic versioning](https://semver.org/)
8
8
 
9
- <!-- TODO: add coverage back when it is stable -->
10
-
11
9
  [![Discord](https://img.shields.io/discord/785384884197392384?color=7289da&logo=discord&logoColor=dark)](https://discord.com/invite/5vBgXk3UcZ)
12
10
  ![Test](https://github.com/discordeno/discordeno/workflows/Test/badge.svg)
13
11
  [![Coverage](https://img.shields.io/codecov/c/gh/discordeno/discordeno)](https://codecov.io/gh/discordeno/discordeno)
14
12
 
15
13
  ## Features
16
14
 
17
- - **Secure & stable**: Discordeno is actively maintained to ensure great performance and convenience.
18
- - **Simple, Efficient, & Lightweight**: Discordeno is simplistic, easy-to-use and versatile while being efficient and
19
- lightweight. No caching by default.
20
- - **Functional API**: The functional API ensures overall concise yet performant code while removing the difficulties of
21
- extending built-in classes and inheritance.
22
- - **Cross Runtime**: Supports both Deno and Node.js runtimes.
23
- - **Standalone REST, Gateway, Custom Cache & more**: Discordeno provides the ability to have almost every part of a bot
24
- as a standalone piece.
25
- - **Plugins:** Designed to let you plugin and override any part of the code. Never deal with the headaches of
26
- maintaining your fork just to get something customized for your needs. You can use plugins for almost anything, for
27
- example we have a few official plugins.
28
- - Cache plugin that enables caching everything.
29
- - Sweeper plugin that enables sweepers to clean the cache every once in a while.
30
- - Permission plugin checks internally all missing permissions before forwarding a request to the Discord API so that
31
- the client does not get globally banned by Discord.
32
- - **Flexibility:** If your bot does not need certain properties from objects then you can simply remove them. For
33
- example, if your bot does not need `Channel.topic` you should not have to store it. This can save you GBs of memory.
34
- Doing this for any property on any object is as simple as a few lines of code.
15
+ Discordeno is actively maintained to guarantee **excellent performance and ease.**
16
+
17
+ - **Simple, Efficient, and Lightweight**: Discordeno is lightweight, simple to use, and adaptable. By default, no
18
+ caching.
19
+ - **Functional API**: The functional API eliminates the challenges of extending built-in classes and inheritance while
20
+ ensuring overall simple but performant code.
21
+ - **Cross Runtime**: Supports the Node.js and Deno runtimes.
22
+ - **Standalone components**: Discordeno offers the option to have practically any component of a bot as a separate
23
+ piece, including standalone REST, gateways, custom caches, and more.
24
+ - **Plugins:** Designed to allow you to overwrite any portion of the code with your own code. Never go through the
25
+ hassle of maintaining your fork in order to acquire something that is specifically tailored to your requirements.
26
+ Plugins may be used for nearly anything; for instance, we have a few authorised plugins.
27
+ - A caching plugin that makes anything cacheable.
28
+ - A plugin for sweepers that allows them to periodically clear the cache.
29
+ - The permission plugin internally verifies any missing permissions before sending a call to the Discord API to
30
+ prevent the client from receiving a Discord global ban.
31
+
32
+ - **Flexibility:** You may easily delete an object's attributes if your bot doesn't require them. For instance, you
33
+ shouldn't be required to keep `Channel.topic` if your bot doesn't require it. You may save GBs of RAM in this way. A
34
+ few lines of code are all that are needed to accomplish this for any property on any object.
35
35
 
36
36
  ### REST
37
37
 
38
- - Freedom from Invalid Request 1 Hour Downtimes
39
- - Discordeno will protect your bot from going down for an hour and will instead decrease the maximum downtime to 10
40
- minutes.
41
- - Freedom from global rate limit errors
42
- - ✅ As your bot grows, you want to handle global rate limits better. Shards don't communicate fast enough to truly
38
+ - Freedom from 1 hour downtimes due to invalid requests
39
+ - By lowering the maximum downtime to 10 minutes, Discordeno will prevent your bot from being down for an hour.
40
+ - Freedom from global rate limit errors
41
+ - As your bot grows, you want to handle global rate limits better. Shards don't communicate fast enough to truly
43
42
  handle it properly so this allows 1 rest handler across the entire bot.
44
- - In fact, you can host multiple instances of your bot and all connect to the same rest server.
45
- - ✅ REST does not rest!
46
- - Separate rest means if your bot for whatever reason crashes, your requests that are queued will still keep going
47
- and will not be lost.
48
- - ✅ Seamless updates! When you want to update and reboot the bot, you could potentially lose tons of messages or
49
- responses that are in queue. Using this you could restart your bot without ever worrying about losing any responses.
50
- - Single source of contact to Discord API
51
- - This will allow you to make requests to discord from anywhere including a bot dashboard. You no longer need to
52
- have to communicate to your bot processes just to make a request or anything. Free up your bot process for
53
- processing bot events.
54
- - Scalability! Scalability! Scalability!
43
+ - You may really run numerous instances of your bot on different hosts, all of which will connect to the same REST
44
+ server.
45
+ - REST does not rest!
46
+ - Separate rest guarantees that your queued requests will continue to be processed even if your bot breaks for
47
+ whatever reason.
48
+ - Seamless updates! There's a chance you'll lose a lot of messages or replies that are waiting to be given when you
49
+ wish to update and restart the bot. You may restart your bot using this technique and never have to worry about
50
+ losing any answers.
51
+ - Single source of contact to Discord API
52
+ - As a result, you will be able to send requests to Discord from any location, even a bot dashboard. You are no longer
53
+ need to interact with your bot processes in order to submit a request or do anything else. Your bot process should
54
+ be freed up to handle bot events.
55
+ - Scalability! Scalability! Scalability!
55
56
 
56
57
  ### Gateway
57
58
 
58
- - **Zero Downtime Updates:**
59
- - Your bot can be updated in a matter of seconds. With normal sharding, you have to restart which also has to
60
- process identifying all your shards with a 1/~5s rate limit. With WS handling moved to a proxy process, this allows
61
- you to instantly get the bot code restarted without any concerns of delays. If you have a bot on 200,000 servers
62
- normally this would mean a 20 minute delay to restart your bot if you made a small change and restarted.
63
- - **Zero Downtime Resharding:**
64
- - Discord stops letting your bot get added to new servers at certain points in time. For example, suppose you had
65
- 150,000 servers running 150 shards. The maximum amount of servers your shards could hold is 150 \* 2500 = 375,000.
66
- If your bot reaches this, it can no longer join new servers until it re-shards.
67
- - DD proxy provides 2 types of re-sharding. Automated and manual. You can also have both.
68
- - Automated: This system will automatically begin a Zero-downtime resharding process behind the scenes when you
59
+ - **Zero Downtime Updates:**
60
+ - A few seconds are needed to update your bot. When using conventional sharding, you must restart in addition to going
61
+ through a 1/5s rate-limited process of identifying all of your shards. As WS processing has been relocated to a
62
+ proxy process, you may resume the bot code right away without worrying about any delays. Normally, if you had a bot
63
+ that was spread across 200,000 servers, restarting it after making a simple modification would take 20 minutes.
64
+ - **Zero Downtime Resharding:**
65
+ - At various periods in time, Discord stops allowing your bot to be added to new servers. Consider 150 shards
66
+ operating on 150,000 servers, for instance. Your shards may support a maximum of 150 * 2500 = 375,000 servers. Your
67
+ bot will be unable to join new servers once it reaches this point until it re-shards.
68
+ - DD proxy provides 2 types of re-sharding. Automated and manual. You can also have both.
69
+ - Automated: This system will automatically begin a Zero-downtime resharding process behind the scenes when you
69
70
  reach 80% of your maximum servers allowed by your shards. For example, since 375,000 was the max, at 300,000 we
70
71
  would begin re-sharding behind the scenes with ZERO DOWNTIME.
71
- - 80% of maximum servers reached (The % of 80% is customizable.)
72
- - Identify limits have room to allow re-sharding. (Also customizable)
73
- - Manual: You can also trigger this manually should you choose.
74
- - **Horizontal Scaling:**
75
- - The proxy system allows you to scale the bot horizontally. When you reach a huge size, you can either keep
76
- spending more money to keep beefing up your server or you can buy several cheaper servers and scale horizontally.
77
- The proxy means you can have WS handling on a completely separate system.
78
- - **No Loss Restarts:**
79
- - When you restart a bot without the proxy system, normally you would lose many events. Users may be using commands
80
- or messages are sent that will not be filtered. As your bot's grow this number rises dramatically. Users may join
81
- who wont get the auto-roles or any other actions your bot should take. With the proxy system, you can keep
82
- restarting your bot and never lose any events. Events will be put into a queue while your bot is down(max size of
83
- queue is customizable), once the bot is available the queue will begin processing all events.
84
- - **Controllers:**
85
- - ✅ The controller aspect gives you full control over everything inside the proxy. You can provide a function to
86
- simply override the handler. For example, if you would like a certain function to do something different, instead of
87
- having to fork and maintain your fork, you can just provide a function to override.
88
- - **Clustering With Workers:**
89
- - Take full advantage of all your CPU cores by using workers to spread the load. Control how many shards per worker
90
- and how many workers to maximize efficiency!
72
+ - 80% of maximum servers reached (The % of 80% is customizable.)
73
+ - Identify limits have room to allow re-sharding. (Also customizable)
74
+ - Manual: You can also trigger this manually should you choose.
75
+ - **Horizontal Scaling:**
76
+ - The bot may be scaled horizontally thanks to the proxy mechanism. When your business grows significantly, you have
77
+ two options: you can either keep investing money to upgrade your server or you may expand horizontally by purchasing
78
+ numerous more affordable servers. The proxy enables WS handling on a totally other system.
79
+ - **No Loss Restarts:**
80
+ - Without the proxy mechanism, you would typically lose numerous events while restarting a bot. Users could issue
81
+ instructions or send messages that are not screened. As your bot population increases, this amount grows sharply.
82
+ Users who don't receive the automatic roles or any other activities your bot should do may join. You may keep
83
+ restarting your bot thanks to the proxy technology without ever losing any events. While your bot is unavailable,
84
+ events will be added to a queue (the maximum size of the queue is configurable), and once the bot is back online,
85
+ the queue will start processing all of the events.
86
+ - **Controllers:**
87
+ - You have complete control over everything inside the proxy thanks to the controller aspect. To simply override the
88
+ handler, you may supply a function. For instance, you may simply give a method to override a specific function if
89
+ you want it to behave differently rather than forking and maintaining your fork.
90
+ - **Clustering With Workers:**
91
+ - Utilize all of your CPU cores to their greatest potential by distributing the workload across employees. To enhance
92
+ efficiency, manage how many employees and shards there are each worker!
91
93
 
92
94
  ### Custom Cache
93
95
 
@@ -122,8 +124,8 @@ await startBot(bot);
122
124
 
123
125
  ### Tools
124
126
 
125
- If you are a beginner, this library is not meant for you but you can check out if you still want to use this lib with
126
- these awesome official and unofficial templates:
127
+ This library is not intended for beginners, however if you still want to utilise it, check out these excellent official
128
+ and unofficial templates:
127
129
 
128
130
  **Templates**
129
131
 
@@ -134,6 +136,7 @@ these awesome official and unofficial templates:
134
136
 
135
137
  **Frameworks**
136
138
 
139
+ - [Amethyst Framework](https://github.com/AmethystFramework/framework)
137
140
  - [Add Your Own!](https://github.com/discordeno/discordeno/pulls)
138
141
 
139
142
  **Plugins**
@@ -7,10 +7,14 @@ export async function connect(shard) {
7
7
  shard.state = ShardState.Connecting;
8
8
  }
9
9
  shard.events.connecting?.(shard);
10
- let url = shard.gatewayConfig.url;
10
+ let url = new URL(shard.gatewayConfig.url);
11
11
  // If not connecting to a proxy but directly to discord need to handle resuming
12
- if (url === "wss://gateway.discord.gg") {
13
- url = `${shard.state === ShardState.Resuming ? shard.resumeGatewayUrl : shard.gatewayConfig.url}/?v=${shard.gatewayConfig.version}&encoding=json`;
12
+ if (url.origin === "wss://gateway.discord.gg") {
13
+ if (shard.state === ShardState.Resuming) {
14
+ url = new URL(shard.resumeGatewayUrl);
15
+ }
16
+ url.searchParams.set("v", shard.gatewayConfig.version.toString());
17
+ url.searchParams.set("encoding", "json");
14
18
  }
15
19
  const socket = new dntShim.WebSocket(url);
16
20
  shard.socket = socket;
@@ -10,6 +10,5 @@ export * from "./editChannelPermissionOverrides.js";
10
10
  export * from "./getChannel.js";
11
11
  export * from "./getChannelInvites.js";
12
12
  export * from "./getChannels.js";
13
- export * from "./getChannelWebhooks.js";
14
13
  export * from "./triggerTypingIndicator.js";
15
14
  export * from "./editChannelPositions.js";
@@ -25,6 +25,7 @@ export async function createInvite(bot, channelId, options = {}) {
25
25
  target_type: options.targetType,
26
26
  target_user_id: options.targetUserId?.toString(),
27
27
  target_application_id: options.targetApplicationId?.toString(),
28
+ reason: options.reason,
28
29
  });
29
30
  return {
30
31
  code: result.code,
@@ -19,11 +19,12 @@ import { InteractionResponseTypes } from "../../../types/shared.js";
19
19
  */
20
20
  export async function editFollowupMessage(bot, token, messageId, options) {
21
21
  const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.WEBHOOK_MESSAGE(bot.applicationId, token, messageId), {
22
- messageId,
22
+ messageId: messageId.toString(),
23
23
  ...bot.transformers.reverse.interactionResponse(bot, {
24
24
  type: InteractionResponseTypes.UpdateMessage,
25
25
  data: options,
26
26
  }).data,
27
+ file: options.file,
27
28
  });
28
29
  return bot.transformers.message(bot, result);
29
30
  }
@@ -17,9 +17,12 @@ import { InteractionResponseTypes } from "../../../types/mod.js";
17
17
  * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response}
18
18
  */
19
19
  export async function editOriginalInteractionResponse(bot, token, options) {
20
- const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token), bot.transformers.reverse.interactionResponse(bot, {
21
- type: InteractionResponseTypes.UpdateMessage,
22
- data: options,
23
- }).data);
20
+ const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token), {
21
+ ...bot.transformers.reverse.interactionResponse(bot, {
22
+ type: InteractionResponseTypes.UpdateMessage,
23
+ data: options,
24
+ }).data,
25
+ file: options.file,
26
+ });
24
27
  return bot.transformers.message(bot, result);
25
28
  }
@@ -1,5 +1,12 @@
1
1
  import { Collection } from "../../util/collection.js";
2
- /** Returns the list of sticker packs available to Nitro subscribers. */
2
+ /**
3
+ * Returns the list of sticker packs available to Nitro subscribers.
4
+ *
5
+ * @param bot The bot instance to use to make the request.
6
+ * @returns A collection of {@link StickerPack} objects assorted by sticker ID.
7
+ *
8
+ * @see {@link https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs}
9
+ */
3
10
  export async function getNitroStickerPacks(bot) {
4
11
  const results = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.NITRO_STICKER_PACKS());
5
12
  return new Collection(results.map((result) => {
@@ -6,5 +6,6 @@ export * from "./members/mod.js";
6
6
  export * from "./messages/mod.js";
7
7
  export * from "./misc/mod.js";
8
8
  export * from "./roles/mod.js";
9
+ export * from "./stickers/mod.js";
9
10
  export * from "./templates/mod.js";
10
11
  export * from "./webhooks/mod.js";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Create a new sticker for the guild.
3
+ *
4
+ * @param bot The bot instance to use to make the request.
5
+ * @param guildId The ID of the guild to get
6
+ * @return A {@link Sticker}
7
+ *
8
+ * @remarks
9
+ * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission.
10
+ * Fires a Guild Stickers Update Gateway event.
11
+ * Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
12
+ * Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
13
+ *
14
+ * @see {@link https://discord.com/developers/docs/resources/sticker#create-guild-sticker}
15
+ */
16
+ export async function createGuildSticker(bot, guildId, options) {
17
+ const result = await bot.rest.runMethod(bot.rest, "POST", bot.constants.routes.GUILD_STICKERS(guildId), {
18
+ name: options.name,
19
+ description: options.description,
20
+ tags: options.tags,
21
+ file: options.file,
22
+ reason: options.reason,
23
+ });
24
+ return bot.transformers.sticker(bot, result);
25
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Delete a new sticker for the guild.
3
+ *
4
+ * @param bot The bot instance to use to make the request.
5
+ * @param guildId The ID of the guild to get
6
+ * @return A {@link Sticker}
7
+ *
8
+ * @remarks
9
+ * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission.
10
+ * Fires a Guild Stickers Update Gateway event.
11
+ * Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
12
+ * Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
13
+ *
14
+ * @see {@link https://discord.com/developers/docs/resources/sticker#delete-guild-sticker}
15
+ */
16
+ export async function deleteGuildSticker(bot, guildId, stickerId, reason) {
17
+ return await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.GUILD_STICKER(guildId, stickerId), reason ? { reason } : undefined);
18
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Edit the given sticker.
3
+ *
4
+ * @param bot The bot instance to use to make the request.
5
+ * @param guildId The ID of the guild to get
6
+ * @return A {@link Sticker}
7
+ *
8
+ * @remarks
9
+ * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission.
10
+ * Fires a Guild Stickers Update Gateway event.
11
+ *
12
+ * @see {@link https://discord.com/developers/docs/resources/sticker#modify-guild-sticker}
13
+ */
14
+ export async function editGuildSticker(bot, guildId, stickerId, options) {
15
+ const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.GUILD_STICKER(guildId, stickerId), {
16
+ name: options.name,
17
+ description: options.description,
18
+ tags: options.tags,
19
+ reason: options.reason,
20
+ });
21
+ return bot.transformers.sticker(bot, result);
22
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Returns a sticker object for the given guild and sticker IDs.
3
+ *
4
+ * @param bot The bot instance to use to make the request.
5
+ * @param guildId The ID of the guild to get
6
+ * @param stickerId The ID of the sticker to get
7
+ * @return A {@link Sticker}
8
+ *
9
+ * @remarks Includes the user field if the bot has the `MANAGE_EMOJIS_AND_STICKERS` permission.
10
+ *
11
+ * @see {@link https://discord.com/developers/docs/resources/sticker#get-guild-sticker}
12
+ */
13
+ export async function getGuildSticker(bot, guildId, stickerId) {
14
+ const result = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.GUILD_STICKER(guildId, stickerId));
15
+ return bot.transformers.sticker(bot, result);
16
+ }
@@ -0,0 +1,19 @@
1
+ import { Collection } from "../../mod.js";
2
+ /**
3
+ * Returns an array of sticker objects for the given guild.
4
+ *
5
+ * @param bot The bot instance to use to make the request.
6
+ * @param guildId The ID of the guild to get
7
+ * @returns A collection of {@link Sticker} objects assorted by sticker ID.
8
+ *
9
+ * @remarks Includes user fields if the bot has the `MANAGE_EMOJIS_AND_STICKERS` permission.
10
+ *
11
+ * @see {@link https://discord.com/developers/docs/resources/sticker#list-guild-stickers}
12
+ */
13
+ export async function getGuildStickers(bot, guildId) {
14
+ const results = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.GUILD_STICKERS(guildId));
15
+ return new Collection(results.map((result) => {
16
+ const pack = bot.transformers.sticker(bot, result);
17
+ return [pack.id, pack];
18
+ }));
19
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Returns a sticker object for the given sticker ID.
3
+ *
4
+ * @param bot The bot instance to use to make the request.
5
+ * @param stickerId The ID of the sticker to get
6
+ * @returns A {@link Sticker}
7
+ *
8
+ * @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker}
9
+ */
10
+ export async function getSticker(bot, stickerId) {
11
+ const result = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.STICKER(stickerId));
12
+ return bot.transformers.sticker(bot, result);
13
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./createGuildSticker.js";
2
+ export * from "./deleteGuildSticker.js";
3
+ export * from "./editGuildSticker.js";
4
+ export * from "./getGuildSticker.js";
5
+ export * from "./getGuildStickers.js";
6
+ export * from "./getSticker.js";
@@ -14,9 +14,12 @@ import { InteractionResponseTypes } from "../../types/mod.js";
14
14
  * @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}
15
15
  */
16
16
  export async function editOriginalWebhookMessage(bot, webhookId, token, options) {
17
- const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.WEBHOOK_MESSAGE_ORIGINAL(webhookId, token, options), bot.transformers.reverse.interactionResponse(bot, {
18
- type: InteractionResponseTypes.UpdateMessage,
19
- data: options,
20
- }).data);
17
+ const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.WEBHOOK_MESSAGE_ORIGINAL(webhookId, token, options), {
18
+ ...bot.transformers.reverse.interactionResponse(bot, {
19
+ type: InteractionResponseTypes.UpdateMessage,
20
+ data: options,
21
+ }).data,
22
+ file: options.file,
23
+ });
21
24
  return bot.transformers.message(bot, result);
22
25
  }
@@ -15,9 +15,12 @@ import { InteractionResponseTypes } from "../../types/shared.js";
15
15
  * @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}
16
16
  */
17
17
  export async function editWebhookMessage(bot, webhookId, token, messageId, options) {
18
- const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.WEBHOOK_MESSAGE(webhookId, token, messageId, options), bot.transformers.reverse.interactionResponse(bot, {
19
- type: InteractionResponseTypes.UpdateMessage,
20
- data: options,
21
- }).data);
18
+ const result = await bot.rest.runMethod(bot.rest, "PATCH", bot.constants.routes.WEBHOOK_MESSAGE(webhookId, token, messageId, options), {
19
+ ...bot.transformers.reverse.interactionResponse(bot, {
20
+ type: InteractionResponseTypes.UpdateMessage,
21
+ data: options,
22
+ }).data,
23
+ file: options.file,
24
+ });
22
25
  return bot.transformers.message(bot, result);
23
26
  }
@@ -11,7 +11,7 @@ import { Collection } from "../../util/collection.js";
11
11
  *
12
12
  * @see {@link https://discord.com/developers/docs/resources/webhook#get-guild-webhooks}
13
13
  */
14
- export async function getWebhooks(bot, guildId) {
14
+ export async function getGuildWebhooks(bot, guildId) {
15
15
  const results = await bot.rest.runMethod(bot.rest, "GET", bot.constants.routes.GUILD_WEBHOOKS(guildId));
16
16
  return new Collection(results.map((result) => {
17
17
  const webhook = bot.transformers.webhook(bot, result);
@@ -7,7 +7,8 @@ export * from "./editWebhook.js";
7
7
  export * from "./editWebhookMessage.js";
8
8
  export * from "./editWebhookWithToken.js";
9
9
  export * from "./executeWebhook.js";
10
+ export * from "./getChannelWebhooks.js";
11
+ export * from "./getGuildWebhooks.js";
10
12
  export * from "./getWebhook.js";
11
13
  export * from "./getWebhookMessage.js";
12
- export * from "./getWebhooks.js";
13
14
  export * from "./getWebhookWithToken.js";
@@ -6,6 +6,7 @@ import { integrations } from "./src/integrations/mod.js";
6
6
  import { members } from "./src/members/mod.js";
7
7
  import { messages } from "./src/messages/mod.js";
8
8
  import { roles } from "./src/roles/mod.js";
9
+ import { stickers } from "./src/stickers/mod.js";
9
10
  import { webhooks } from "./src/webhooks/mod.js";
10
11
  // PLUGINS MUST TAKE A BOT ARGUMENT WHICH WILL BE MODIFIED
11
12
  export function enablePermissionsPlugin(bot) {
@@ -22,6 +23,7 @@ export function enablePermissionsPlugin(bot) {
22
23
  members(bot);
23
24
  messages(bot);
24
25
  roles(bot);
26
+ stickers(bot);
25
27
  webhooks(bot);
26
28
  // PLUGINS MUST RETURN THE BOT
27
29
  return bot;
@@ -3,7 +3,7 @@ import { requireBotGuildPermissions } from "../permissions.js";
3
3
  export function createChannel(bot) {
4
4
  const createChannel = bot.helpers.createChannel;
5
5
  bot.helpers.createChannel = async function (guildId, options) {
6
- const guild = bot.guilds.get(guildId);
6
+ const guild = bot.guilds.get(bot.transformers.snowflake(guildId));
7
7
  if (guild) {
8
8
  if (options?.rateLimitPerUser && !(0 < options.rateLimitPerUser && options.rateLimitPerUser < 21600)) {
9
9
  throw new Error("Amount of seconds a user has to wait before sending another message must be between 0-21600");
@@ -27,7 +27,7 @@ export function createChannel(bot) {
27
27
  if (options?.userLimit && options.userLimit > 99)
28
28
  throw new Error("The user limit must be less than 99.");
29
29
  if (options?.parentId) {
30
- const category = bot.channels.get(options.parentId);
30
+ const category = bot.channels.get(bot.transformers.snowflake(options.parentId));
31
31
  if (category && category.type !== ChannelTypes.GuildCategory) {
32
32
  throw new Error("The parent id must be for a category channel type.");
33
33
  }
@@ -3,7 +3,7 @@ import { requireBotChannelPermissions } from "../permissions.js";
3
3
  export function deleteChannel(bot) {
4
4
  const deleteChannel = bot.helpers.deleteChannel;
5
5
  bot.helpers.deleteChannel = async function (channelId, reason) {
6
- const channel = bot.channels.get(channelId);
6
+ const channel = bot.channels.get(bot.transformers.snowflake(channelId));
7
7
  if (channel?.guildId) {
8
8
  const guild = bot.guilds.get(channel.guildId);
9
9
  if (!guild)
@@ -22,7 +22,7 @@ export function deleteChannel(bot) {
22
22
  perms.push("MANAGE_CHANNELS");
23
23
  if (isVoice)
24
24
  perms.push("CONNECT");
25
- requireBotChannelPermissions(bot, channelId, perms);
25
+ requireBotChannelPermissions(bot, bot.transformers.snowflake(channelId), perms);
26
26
  }
27
27
  return await deleteChannel(channelId, reason);
28
28
  };
@@ -3,13 +3,13 @@ import { requireBotChannelPermissions } from "../permissions.js";
3
3
  export function deleteChannelPermissionOverride(bot) {
4
4
  const deleteChannelPermissionOverride = bot.helpers.deleteChannelPermissionOverride;
5
5
  bot.helpers.deleteChannelPermissionOverride = async function (channelId, overwriteId) {
6
- const channel = bot.channels.get(channelId);
6
+ const channel = bot.channels.get(bot.transformers.snowflake(channelId));
7
7
  if (channel?.guildId) {
8
8
  const perms = ["VIEW_CHANNEL", "MANAGE_ROLES"];
9
9
  const isVoice = [ChannelTypes.GuildVoice, ChannelTypes.GuildStageVoice].includes(channel.type);
10
10
  if (isVoice)
11
11
  perms.push("CONNECT");
12
- requireBotChannelPermissions(bot, channelId, perms);
12
+ requireBotChannelPermissions(bot, bot.transformers.snowflake(channelId), perms);
13
13
  }
14
14
  return await deleteChannelPermissionOverride(channelId, overwriteId);
15
15
  };
@@ -3,7 +3,7 @@ import { requireBotChannelPermissions } from "../permissions.js";
3
3
  export function editChannel(bot) {
4
4
  const editChannel = bot.helpers.editChannel;
5
5
  bot.helpers.editChannel = async function (channelId, options) {
6
- const channel = bot.channels.get(channelId);
6
+ const channel = bot.channels.get(bot.transformers.snowflake(channelId));
7
7
  if (channel?.guildId) {
8
8
  const guild = bot.guilds.get(channel.guildId);
9
9
  if (options.rateLimitPerUser && options.rateLimitPerUser > 21600) {
@@ -55,7 +55,7 @@ export function editChannel(bot) {
55
55
  if (options.userLimit && options.userLimit > 99)
56
56
  throw new Error("The user limit must be less than 99.");
57
57
  if (options.parentId) {
58
- const category = bot.channels.get(options.parentId);
58
+ const category = bot.channels.get(bot.transformers.snowflake(options.parentId));
59
59
  if (category && category.type !== ChannelTypes.GuildCategory) {
60
60
  throw new Error("The parent id must be for a category channel type.");
61
61
  }
@@ -3,13 +3,13 @@ import { requireBotChannelPermissions } from "../permissions.js";
3
3
  export function editChannelPermissionOverrides(bot) {
4
4
  const editChannelPermissionOverrides = bot.helpers.editChannelPermissionOverrides;
5
5
  bot.helpers.editChannelPermissionOverrides = async function (channelId, overwrite) {
6
- const channel = bot.channels.get(channelId);
6
+ const channel = bot.channels.get(bot.transformers.snowflake(channelId));
7
7
  if (channel?.guildId) {
8
8
  const perms = ["VIEW_CHANNEL", "MANAGE_ROLES"];
9
9
  const isVoice = [ChannelTypes.GuildVoice, ChannelTypes.GuildStageVoice].includes(channel.type);
10
10
  if (isVoice)
11
11
  perms.push("CONNECT");
12
- requireBotChannelPermissions(bot, channelId, perms);
12
+ requireBotChannelPermissions(bot, bot.transformers.snowflake(channelId), perms);
13
13
  }
14
14
  return await editChannelPermissionOverrides(channelId, overwrite);
15
15
  };
@@ -3,19 +3,19 @@ import { requireBotChannelPermissions } from "../permissions.js";
3
3
  export function followAnnouncementChannel(bot) {
4
4
  const followAnnouncementChannel = bot.helpers.followAnnouncementChannel;
5
5
  bot.helpers.followAnnouncementChannel = async function (sourceChannelId, targetChannelId) {
6
- const sourceChannel = bot.channels.get(sourceChannelId);
6
+ const sourceChannel = bot.channels.get(bot.transformers.snowflake(sourceChannelId));
7
7
  if (sourceChannel && sourceChannel.type !== ChannelTypes.GuildAnnouncement) {
8
8
  throw new Error("Source channel must be an announcement channel");
9
9
  }
10
- const targetChannel = bot.channels.get(targetChannelId);
10
+ const targetChannel = bot.channels.get(bot.transformers.snowflake(targetChannelId));
11
11
  if (targetChannel) {
12
12
  const isWebhookParent = [ChannelTypes.GuildAnnouncement, ChannelTypes.GuildText].includes(targetChannel.type);
13
13
  if (!isWebhookParent) {
14
14
  throw new Error("Target channel must be a text channel or an announcement channel");
15
15
  }
16
16
  }
17
- requireBotChannelPermissions(bot, sourceChannelId, ["VIEW_CHANNEL"]);
18
- requireBotChannelPermissions(bot, targetChannelId, ["VIEW_CHANNEL", "MANAGE_WEBHOOKS"]);
17
+ requireBotChannelPermissions(bot, bot.transformers.snowflake(sourceChannelId), ["VIEW_CHANNEL"]);
18
+ requireBotChannelPermissions(bot, bot.transformers.snowflake(targetChannelId), ["VIEW_CHANNEL", "MANAGE_WEBHOOKS"]);
19
19
  return await followAnnouncementChannel(sourceChannelId, targetChannelId);
20
20
  };
21
21
  }