@ovencord/discord.js 14.16.3

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 (332) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +148 -0
  3. package/package.json +73 -0
  4. package/src/client/Client.ts +967 -0
  5. package/src/client/actions/Action.ts +141 -0
  6. package/src/client/actions/ActionsManager.ts +138 -0
  7. package/src/client/actions/ChannelCreate.ts +21 -0
  8. package/src/client/actions/ChannelDelete.ts +20 -0
  9. package/src/client/actions/ChannelUpdate.ts +38 -0
  10. package/src/client/actions/GuildChannelsPositionUpdate.ts +17 -0
  11. package/src/client/actions/GuildEmojiCreate.ts +17 -0
  12. package/src/client/actions/GuildEmojiDelete.ts +16 -0
  13. package/src/client/actions/GuildEmojiUpdate.ts +17 -0
  14. package/src/client/actions/GuildEmojisUpdate.ts +30 -0
  15. package/src/client/actions/GuildMemberRemove.ts +29 -0
  16. package/src/client/actions/GuildMemberUpdate.ts +41 -0
  17. package/src/client/actions/GuildRoleCreate.ts +23 -0
  18. package/src/client/actions/GuildRoleDelete.ts +26 -0
  19. package/src/client/actions/GuildRolesPositionUpdate.ts +17 -0
  20. package/src/client/actions/GuildScheduledEventDelete.ts +28 -0
  21. package/src/client/actions/GuildScheduledEventUserAdd.ts +29 -0
  22. package/src/client/actions/GuildScheduledEventUserRemove.ts +29 -0
  23. package/src/client/actions/GuildSoundboardSoundDelete.ts +26 -0
  24. package/src/client/actions/GuildStickerCreate.ts +17 -0
  25. package/src/client/actions/GuildStickerDelete.ts +16 -0
  26. package/src/client/actions/GuildStickerUpdate.ts +17 -0
  27. package/src/client/actions/GuildStickersUpdate.ts +30 -0
  28. package/src/client/actions/GuildUpdate.ts +30 -0
  29. package/src/client/actions/InteractionCreate.ts +104 -0
  30. package/src/client/actions/MessageCreate.ts +38 -0
  31. package/src/client/actions/MessageDelete.ts +29 -0
  32. package/src/client/actions/MessageDeleteBulk.ts +45 -0
  33. package/src/client/actions/MessagePollVoteAdd.ts +37 -0
  34. package/src/client/actions/MessagePollVoteRemove.ts +35 -0
  35. package/src/client/actions/MessageReactionAdd.ts +68 -0
  36. package/src/client/actions/MessageReactionRemove.ts +47 -0
  37. package/src/client/actions/MessageReactionRemoveAll.ts +30 -0
  38. package/src/client/actions/MessageReactionRemoveEmoji.ts +25 -0
  39. package/src/client/actions/MessageUpdate.ts +22 -0
  40. package/src/client/actions/StageInstanceCreate.ts +25 -0
  41. package/src/client/actions/StageInstanceDelete.ts +28 -0
  42. package/src/client/actions/StageInstanceUpdate.ts +27 -0
  43. package/src/client/actions/ThreadCreate.ts +22 -0
  44. package/src/client/actions/ThreadMembersUpdate.ts +45 -0
  45. package/src/client/actions/TypingStart.ts +26 -0
  46. package/src/client/actions/UserUpdate.ts +33 -0
  47. package/src/client/voice/ClientVoiceManager.ts +46 -0
  48. package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.ts +19 -0
  49. package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.ts +17 -0
  50. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.ts +18 -0
  51. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.ts +21 -0
  52. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.ts +20 -0
  53. package/src/client/websocket/handlers/CHANNEL_CREATE.ts +4 -0
  54. package/src/client/websocket/handlers/CHANNEL_DELETE.ts +4 -0
  55. package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.ts +22 -0
  56. package/src/client/websocket/handlers/CHANNEL_UPDATE.ts +16 -0
  57. package/src/client/websocket/handlers/ENTITLEMENT_CREATE.ts +14 -0
  58. package/src/client/websocket/handlers/ENTITLEMENT_DELETE.ts +18 -0
  59. package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.ts +16 -0
  60. package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.ts +19 -0
  61. package/src/client/websocket/handlers/GUILD_BAN_ADD.ts +15 -0
  62. package/src/client/websocket/handlers/GUILD_BAN_REMOVE.ts +20 -0
  63. package/src/client/websocket/handlers/GUILD_CREATE.ts +34 -0
  64. package/src/client/websocket/handlers/GUILD_DELETE.ts +36 -0
  65. package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.ts +4 -0
  66. package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.ts +15 -0
  67. package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.ts +40 -0
  68. package/src/client/websocket/handlers/GUILD_MEMBER_ADD.ts +17 -0
  69. package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.ts +4 -0
  70. package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.ts +4 -0
  71. package/src/client/websocket/handlers/GUILD_ROLE_CREATE.ts +4 -0
  72. package/src/client/websocket/handlers/GUILD_ROLE_DELETE.ts +4 -0
  73. package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.ts +21 -0
  74. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.ts +17 -0
  75. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.ts +4 -0
  76. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.ts +19 -0
  77. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.ts +4 -0
  78. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts +4 -0
  79. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.ts +24 -0
  80. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.ts +18 -0
  81. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.ts +4 -0
  82. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.ts +20 -0
  83. package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.ts +4 -0
  84. package/src/client/websocket/handlers/GUILD_UPDATE.ts +4 -0
  85. package/src/client/websocket/handlers/INTERACTION_CREATE.ts +4 -0
  86. package/src/client/websocket/handlers/INVITE_CREATE.ts +20 -0
  87. package/src/client/websocket/handlers/INVITE_DELETE.ts +23 -0
  88. package/src/client/websocket/handlers/MESSAGE_CREATE.ts +4 -0
  89. package/src/client/websocket/handlers/MESSAGE_DELETE.ts +4 -0
  90. package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.ts +4 -0
  91. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.ts +4 -0
  92. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.ts +4 -0
  93. package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.ts +4 -0
  94. package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.ts +4 -0
  95. package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.ts +4 -0
  96. package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.ts +4 -0
  97. package/src/client/websocket/handlers/MESSAGE_UPDATE.ts +16 -0
  98. package/src/client/websocket/handlers/PRESENCE_UPDATE.ts +42 -0
  99. package/src/client/websocket/handlers/RATE_LIMITED.ts +23 -0
  100. package/src/client/websocket/handlers/READY.ts +29 -0
  101. package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.ts +24 -0
  102. package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.ts +4 -0
  103. package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.ts +4 -0
  104. package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.ts +4 -0
  105. package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.ts +14 -0
  106. package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.ts +16 -0
  107. package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.ts +16 -0
  108. package/src/client/websocket/handlers/THREAD_CREATE.ts +4 -0
  109. package/src/client/websocket/handlers/THREAD_DELETE.ts +17 -0
  110. package/src/client/websocket/handlers/THREAD_LIST_SYNC.ts +50 -0
  111. package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.ts +4 -0
  112. package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.ts +25 -0
  113. package/src/client/websocket/handlers/THREAD_UPDATE.ts +16 -0
  114. package/src/client/websocket/handlers/TYPING_START.ts +4 -0
  115. package/src/client/websocket/handlers/USER_UPDATE.ts +4 -0
  116. package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.ts +16 -0
  117. package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.ts +5 -0
  118. package/src/client/websocket/handlers/VOICE_STATE_UPDATE.ts +37 -0
  119. package/src/client/websocket/handlers/WEBHOOKS_UPDATE.ts +16 -0
  120. package/src/client/websocket/handlers/index.ts +74 -0
  121. package/src/errors/DJSError.ts +50 -0
  122. package/src/errors/ErrorCodes.ts +277 -0
  123. package/src/errors/Messages.ts +155 -0
  124. package/src/errors/index.ts +6 -0
  125. package/src/index.ts +241 -0
  126. package/src/managers/ApplicationCommandManager.ts +303 -0
  127. package/src/managers/ApplicationCommandPermissionsManager.ts +453 -0
  128. package/src/managers/ApplicationEmojiManager.ts +149 -0
  129. package/src/managers/AutoModerationRuleManager.ts +307 -0
  130. package/src/managers/BaseManager.ts +13 -0
  131. package/src/managers/CachedManager.ts +56 -0
  132. package/src/managers/CategoryChannelChildManager.ts +81 -0
  133. package/src/managers/ChannelManager.ts +194 -0
  134. package/src/managers/DMMessageManager.ts +15 -0
  135. package/src/managers/DataManager.ts +38 -0
  136. package/src/managers/EntitlementManager.ts +182 -0
  137. package/src/managers/GuildApplicationCommandManager.ts +29 -0
  138. package/src/managers/GuildBanManager.ts +221 -0
  139. package/src/managers/GuildChannelManager.ts +552 -0
  140. package/src/managers/GuildEmojiManager.ts +262 -0
  141. package/src/managers/GuildEmojiRoleManager.ts +134 -0
  142. package/src/managers/GuildForumThreadManager.ts +84 -0
  143. package/src/managers/GuildInviteManager.ts +236 -0
  144. package/src/managers/GuildManager.ts +265 -0
  145. package/src/managers/GuildMemberManager.ts +619 -0
  146. package/src/managers/GuildMemberRoleManager.ts +230 -0
  147. package/src/managers/GuildMessageManager.ts +31 -0
  148. package/src/managers/GuildScheduledEventManager.ts +330 -0
  149. package/src/managers/GuildSoundboardSoundManager.ts +157 -0
  150. package/src/managers/GuildStickerManager.ts +192 -0
  151. package/src/managers/GuildTextThreadManager.ts +91 -0
  152. package/src/managers/MessageManager.ts +352 -0
  153. package/src/managers/PartialGroupDMMessageManager.ts +15 -0
  154. package/src/managers/PermissionOverwriteManager.ts +174 -0
  155. package/src/managers/PollAnswerVoterManager.ts +59 -0
  156. package/src/managers/PresenceManager.ts +60 -0
  157. package/src/managers/ReactionManager.ts +72 -0
  158. package/src/managers/ReactionUserManager.ts +82 -0
  159. package/src/managers/RoleManager.ts +432 -0
  160. package/src/managers/StageInstanceManager.ts +166 -0
  161. package/src/managers/SubscriptionManager.ts +83 -0
  162. package/src/managers/ThreadManager.ts +210 -0
  163. package/src/managers/ThreadMemberManager.ts +194 -0
  164. package/src/managers/UserManager.ts +139 -0
  165. package/src/managers/VoiceStateManager.ts +61 -0
  166. package/src/sharding/Shard.ts +513 -0
  167. package/src/sharding/ShardClientUtil.ts +293 -0
  168. package/src/sharding/ShardingManager.ts +374 -0
  169. package/src/structures/ActionRow.ts +31 -0
  170. package/src/structures/AnnouncementChannel.ts +25 -0
  171. package/src/structures/AnonymousGuild.ts +110 -0
  172. package/src/structures/ApplicationCommand.ts +675 -0
  173. package/src/structures/ApplicationEmoji.ts +189 -0
  174. package/src/structures/ApplicationRoleConnectionMetadata.ts +54 -0
  175. package/src/structures/Attachment.ts +189 -0
  176. package/src/structures/AuthorizingIntegrationOwners.ts +63 -0
  177. package/src/structures/AutoModerationActionExecution.ts +138 -0
  178. package/src/structures/AutoModerationRule.ts +325 -0
  179. package/src/structures/AutocompleteInteraction.ts +115 -0
  180. package/src/structures/Base.ts +37 -0
  181. package/src/structures/BaseChannel.ts +188 -0
  182. package/src/structures/BaseGuild.ts +134 -0
  183. package/src/structures/BaseGuildEmoji.ts +113 -0
  184. package/src/structures/BaseGuildTextChannel.ts +230 -0
  185. package/src/structures/BaseGuildVoiceChannel.ts +270 -0
  186. package/src/structures/BaseInteraction.ts +393 -0
  187. package/src/structures/BaseInvite.ts +192 -0
  188. package/src/structures/BaseSelectMenuComponent.ts +58 -0
  189. package/src/structures/ButtonComponent.ts +68 -0
  190. package/src/structures/ButtonInteraction.ts +8 -0
  191. package/src/structures/CategoryChannel.ts +46 -0
  192. package/src/structures/ChannelSelectMenuComponent.ts +18 -0
  193. package/src/structures/ChannelSelectMenuInteraction.ts +34 -0
  194. package/src/structures/ChatInputCommandInteraction.ts +43 -0
  195. package/src/structures/ClientApplication.ts +470 -0
  196. package/src/structures/ClientPresence.ts +87 -0
  197. package/src/structures/ClientUser.ts +219 -0
  198. package/src/structures/CommandInteraction.ts +193 -0
  199. package/src/structures/CommandInteractionOptionResolver.ts +336 -0
  200. package/src/structures/Component.ts +59 -0
  201. package/src/structures/ContainerComponent.ts +63 -0
  202. package/src/structures/ContextMenuCommandInteraction.ts +68 -0
  203. package/src/structures/DMChannel.ts +148 -0
  204. package/src/structures/DirectoryChannel.ts +40 -0
  205. package/src/structures/Embed.ts +251 -0
  206. package/src/structures/Emoji.ts +61 -0
  207. package/src/structures/Entitlement.ts +206 -0
  208. package/src/structures/FileComponent.ts +41 -0
  209. package/src/structures/ForumChannel.ts +31 -0
  210. package/src/structures/GroupDMInvite.ts +34 -0
  211. package/src/structures/Guild.ts +1605 -0
  212. package/src/structures/GuildAuditLogs.ts +99 -0
  213. package/src/structures/GuildAuditLogsEntry.ts +557 -0
  214. package/src/structures/GuildBan.ts +65 -0
  215. package/src/structures/GuildChannel.ts +515 -0
  216. package/src/structures/GuildEmoji.ts +159 -0
  217. package/src/structures/GuildInvite.ts +233 -0
  218. package/src/structures/GuildMember.ts +643 -0
  219. package/src/structures/GuildOnboarding.ts +73 -0
  220. package/src/structures/GuildOnboardingPrompt.ts +93 -0
  221. package/src/structures/GuildOnboardingPromptOption.ts +100 -0
  222. package/src/structures/GuildPreview.ts +218 -0
  223. package/src/structures/GuildPreviewEmoji.ts +28 -0
  224. package/src/structures/GuildScheduledEvent.ts +593 -0
  225. package/src/structures/GuildTemplate.ts +229 -0
  226. package/src/structures/Integration.ts +257 -0
  227. package/src/structures/IntegrationApplication.ts +84 -0
  228. package/src/structures/InteractionCallback.ts +86 -0
  229. package/src/structures/InteractionCallbackResource.ts +57 -0
  230. package/src/structures/InteractionCallbackResponse.ts +35 -0
  231. package/src/structures/InteractionCollector.ts +260 -0
  232. package/src/structures/InteractionWebhook.ts +65 -0
  233. package/src/structures/InviteGuild.ts +22 -0
  234. package/src/structures/LabelComponent.ts +51 -0
  235. package/src/structures/MediaChannel.ts +8 -0
  236. package/src/structures/MediaGalleryComponent.ts +31 -0
  237. package/src/structures/MediaGalleryItem.ts +54 -0
  238. package/src/structures/MentionableSelectMenuComponent.ts +8 -0
  239. package/src/structures/MentionableSelectMenuInteraction.ts +76 -0
  240. package/src/structures/Message.ts +1202 -0
  241. package/src/structures/MessageCollector.ts +155 -0
  242. package/src/structures/MessageComponentInteraction.ts +132 -0
  243. package/src/structures/MessageContextMenuCommandInteraction.ts +18 -0
  244. package/src/structures/MessageMentions.ts +327 -0
  245. package/src/structures/MessagePayload.ts +325 -0
  246. package/src/structures/MessageReaction.ts +219 -0
  247. package/src/structures/ModalComponentResolver.ts +237 -0
  248. package/src/structures/ModalSubmitInteraction.ts +260 -0
  249. package/src/structures/OAuth2Guild.ts +30 -0
  250. package/src/structures/PartialGroupDMChannel.ts +151 -0
  251. package/src/structures/PermissionOverwrites.ts +222 -0
  252. package/src/structures/Poll.ts +195 -0
  253. package/src/structures/PollAnswer.ts +100 -0
  254. package/src/structures/Presence.ts +448 -0
  255. package/src/structures/PrimaryEntryPointCommandInteraction.ts +8 -0
  256. package/src/structures/ReactionCollector.ts +245 -0
  257. package/src/structures/ReactionEmoji.ts +30 -0
  258. package/src/structures/Role.ts +543 -0
  259. package/src/structures/RoleSelectMenuComponent.ts +8 -0
  260. package/src/structures/RoleSelectMenuInteraction.ts +34 -0
  261. package/src/structures/SKU.ts +62 -0
  262. package/src/structures/SectionComponent.ts +44 -0
  263. package/src/structures/SeparatorComponent.ts +29 -0
  264. package/src/structures/SoundboardSound.ts +176 -0
  265. package/src/structures/StageChannel.ts +118 -0
  266. package/src/structures/StageInstance.ts +173 -0
  267. package/src/structures/Sticker.ts +300 -0
  268. package/src/structures/StickerPack.ts +111 -0
  269. package/src/structures/StringSelectMenuComponent.ts +18 -0
  270. package/src/structures/StringSelectMenuInteraction.ts +21 -0
  271. package/src/structures/Subscription.ts +138 -0
  272. package/src/structures/Team.ts +131 -0
  273. package/src/structures/TeamMember.ts +77 -0
  274. package/src/structures/TextChannel.ts +33 -0
  275. package/src/structures/TextDisplayComponent.ts +18 -0
  276. package/src/structures/TextInputComponent.ts +28 -0
  277. package/src/structures/ThreadChannel.ts +680 -0
  278. package/src/structures/ThreadMember.ts +125 -0
  279. package/src/structures/ThreadOnlyChannel.ts +276 -0
  280. package/src/structures/ThumbnailComponent.ts +51 -0
  281. package/src/structures/Typing.ts +81 -0
  282. package/src/structures/UnfurledMediaItem.ts +33 -0
  283. package/src/structures/User.ts +511 -0
  284. package/src/structures/UserContextMenuCommandInteraction.ts +28 -0
  285. package/src/structures/UserSelectMenuComponent.ts +8 -0
  286. package/src/structures/UserSelectMenuInteraction.ts +54 -0
  287. package/src/structures/VoiceChannel.ts +119 -0
  288. package/src/structures/VoiceChannelEffect.ts +92 -0
  289. package/src/structures/VoiceRegion.ts +52 -0
  290. package/src/structures/VoiceState.ts +346 -0
  291. package/src/structures/Webhook.ts +526 -0
  292. package/src/structures/WelcomeChannel.ts +67 -0
  293. package/src/structures/WelcomeScreen.ts +53 -0
  294. package/src/structures/Widget.ts +110 -0
  295. package/src/structures/WidgetMember.ts +124 -0
  296. package/src/structures/interfaces/Application.ts +179 -0
  297. package/src/structures/interfaces/Collector.ts +372 -0
  298. package/src/structures/interfaces/InteractionResponses.ts +384 -0
  299. package/src/structures/interfaces/TextBasedChannel.ts +430 -0
  300. package/src/util/APITypes.ts +690 -0
  301. package/src/util/ActivityFlagsBitField.ts +26 -0
  302. package/src/util/ApplicationFlagsBitField.ts +43 -0
  303. package/src/util/AttachmentFlagsBitField.ts +26 -0
  304. package/src/util/BitField.ts +178 -0
  305. package/src/util/ChannelFlagsBitField.ts +43 -0
  306. package/src/util/Channels.ts +165 -0
  307. package/src/util/Colors.ts +72 -0
  308. package/src/util/Components.ts +285 -0
  309. package/src/util/Constants.ts +251 -0
  310. package/src/util/DataResolver.ts +146 -0
  311. package/src/util/Enums.ts +10 -0
  312. package/src/util/Events.ts +178 -0
  313. package/src/util/GuildMemberFlagsBitField.ts +43 -0
  314. package/src/util/IntentsBitField.ts +35 -0
  315. package/src/util/InviteFlagsBitField.ts +26 -0
  316. package/src/util/Invites.ts +27 -0
  317. package/src/util/LimitedCollection.ts +73 -0
  318. package/src/util/MessageFlagsBitField.ts +43 -0
  319. package/src/util/Options.ts +215 -0
  320. package/src/util/Partials.ts +50 -0
  321. package/src/util/PermissionsBitField.ts +113 -0
  322. package/src/util/RoleFlagsBitField.ts +26 -0
  323. package/src/util/SKUFlagsBitField.ts +26 -0
  324. package/src/util/ShardEvents.ts +26 -0
  325. package/src/util/Status.ts +16 -0
  326. package/src/util/Sweepers.ts +532 -0
  327. package/src/util/Symbols.ts +1 -0
  328. package/src/util/SystemChannelFlagsBitField.ts +45 -0
  329. package/src/util/ThreadMemberFlagsBitField.ts +33 -0
  330. package/src/util/Transformers.ts +123 -0
  331. package/src/util/UserFlagsBitField.ts +33 -0
  332. package/src/util/Util.ts +519 -0
@@ -0,0 +1,4 @@
1
+
2
+ module.exports = (client, packet) => {
3
+ client.actions.UserUpdate.handle(packet.d);
4
+ };
@@ -0,0 +1,16 @@
1
+
2
+ import { VoiceChannelEffect } from '../../../structures/VoiceChannelEffect.js';
3
+ import { Events } from '../../../util/Events.js';
4
+
5
+ module.exports = (client, { d: data }) => {
6
+ const guild = client.guilds.cache.get(data.guild_id);
7
+ if (!guild) return;
8
+
9
+ /**
10
+ * Emitted when someone sends an effect, such as an emoji reaction, in a voice channel the client is connected to.
11
+ *
12
+ * @event Client#voiceChannelEffectSend
13
+ * @param {VoiceChannelEffect} voiceChannelEffect The sent voice channel effect
14
+ */
15
+ client.emit(Events.VoiceChannelEffectSend, new VoiceChannelEffect(data, guild));
16
+ };
@@ -0,0 +1,5 @@
1
+
2
+ module.exports = (client, packet) => {
3
+ client.emit('debug', `[VOICE] received voice server: ${JSON.stringify(packet)}`);
4
+ client.voice.onVoiceServer(packet.d);
5
+ };
@@ -0,0 +1,37 @@
1
+
2
+ import { VoiceState } from '../../../structures/VoiceState.js';
3
+ import { Events } from '../../../util/Events.js';
4
+
5
+ module.exports = (client, { d: data }) => {
6
+ const guild = client.guilds.cache.get(data.guild_id);
7
+ if (!guild) return;
8
+
9
+ // Update the state
10
+ const oldState =
11
+ guild.voiceStates.cache.get(data.user_id)?._clone() ?? new VoiceState(guild, { user_id: data.user_id });
12
+
13
+ const newState = guild.voiceStates._add(data);
14
+
15
+ // Get the member
16
+ let member = guild.members.cache.get(data.user_id);
17
+ if (member && data.member) {
18
+ member._patch(data.member);
19
+ } else if (data.member?.user && data.member.joined_at) {
20
+ member = guild.members._add(data.member);
21
+ }
22
+
23
+ // Emit event
24
+ if (member?.user.id === client.user.id) {
25
+ client.emit('debug', `[VOICE] received voice state update: ${JSON.stringify(data)}`);
26
+ client.voice.onVoiceStateUpdate(data);
27
+ }
28
+
29
+ /**
30
+ * Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes.
31
+ *
32
+ * @event Client#voiceStateUpdate
33
+ * @param {VoiceState} oldState The voice state before the update
34
+ * @param {VoiceState} newState The voice state after the update
35
+ */
36
+ client.emit(Events.VoiceStateUpdate, oldState, newState);
37
+ };
@@ -0,0 +1,16 @@
1
+
2
+ import { Events } from '../../../util/Events.js';
3
+
4
+ module.exports = (client, { d: data }) => {
5
+ const channel = client.channels.cache.get(data.channel_id);
6
+ if (!channel) return;
7
+
8
+ /**
9
+ * Emitted whenever a channel has its webhooks changed.
10
+ *
11
+ * @event Client#webhooksUpdate
12
+ * @param {TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel} channel
13
+ * The channel that had a webhook update
14
+ */
15
+ client.emit(Events.WebhooksUpdate, channel);
16
+ };
@@ -0,0 +1,74 @@
1
+ const PacketHandlers = Object.fromEntries([
2
+ ['APPLICATION_COMMAND_PERMISSIONS_UPDATE', require('./APPLICATION_COMMAND_PERMISSIONS_UPDATE.js')],
3
+ ['AUTO_MODERATION_ACTION_EXECUTION', require('./AUTO_MODERATION_ACTION_EXECUTION.js')],
4
+ ['AUTO_MODERATION_RULE_CREATE', require('./AUTO_MODERATION_RULE_CREATE.js')],
5
+ ['AUTO_MODERATION_RULE_DELETE', require('./AUTO_MODERATION_RULE_DELETE.js')],
6
+ ['AUTO_MODERATION_RULE_UPDATE', require('./AUTO_MODERATION_RULE_UPDATE.js')],
7
+ ['CHANNEL_CREATE', require('./CHANNEL_CREATE.js')],
8
+ ['CHANNEL_DELETE', require('./CHANNEL_DELETE.js')],
9
+ ['CHANNEL_PINS_UPDATE', require('./CHANNEL_PINS_UPDATE.js')],
10
+ ['CHANNEL_UPDATE', require('./CHANNEL_UPDATE.js')],
11
+ ['ENTITLEMENT_CREATE', require('./ENTITLEMENT_CREATE.js')],
12
+ ['ENTITLEMENT_DELETE', require('./ENTITLEMENT_DELETE.js')],
13
+ ['ENTITLEMENT_UPDATE', require('./ENTITLEMENT_UPDATE.js')],
14
+ ['GUILD_AUDIT_LOG_ENTRY_CREATE', require('./GUILD_AUDIT_LOG_ENTRY_CREATE.js')],
15
+ ['GUILD_BAN_ADD', require('./GUILD_BAN_ADD.js')],
16
+ ['GUILD_BAN_REMOVE', require('./GUILD_BAN_REMOVE.js')],
17
+ ['GUILD_CREATE', require('./GUILD_CREATE.js')],
18
+ ['GUILD_DELETE', require('./GUILD_DELETE.js')],
19
+ ['GUILD_EMOJIS_UPDATE', require('./GUILD_EMOJIS_UPDATE.js')],
20
+ ['GUILD_INTEGRATIONS_UPDATE', require('./GUILD_INTEGRATIONS_UPDATE.js')],
21
+ ['GUILD_MEMBERS_CHUNK', require('./GUILD_MEMBERS_CHUNK.js')],
22
+ ['GUILD_MEMBER_ADD', require('./GUILD_MEMBER_ADD.js')],
23
+ ['GUILD_MEMBER_REMOVE', require('./GUILD_MEMBER_REMOVE.js')],
24
+ ['GUILD_MEMBER_UPDATE', require('./GUILD_MEMBER_UPDATE.js')],
25
+ ['GUILD_ROLE_CREATE', require('./GUILD_ROLE_CREATE.js')],
26
+ ['GUILD_ROLE_DELETE', require('./GUILD_ROLE_DELETE.js')],
27
+ ['GUILD_ROLE_UPDATE', require('./GUILD_ROLE_UPDATE.js')],
28
+ ['GUILD_SCHEDULED_EVENT_CREATE', require('./GUILD_SCHEDULED_EVENT_CREATE.js')],
29
+ ['GUILD_SCHEDULED_EVENT_DELETE', require('./GUILD_SCHEDULED_EVENT_DELETE.js')],
30
+ ['GUILD_SCHEDULED_EVENT_UPDATE', require('./GUILD_SCHEDULED_EVENT_UPDATE.js')],
31
+ ['GUILD_SCHEDULED_EVENT_USER_ADD', require('./GUILD_SCHEDULED_EVENT_USER_ADD.js')],
32
+ ['GUILD_SCHEDULED_EVENT_USER_REMOVE', require('./GUILD_SCHEDULED_EVENT_USER_REMOVE.js')],
33
+ ['GUILD_SOUNDBOARD_SOUNDS_UPDATE', require('./GUILD_SOUNDBOARD_SOUNDS_UPDATE.js')],
34
+ ['GUILD_SOUNDBOARD_SOUND_CREATE', require('./GUILD_SOUNDBOARD_SOUND_CREATE.js')],
35
+ ['GUILD_SOUNDBOARD_SOUND_DELETE', require('./GUILD_SOUNDBOARD_SOUND_DELETE.js')],
36
+ ['GUILD_SOUNDBOARD_SOUND_UPDATE', require('./GUILD_SOUNDBOARD_SOUND_UPDATE.js')],
37
+ ['GUILD_STICKERS_UPDATE', require('./GUILD_STICKERS_UPDATE.js')],
38
+ ['GUILD_UPDATE', require('./GUILD_UPDATE.js')],
39
+ ['INTERACTION_CREATE', require('./INTERACTION_CREATE.js')],
40
+ ['INVITE_CREATE', require('./INVITE_CREATE.js')],
41
+ ['INVITE_DELETE', require('./INVITE_DELETE.js')],
42
+ ['MESSAGE_CREATE', require('./MESSAGE_CREATE.js')],
43
+ ['MESSAGE_DELETE', require('./MESSAGE_DELETE.js')],
44
+ ['MESSAGE_DELETE_BULK', require('./MESSAGE_DELETE_BULK.js')],
45
+ ['MESSAGE_POLL_VOTE_ADD', require('./MESSAGE_POLL_VOTE_ADD.js')],
46
+ ['MESSAGE_POLL_VOTE_REMOVE', require('./MESSAGE_POLL_VOTE_REMOVE.js')],
47
+ ['MESSAGE_REACTION_ADD', require('./MESSAGE_REACTION_ADD.js')],
48
+ ['MESSAGE_REACTION_REMOVE', require('./MESSAGE_REACTION_REMOVE.js')],
49
+ ['MESSAGE_REACTION_REMOVE_ALL', require('./MESSAGE_REACTION_REMOVE_ALL.js')],
50
+ ['MESSAGE_REACTION_REMOVE_EMOJI', require('./MESSAGE_REACTION_REMOVE_EMOJI.js')],
51
+ ['MESSAGE_UPDATE', require('./MESSAGE_UPDATE.js')],
52
+ ['PRESENCE_UPDATE', require('./PRESENCE_UPDATE.js')],
53
+ ['RATE_LIMITED', require('./RATE_LIMITED.js')],
54
+ ['READY', require('./READY.js')],
55
+ ['SOUNDBOARD_SOUNDS', require('./SOUNDBOARD_SOUNDS.js')],
56
+ ['STAGE_INSTANCE_CREATE', require('./STAGE_INSTANCE_CREATE.js')],
57
+ ['STAGE_INSTANCE_DELETE', require('./STAGE_INSTANCE_DELETE.js')],
58
+ ['STAGE_INSTANCE_UPDATE', require('./STAGE_INSTANCE_UPDATE.js')],
59
+ ['SUBSCRIPTION_CREATE', require('./SUBSCRIPTION_CREATE.js')],
60
+ ['SUBSCRIPTION_DELETE', require('./SUBSCRIPTION_DELETE.js')],
61
+ ['SUBSCRIPTION_UPDATE', require('./SUBSCRIPTION_UPDATE.js')],
62
+ ['THREAD_CREATE', require('./THREAD_CREATE.js')],
63
+ ['THREAD_DELETE', require('./THREAD_DELETE.js')],
64
+ ['THREAD_LIST_SYNC', require('./THREAD_LIST_SYNC.js')],
65
+ ['THREAD_MEMBERS_UPDATE', require('./THREAD_MEMBERS_UPDATE.js')],
66
+ ['THREAD_MEMBER_UPDATE', require('./THREAD_MEMBER_UPDATE.js')],
67
+ ['THREAD_UPDATE', require('./THREAD_UPDATE.js')],
68
+ ['TYPING_START', require('./TYPING_START.js')],
69
+ ['USER_UPDATE', require('./USER_UPDATE.js')],
70
+ ['VOICE_CHANNEL_EFFECT_SEND', require('./VOICE_CHANNEL_EFFECT_SEND.js')],
71
+ ['VOICE_SERVER_UPDATE', require('./VOICE_SERVER_UPDATE.js')],
72
+ ['VOICE_STATE_UPDATE', require('./VOICE_STATE_UPDATE.js')],
73
+ ['WEBHOOKS_UPDATE', require('./WEBHOOKS_UPDATE.js')],
74
+ ]);
@@ -0,0 +1,50 @@
1
+ // Heavily inspired by node's `internal/errors` module
2
+ import { ErrorCodes } from './ErrorCodes.js';
3
+ import { Messages } from './Messages.js';
4
+
5
+ /**
6
+ * Extend an error of some sort into a DiscordjsError.
7
+ *
8
+ * @param {Error} Base Base error to extend
9
+ * @returns {DiscordjsError}
10
+ * @ignore
11
+ */
12
+ export function makeDiscordjsError(Base) {
13
+ return class extends Base {
14
+ static {
15
+ Object.defineProperty(this, 'name', { value: `Discordjs${Base.name}` });
16
+ }
17
+
18
+ constructor(code, ...args) {
19
+ super(message(code, args));
20
+ this.code = code;
21
+ Error.captureStackTrace(this, this.constructor);
22
+ }
23
+
24
+ get name() {
25
+ return `${this.constructor.name} [${this.code}]`;
26
+ }
27
+ };
28
+ }
29
+
30
+ /**
31
+ * Format the message for an error.
32
+ *
33
+ * @param {string} code The error code
34
+ * @param {Array<*>} args Arguments to pass for util format or as function args
35
+ * @returns {string} Formatted string
36
+ * @ignore
37
+ */
38
+ export function message(code, args) {
39
+ if (!(code in ErrorCodes)) throw new Error('Error code must be a valid DiscordjsErrorCodes');
40
+ const msg = Messages[code];
41
+ if (!msg) throw new Error(`No message associated with error code: ${code}.`);
42
+ if (typeof msg === 'function') return msg(...args);
43
+ if (!args?.length) return msg;
44
+ args.unshift(msg);
45
+ return String(...args);
46
+ }
47
+
48
+ exports.DiscordjsError = makeDiscordjsError(Error);
49
+ exports.DiscordjsTypeError = makeDiscordjsError(TypeError);
50
+ exports.DiscordjsRangeError = makeDiscordjsError(RangeError);
@@ -0,0 +1,277 @@
1
+ /* eslint-disable jsdoc/tag-lines, jsdoc/require-property-description */
2
+
3
+ /**
4
+ * @typedef {Object} DiscordjsErrorCodes
5
+ * @property {'ClientInvalidOption'} ClientInvalidOption
6
+ * @property {'ClientInvalidProvidedShards'} ClientInvalidProvidedShards
7
+ * @property {'ClientMissingIntents'} ClientMissingIntents
8
+ * @property {'ClientNotReady'} ClientNotReady
9
+ *
10
+ * @property {'TokenInvalid'} TokenInvalid
11
+ * @property {'TokenMissing'} TokenMissing
12
+ * @property {'ApplicationCommandPermissionsTokenMissing'} ApplicationCommandPermissionsTokenMissing
13
+ *
14
+ * @property {'BitFieldInvalid'} BitFieldInvalid
15
+ *
16
+ * @property {'ShardingNoShards'} ShardingNoShards
17
+ * @property {'ShardingInProcess'} ShardingInProcess
18
+ * @property {'ShardingInvalidEvalBroadcast'} ShardingInvalidEvalBroadcast
19
+ * @property {'ShardingShardNotFound'} ShardingShardNotFound
20
+ * @property {'ShardingAlreadySpawned'} ShardingAlreadySpawned
21
+ * @property {'ShardingProcessExists'} ShardingProcessExists
22
+ * @property {'ShardingWorkerExists'} ShardingWorkerExists
23
+ * @property {'ShardingReadyTimeout'} ShardingReadyTimeout
24
+ * @property {'ShardingReadyDisconnected'} ShardingReadyDisconnected
25
+ * @property {'ShardingReadyDied'} ShardingReadyDied
26
+ * @property {'ShardingNoChildExists'} ShardingNoChildExists
27
+ * @property {'ShardingShardMiscalculation'} ShardingShardMiscalculation
28
+ *
29
+ * @property {'ColorRange'} ColorRange
30
+ * @property {'ColorConvert'} ColorConvert
31
+ *
32
+ * @property {'InviteOptionsMissingChannel'} InviteOptionsMissingChannel
33
+ *
34
+ * @property {'InteractionCollectorError'} InteractionCollectorError
35
+ *
36
+ * @property {'FileNotFound'} FileNotFound
37
+ *
38
+ * @property {'UserNoDMChannel'} UserNoDMChannel
39
+ *
40
+ * @property {'VoiceNotStageChannel'} VoiceNotStageChannel
41
+ *
42
+ * @property {'VoiceStateNotOwn'} VoiceStateNotOwn
43
+ * @property {'VoiceStateInvalidType'} VoiceStateInvalidType
44
+ *
45
+ * @property {'ReqResourceType'} ReqResourceType
46
+ *
47
+ * @property {'MessageBulkDeleteType'} MessageBulkDeleteType
48
+ * @property {'MessageContentType'} MessageContentType
49
+ * @property {'MessageNonceRequired'} MessageNonceRequired
50
+ * @property {'MessageNonceType'} MessageNonceType
51
+ *
52
+ * @property {'BanResolveId'} BanResolveId
53
+ * @property {'FetchBanResolveId'} FetchBanResolveId
54
+ *
55
+ * @property {'PruneDaysType'} PruneDaysType
56
+ *
57
+ * @property {'GuildChannelResolve'} GuildChannelResolve
58
+ * @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve
59
+ * @property {'GuildChannelOrphan'} GuildChannelOrphan
60
+ * @property {'GuildChannelUnowned'} GuildChannelUnowned
61
+ * @property {'GuildMembersTimeout'} GuildMembersTimeout
62
+ * @property {'GuildSoundboardSoundsTimeout'} GuildSoundboardSoundsTimeout
63
+ * @property {'GuildUncachedMe'} GuildUncachedMe
64
+ * @property {'ChannelNotCached'} ChannelNotCached
65
+ * @property {'StageChannelResolve'} StageChannelResolve
66
+ * @property {'GuildScheduledEventResolve'} GuildScheduledEventResolve
67
+ * @property {'FetchOwnerId'} FetchOwnerId
68
+ *
69
+ * @property {'InvalidType'} InvalidType
70
+ * @property {'InvalidElement'} InvalidElement
71
+ *
72
+ * @property {'MessageThreadParent'} MessageThreadParent
73
+ * @property {'MessageExistingThread'} MessageExistingThread
74
+ * @property {'ThreadInvitableType'} ThreadInvitableType
75
+ * @property {'NotAThreadOfParent'} NotAThreadOfParent
76
+ *
77
+ * @property {'WebhookMessage'} WebhookMessage
78
+ * @property {'WebhookTokenUnavailable'} WebhookTokenUnavailable
79
+ * @property {'WebhookApplication'} WebhookApplication
80
+ *
81
+ * @property {'MessageReferenceMissing'} MessageReferenceMissing
82
+ *
83
+ * @property {'EmojiType'} EmojiType
84
+ * @property {'EmojiManaged'} EmojiManaged
85
+ * @property {'MissingGuildExpressionsPermission'} MissingGuildExpressionsPermission
86
+ *
87
+ * @property {'NotGuildSoundboardSound'} NotGuildSoundboardSound
88
+ * @property {'NotGuildSticker'} NotGuildSticker
89
+ *
90
+ * @property {'ReactionResolveUser'} ReactionResolveUser
91
+ *
92
+ * @property {'InviteResolveCode'} InviteResolveCode
93
+ * @property {'InviteNotFound'} InviteNotFound
94
+ *
95
+ * @property {'DeleteGroupDMChannel'} DeleteGroupDMChannel
96
+ * @property {'FetchGroupDMChannel'} FetchGroupDMChannel
97
+ *
98
+ * @property {'MemberFetchNonceLength'} MemberFetchNonceLength
99
+ *
100
+ * @property {'GlobalCommandPermissions'} GlobalCommandPermissions
101
+ * @property {'GuildUncachedEntityResolve'} GuildUncachedEntityResolve
102
+ *
103
+ * @property {'InteractionAlreadyReplied'} InteractionAlreadyReplied
104
+ * @property {'InteractionNotReplied'} InteractionNotReplied
105
+ *
106
+ * @property {'CommandInteractionOptionNotFound'} CommandInteractionOptionNotFound
107
+ * @property {'CommandInteractionOptionType'} CommandInteractionOptionType
108
+ * @property {'CommandInteractionOptionEmpty'} CommandInteractionOptionEmpty
109
+ * @property {'CommandInteractionOptionNoSubcommand'} CommandInteractionOptionNoSubcommand
110
+ * @property {'CommandInteractionOptionNoSubcommandGroup'} CommandInteractionOptionNoSubcommandGroup
111
+ * @property {'CommandInteractionOptionInvalidChannelType'} CommandInteractionOptionInvalidChannelType
112
+ * @property {'AutocompleteInteractionOptionNoFocusedOption'} AutocompleteInteractionOptionNoFocusedOption
113
+ *
114
+ * @property {'ModalSubmitInteractionComponentNotFound'} ModalSubmitInteractionComponentNotFound
115
+ * @property {'ModalSubmitInteractionComponentType'} ModalSubmitInteractionComponentType
116
+ * @property {'ModalSubmitInteractionComponentEmpty'} ModalSubmitInteractionComponentEmpty
117
+ * @property {'ModalSubmitInteractionComponentInvalidChannelType'} ModalSubmitInteractionComponentInvalidChannelType
118
+ *
119
+ * @property {'InvalidMissingScopes'} InvalidMissingScopes
120
+ * @property {'InvalidScopesWithPermissions'} InvalidScopesWithPermissions
121
+ *
122
+ * @property {'NotImplemented'} NotImplemented
123
+ *
124
+ * @property {'GuildForumMessageRequired'} GuildForumMessageRequired
125
+ *
126
+ * @property {'SweepFilterReturn'} SweepFilterReturn
127
+ *
128
+ * @property {'EntitlementCreateInvalidOwner'} EntitlementCreateInvalidOwner
129
+ *
130
+ * @property {'BulkBanUsersOptionEmpty'} BulkBanUsersOptionEmpty
131
+ *
132
+ * @property {'PollAlreadyExpired'} PollAlreadyExpired
133
+ *
134
+ * @property {'PermissionOverwritesTypeMandatory'} PermissionOverwritesTypeMandatory
135
+ * @property {'PermissionOverwritesTypeMismatch'} PermissionOverwritesTypeMismatch
136
+ */
137
+
138
+ const keys = [
139
+ 'ClientInvalidOption',
140
+ 'ClientInvalidProvidedShards',
141
+ 'ClientMissingIntents',
142
+ 'ClientNotReady',
143
+
144
+ 'TokenInvalid',
145
+ 'TokenMissing',
146
+ 'ApplicationCommandPermissionsTokenMissing',
147
+
148
+ 'BitFieldInvalid',
149
+
150
+ 'ShardingNoShards',
151
+ 'ShardingInProcess',
152
+ 'ShardingInvalidEvalBroadcast',
153
+ 'ShardingShardNotFound',
154
+ 'ShardingAlreadySpawned',
155
+ 'ShardingProcessExists',
156
+ 'ShardingWorkerExists',
157
+ 'ShardingReadyTimeout',
158
+ 'ShardingReadyDisconnected',
159
+ 'ShardingReadyDied',
160
+ 'ShardingNoChildExists',
161
+ 'ShardingShardMiscalculation',
162
+
163
+ 'ColorRange',
164
+ 'ColorConvert',
165
+
166
+ 'InviteOptionsMissingChannel',
167
+
168
+ 'InteractionCollectorError',
169
+
170
+ 'FileNotFound',
171
+
172
+ 'UserNoDMChannel',
173
+
174
+ 'VoiceNotStageChannel',
175
+
176
+ 'VoiceStateNotOwn',
177
+ 'VoiceStateInvalidType',
178
+
179
+ 'ReqResourceType',
180
+
181
+ 'MessageBulkDeleteType',
182
+ 'MessageContentType',
183
+ 'MessageNonceRequired',
184
+ 'MessageNonceType',
185
+
186
+ 'BanResolveId',
187
+ 'FetchBanResolveId',
188
+
189
+ 'PruneDaysType',
190
+
191
+ 'GuildChannelResolve',
192
+ 'GuildVoiceChannelResolve',
193
+ 'GuildChannelOrphan',
194
+ 'GuildChannelUnowned',
195
+ 'GuildMembersTimeout',
196
+ 'GuildSoundboardSoundsTimeout',
197
+ 'GuildUncachedMe',
198
+ 'ChannelNotCached',
199
+ 'StageChannelResolve',
200
+ 'GuildScheduledEventResolve',
201
+ 'FetchOwnerId',
202
+
203
+ 'InvalidType',
204
+ 'InvalidElement',
205
+
206
+ 'MessageThreadParent',
207
+ 'MessageExistingThread',
208
+ 'ThreadInvitableType',
209
+ 'NotAThreadOfParent',
210
+
211
+ 'WebhookMessage',
212
+ 'WebhookTokenUnavailable',
213
+ 'WebhookApplication',
214
+
215
+ 'MessageReferenceMissing',
216
+
217
+ 'EmojiType',
218
+ 'EmojiManaged',
219
+ 'MissingGuildExpressionsPermission',
220
+
221
+ 'NotGuildSoundboardSound',
222
+ 'NotGuildSticker',
223
+
224
+ 'ReactionResolveUser',
225
+
226
+ 'InviteResolveCode',
227
+ 'InviteNotFound',
228
+
229
+ 'DeleteGroupDMChannel',
230
+ 'FetchGroupDMChannel',
231
+
232
+ 'MemberFetchNonceLength',
233
+
234
+ 'GlobalCommandPermissions',
235
+ 'GuildUncachedEntityResolve',
236
+
237
+ 'InteractionAlreadyReplied',
238
+ 'InteractionNotReplied',
239
+
240
+ 'CommandInteractionOptionNotFound',
241
+ 'CommandInteractionOptionType',
242
+ 'CommandInteractionOptionEmpty',
243
+ 'CommandInteractionOptionNoSubcommand',
244
+ 'CommandInteractionOptionNoSubcommandGroup',
245
+ 'CommandInteractionOptionInvalidChannelType',
246
+ 'AutocompleteInteractionOptionNoFocusedOption',
247
+
248
+ 'ModalSubmitInteractionComponentNotFound',
249
+ 'ModalSubmitInteractionComponentType',
250
+ 'ModalSubmitInteractionComponentEmpty',
251
+ 'ModalSubmitInteractionComponentInvalidChannelType',
252
+
253
+ 'InvalidMissingScopes',
254
+ 'InvalidScopesWithPermissions',
255
+
256
+ 'NotImplemented',
257
+
258
+ 'SweepFilterReturn',
259
+
260
+ 'GuildForumMessageRequired',
261
+
262
+ 'EntitlementCreateInvalidOwner',
263
+
264
+ 'BulkBanUsersOptionEmpty',
265
+
266
+ 'PollAlreadyExpired',
267
+
268
+ 'PermissionOverwritesTypeMandatory',
269
+ 'PermissionOverwritesTypeMismatch',
270
+ ];
271
+
272
+ // JSDoc for IntelliSense purposes
273
+ /**
274
+ * @type {DiscordjsErrorCodes}
275
+ * @ignore
276
+ */
277
+ const ErrorCodes = Object.fromEntries(keys.map(key => [key, key]));
@@ -0,0 +1,155 @@
1
+ import { ErrorCodes } from './ErrorCodes.js';
2
+
3
+ const Messages = {
4
+ [ErrorCodes.ClientInvalidOption]: (prop, must) => `The ${prop} option must be ${must}`,
5
+ [ErrorCodes.ClientInvalidProvidedShards]: 'None of the provided shards were valid.',
6
+ [ErrorCodes.ClientMissingIntents]: 'Valid intents must be provided for the Client.',
7
+ [ErrorCodes.ClientNotReady]: action => `The client needs to be logged in to ${action}.`,
8
+
9
+ [ErrorCodes.TokenInvalid]: 'An invalid token was provided.',
10
+ [ErrorCodes.TokenMissing]: 'Request to use token, but token was unavailable to the client.',
11
+ [ErrorCodes.ApplicationCommandPermissionsTokenMissing]:
12
+ 'Editing application command permissions requires an OAuth2 bearer token, but none was provided.',
13
+
14
+ [ErrorCodes.BitFieldInvalid]: bit => `Invalid bitfield flag or number: ${bit}.`,
15
+
16
+ [ErrorCodes.ShardingNoShards]: 'No shards have been spawned.',
17
+ [ErrorCodes.ShardingInProcess]: 'Shards are still being spawned.',
18
+ [ErrorCodes.ShardingInvalidEvalBroadcast]: 'Script to evaluate must be a function',
19
+ [ErrorCodes.ShardingShardNotFound]: id => `Shard ${id} could not be found.`,
20
+ [ErrorCodes.ShardingAlreadySpawned]: count => `Already spawned ${count} shards.`,
21
+ [ErrorCodes.ShardingProcessExists]: id => `Shard ${id} already has an active process.`,
22
+ [ErrorCodes.ShardingWorkerExists]: id => `Shard ${id} already has an active worker.`,
23
+ [ErrorCodes.ShardingReadyTimeout]: id => `Shard ${id}'s Client took too long to become ready.`,
24
+ [ErrorCodes.ShardingReadyDisconnected]: id => `Shard ${id}'s Client disconnected before becoming ready.`,
25
+ [ErrorCodes.ShardingReadyDied]: id => `Shard ${id}'s process exited before its Client became ready.`,
26
+ [ErrorCodes.ShardingNoChildExists]: id => `Shard ${id} has no active process or worker.`,
27
+ [ErrorCodes.ShardingShardMiscalculation]: (shard, guild, count) =>
28
+ `Calculated invalid shard ${shard} for guild ${guild} with ${count} shards.`,
29
+
30
+ [ErrorCodes.ColorRange]: 'Color must be within the range 0 - 16777215 (0xFFFFFF).',
31
+ [ErrorCodes.ColorConvert]: color => `Unable to convert "${color}" to a number.`,
32
+
33
+ [ErrorCodes.InviteOptionsMissingChannel]:
34
+ 'A valid guild channel must be provided when GuildScheduledEvent is EXTERNAL.',
35
+
36
+ [ErrorCodes.InteractionCollectorError]: reason =>
37
+ `Collector received no interactions before ending with reason: ${reason}`,
38
+
39
+ [ErrorCodes.FileNotFound]: file => `File could not be found: ${file}`,
40
+
41
+ [ErrorCodes.UserNoDMChannel]: 'No DM Channel exists!',
42
+
43
+ [ErrorCodes.VoiceNotStageChannel]: 'You are only allowed to do this in stage channels.',
44
+
45
+ [ErrorCodes.VoiceStateNotOwn]:
46
+ 'You cannot self-deafen/mute/request to speak on VoiceStates that do not belong to the ClientUser.',
47
+ [ErrorCodes.VoiceStateInvalidType]: name => `${name} must be a boolean.`,
48
+
49
+ [ErrorCodes.ReqResourceType]: 'The resource must be a string, Buffer or a valid file stream.',
50
+
51
+ [ErrorCodes.MessageBulkDeleteType]: 'The messages must be an Array, Collection, or number.',
52
+ [ErrorCodes.MessageContentType]: 'Message content must be a string.',
53
+ [ErrorCodes.MessageNonceRequired]: 'Message nonce is required when enforceNonce is true.',
54
+ [ErrorCodes.MessageNonceType]: 'Message nonce must be an integer or a string.',
55
+
56
+ [ErrorCodes.BanResolveId]: (ban = false) => `Couldn't resolve the user id to ${ban ? 'ban' : 'unban'}.`,
57
+ [ErrorCodes.FetchBanResolveId]: "Couldn't resolve the user id to fetch the ban.",
58
+
59
+ [ErrorCodes.PruneDaysType]: 'Days must be a number',
60
+
61
+ [ErrorCodes.GuildChannelResolve]: 'Could not resolve channel to a guild channel.',
62
+ [ErrorCodes.GuildVoiceChannelResolve]: 'Could not resolve channel to a guild voice channel.',
63
+ [ErrorCodes.GuildChannelOrphan]: 'Could not find a parent to this guild channel.',
64
+ [ErrorCodes.GuildChannelUnowned]: "The fetched channel does not belong to this manager's guild.",
65
+ [ErrorCodes.GuildMembersTimeout]: "Members didn't arrive in time.",
66
+ [ErrorCodes.GuildSoundboardSoundsTimeout]: "Soundboard sounds didn't arrive in time.",
67
+ [ErrorCodes.GuildUncachedMe]: 'The client user as a member of this guild is uncached.',
68
+ [ErrorCodes.ChannelNotCached]: 'Could not find the channel where this message came from in the cache!',
69
+ [ErrorCodes.StageChannelResolve]: 'Could not resolve channel to a stage channel.',
70
+ [ErrorCodes.GuildScheduledEventResolve]: 'Could not resolve the guild scheduled event.',
71
+ [ErrorCodes.FetchOwnerId]: type => `Couldn't resolve the ${type} ownerId to fetch the ${type} member.`,
72
+
73
+ [ErrorCodes.InvalidType]: (name, expected, an = false) => `Supplied ${name} is not a${an ? 'n' : ''} ${expected}.`,
74
+ [ErrorCodes.InvalidElement]: (type, name, elem) => `Supplied ${type} ${name} includes an invalid element: ${elem}`,
75
+
76
+ [ErrorCodes.MessageThreadParent]: 'The message was not sent in a guild text or announcement channel',
77
+ [ErrorCodes.MessageExistingThread]: 'The message already has a thread',
78
+ [ErrorCodes.ThreadInvitableType]: type => `Invitable cannot be edited on ${type}`,
79
+ [ErrorCodes.NotAThreadOfParent]: 'Provided ThreadChannelResolvable is not a thread of the parent channel.',
80
+
81
+ [ErrorCodes.WebhookMessage]: 'The message was not sent by a webhook.',
82
+ [ErrorCodes.WebhookTokenUnavailable]: 'This action requires a webhook token, but none is available.',
83
+ [ErrorCodes.WebhookApplication]: 'This message webhook belongs to an application and cannot be fetched.',
84
+
85
+ [ErrorCodes.MessageReferenceMissing]: 'The message does not reference another message',
86
+
87
+ [ErrorCodes.EmojiType]: 'Emoji must be a string or GuildEmoji/ReactionEmoji',
88
+ [ErrorCodes.EmojiManaged]: 'Emoji is managed and has no Author.',
89
+ [ErrorCodes.MissingGuildExpressionsPermission]: guild =>
90
+ `Client must have Create Guild Expressions or Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
91
+
92
+ [ErrorCodes.NotGuildSoundboardSound]: action =>
93
+ `Soundboard sound is a default (non-guild) soundboard sound and can't be ${action}.`,
94
+ [ErrorCodes.NotGuildSticker]: 'Sticker is a standard (non-guild) sticker and has no author.',
95
+
96
+ [ErrorCodes.ReactionResolveUser]: "Couldn't resolve the user id to remove from the reaction.",
97
+
98
+ [ErrorCodes.InviteResolveCode]: 'Could not resolve the code to fetch the invite.',
99
+ [ErrorCodes.InviteNotFound]: 'Could not find the requested invite.',
100
+
101
+ [ErrorCodes.DeleteGroupDMChannel]: "Bots don't have access to Group DM Channels and cannot delete them",
102
+ [ErrorCodes.FetchGroupDMChannel]: "Bots don't have access to Group DM Channels and cannot fetch them",
103
+
104
+ [ErrorCodes.MemberFetchNonceLength]: 'Nonce length must not exceed 32 characters.',
105
+
106
+ [ErrorCodes.GlobalCommandPermissions]:
107
+ 'Permissions for global commands may only be fetched or modified by providing a GuildResolvable ' +
108
+ "or from a guild's application command manager.",
109
+ [ErrorCodes.GuildUncachedEntityResolve]: type =>
110
+ `Cannot resolve ${type} from an arbitrary guild, provide an id instead`,
111
+
112
+ [ErrorCodes.InteractionAlreadyReplied]: 'The reply to this interaction has already been sent or deferred.',
113
+ [ErrorCodes.InteractionNotReplied]: 'The reply to this interaction has not been sent or deferred.',
114
+
115
+ [ErrorCodes.CommandInteractionOptionNotFound]: name => `Required option "${name}" not found.`,
116
+ [ErrorCodes.CommandInteractionOptionType]: (name, type, expected) =>
117
+ `Option "${name}" is of type: ${type}; expected ${expected}.`,
118
+ [ErrorCodes.CommandInteractionOptionEmpty]: (name, type) =>
119
+ `Required option "${name}" is of type: ${type}; expected a non-empty value.`,
120
+ [ErrorCodes.CommandInteractionOptionNoSubcommand]: 'No subcommand specified for interaction.',
121
+ [ErrorCodes.CommandInteractionOptionNoSubcommandGroup]: 'No subcommand group specified for interaction.',
122
+ [ErrorCodes.CommandInteractionOptionInvalidChannelType]: (name, type, expected) =>
123
+ `The type of channel of the option "${name}" is: ${type}; expected ${expected}.`,
124
+ [ErrorCodes.AutocompleteInteractionOptionNoFocusedOption]: 'No focused option for autocomplete interaction.',
125
+
126
+ [ErrorCodes.ModalSubmitInteractionComponentNotFound]: customId =>
127
+ `Required component with custom id "${customId}" not found.`,
128
+ [ErrorCodes.ModalSubmitInteractionComponentType]: (customId, type, expected) =>
129
+ `Component with custom id "${customId}" is of type: ${type}; expected ${expected}.`,
130
+ [ErrorCodes.ModalSubmitInteractionComponentEmpty]: (customId, type) =>
131
+ `Required component with custom id "${customId}" is of type: ${type}; expected a non-empty value.`,
132
+ [ErrorCodes.ModalSubmitInteractionComponentInvalidChannelType]: (customId, type, expected) =>
133
+ `The type of channel of the component with custom id "${customId}" is: ${type}; expected ${expected}.`,
134
+
135
+ [ErrorCodes.InvalidMissingScopes]: 'At least one valid scope must be provided for the invite',
136
+ [ErrorCodes.InvalidScopesWithPermissions]: 'Permissions cannot be set without the bot scope.',
137
+
138
+ [ErrorCodes.NotImplemented]: (what, name) => `Method ${what} not implemented on ${name}.`,
139
+
140
+ [ErrorCodes.SweepFilterReturn]: 'The return value of the sweepFilter function was not false or a Function',
141
+
142
+ [ErrorCodes.GuildForumMessageRequired]: 'You must provide a message to create a guild forum thread',
143
+
144
+ [ErrorCodes.EntitlementCreateInvalidOwner]:
145
+ 'You must provide either a guild or a user to create an entitlement, but not both',
146
+
147
+ [ErrorCodes.BulkBanUsersOptionEmpty]: 'Option "users" array or collection is empty',
148
+
149
+ [ErrorCodes.PollAlreadyExpired]: 'This poll has already expired.',
150
+
151
+ [ErrorCodes.PermissionOverwritesTypeMandatory]: '"overwrite.type" is mandatory if "overwrite.id" is a Snowflake',
152
+ [ErrorCodes.PermissionOverwritesTypeMismatch]: expected =>
153
+ `"overwrite.id" is a ${expected.toLowerCase()} object, ` +
154
+ `but "overwrite.type" is defined and not equal to OverwriteType.${expected}`,
155
+ };
@@ -0,0 +1,6 @@
1
+
2
+ export { DiscordjsError } from './DJSError.js';
3
+ export { DiscordjsTypeError } from './DJSError.js';
4
+ export { DiscordjsRangeError } from './DJSError.js';
5
+ export { ErrorCodes } from './ErrorCodes.js';
6
+ export { Messages } from './Messages.js';