@velliajs/discord 1.0.2 → 1.0.4

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 (258) hide show
  1. package/README.md +4 -11
  2. package/package.json +3 -3
  3. package/src/client/BaseClient.js +7 -28
  4. package/src/client/Client.js +116 -283
  5. package/src/client/WebhookClient.js +17 -59
  6. package/src/client/actions/Action.js +0 -10
  7. package/src/client/actions/ActionsManager.js +3 -3
  8. package/src/client/actions/ApplicationCommandPermissionsUpdate.js +2 -15
  9. package/src/client/actions/AutoModerationActionExecution.js +1 -6
  10. package/src/client/actions/AutoModerationRuleCreate.js +1 -6
  11. package/src/client/actions/AutoModerationRuleDelete.js +1 -6
  12. package/src/client/actions/AutoModerationRuleUpdate.js +1 -7
  13. package/src/client/actions/ChannelCreate.js +1 -5
  14. package/src/client/actions/ChannelDelete.js +1 -5
  15. package/src/client/actions/GuildAuditLogEntryCreate.js +1 -6
  16. package/src/client/actions/GuildBanAdd.js +1 -5
  17. package/src/client/actions/GuildBanRemove.js +1 -5
  18. package/src/client/actions/GuildDelete.js +6 -14
  19. package/src/client/actions/GuildEmojiCreate.js +1 -5
  20. package/src/client/actions/GuildEmojiDelete.js +1 -5
  21. package/src/client/actions/GuildEmojiUpdate.js +1 -6
  22. package/src/client/actions/GuildEmojisUpdate.js +4 -4
  23. package/src/client/actions/GuildIntegrationsUpdate.js +1 -5
  24. package/src/client/actions/GuildMemberRemove.js +1 -5
  25. package/src/client/actions/GuildMemberUpdate.js +2 -11
  26. package/src/client/actions/GuildRoleCreate.js +1 -5
  27. package/src/client/actions/GuildRoleDelete.js +1 -5
  28. package/src/client/actions/GuildRoleUpdate.js +1 -6
  29. package/src/client/actions/GuildScheduledEventCreate.js +1 -5
  30. package/src/client/actions/GuildScheduledEventDelete.js +1 -5
  31. package/src/client/actions/GuildScheduledEventUpdate.js +1 -6
  32. package/src/client/actions/GuildScheduledEventUserAdd.js +1 -6
  33. package/src/client/actions/GuildScheduledEventUserRemove.js +1 -6
  34. package/src/client/actions/GuildStickerCreate.js +1 -5
  35. package/src/client/actions/GuildStickerDelete.js +1 -5
  36. package/src/client/actions/GuildStickerUpdate.js +1 -6
  37. package/src/client/actions/GuildStickersUpdate.js +4 -4
  38. package/src/client/actions/GuildUpdate.js +1 -6
  39. package/src/client/actions/InteractionCreate.js +3 -7
  40. package/src/client/actions/InviteCreate.js +1 -7
  41. package/src/client/actions/InviteDelete.js +1 -7
  42. package/src/client/actions/MessageCreate.js +1 -5
  43. package/src/client/actions/MessageDelete.js +1 -5
  44. package/src/client/actions/MessageDeleteBulk.js +1 -6
  45. package/src/client/actions/MessageReactionAdd.js +5 -18
  46. package/src/client/actions/MessageReactionRemove.js +5 -16
  47. package/src/client/actions/MessageReactionRemoveAll.js +4 -9
  48. package/src/client/actions/MessageReactionRemoveEmoji.js +1 -5
  49. package/src/client/actions/PresenceUpdate.js +1 -6
  50. package/src/client/actions/StageInstanceCreate.js +1 -5
  51. package/src/client/actions/StageInstanceDelete.js +1 -5
  52. package/src/client/actions/StageInstanceUpdate.js +1 -6
  53. package/src/client/actions/ThreadCreate.js +1 -6
  54. package/src/client/actions/ThreadDelete.js +1 -5
  55. package/src/client/actions/ThreadListSync.js +2 -7
  56. package/src/client/actions/ThreadMemberUpdate.js +2 -7
  57. package/src/client/actions/ThreadMembersUpdate.js +2 -9
  58. package/src/client/actions/TypingStart.js +1 -5
  59. package/src/client/actions/UserUpdate.js +1 -8
  60. package/src/client/actions/VoiceStateUpdate.js +4 -9
  61. package/src/client/actions/WebhooksUpdate.js +1 -6
  62. package/src/client/voice/ClientVoiceManager.js +3 -13
  63. package/src/client/websocket/WebSocketManager.js +25 -117
  64. package/src/client/websocket/WebSocketShard.js +29 -116
  65. package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +2 -8
  66. package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -6
  67. package/src/client/websocket/handlers/GUILD_CREATE.js +3 -7
  68. package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +2 -16
  69. package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +1 -5
  70. package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -6
  71. package/src/client/websocket/handlers/RESUMED.js +1 -6
  72. package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -6
  73. package/src/errors/DJSError.js +3 -14
  74. package/src/errors/ErrorCodes.js +2 -164
  75. package/src/index.js +6 -6
  76. package/src/managers/ApplicationCommandManager.js +14 -130
  77. package/src/managers/ApplicationCommandPermissionsManager.js +31 -202
  78. package/src/managers/AutoModerationRuleManager.js +17 -145
  79. package/src/managers/BaseGuildEmojiManager.js +7 -38
  80. package/src/managers/BaseManager.js +2 -10
  81. package/src/managers/CachedManager.js +3 -17
  82. package/src/managers/CategoryChannelChildManager.js +6 -48
  83. package/src/managers/ChannelManager.js +11 -52
  84. package/src/managers/DataManager.js +5 -27
  85. package/src/managers/GuildApplicationCommandManager.js +3 -12
  86. package/src/managers/GuildBanManager.js +16 -105
  87. package/src/managers/GuildChannelManager.js +31 -226
  88. package/src/managers/GuildEmojiManager.js +9 -65
  89. package/src/managers/GuildEmojiRoleManager.js +8 -47
  90. package/src/managers/GuildForumThreadManager.js +5 -39
  91. package/src/managers/GuildInviteManager.js +18 -117
  92. package/src/managers/GuildManager.js +14 -115
  93. package/src/managers/GuildMemberManager.js +38 -256
  94. package/src/managers/GuildMemberRoleManager.js +13 -76
  95. package/src/managers/GuildScheduledEventManager.js +25 -128
  96. package/src/managers/GuildStickerManager.js +16 -96
  97. package/src/managers/GuildTextThreadManager.js +4 -47
  98. package/src/managers/MessageManager.js +23 -137
  99. package/src/managers/PermissionOverwriteManager.js +10 -78
  100. package/src/managers/PresenceManager.js +6 -27
  101. package/src/managers/ReactionManager.js +7 -40
  102. package/src/managers/ReactionUserManager.js +6 -29
  103. package/src/managers/RoleManager.js +29 -177
  104. package/src/managers/StageInstanceManager.js +14 -77
  105. package/src/managers/ThreadManager.js +23 -113
  106. package/src/managers/ThreadMemberManager.js +20 -89
  107. package/src/managers/UserManager.js +13 -65
  108. package/src/managers/VoiceStateManager.js +3 -13
  109. package/src/sharding/Shard.js +42 -158
  110. package/src/sharding/ShardClientUtil.js +17 -101
  111. package/src/sharding/ShardingManager.js +34 -151
  112. package/src/structures/ActionRow.js +4 -21
  113. package/src/structures/ActionRowBuilder.js +3 -13
  114. package/src/structures/AnonymousGuild.js +10 -43
  115. package/src/structures/ApplicationCommand.js +54 -308
  116. package/src/structures/ApplicationRoleConnectionMetadata.js +7 -27
  117. package/src/structures/Attachment.js +16 -65
  118. package/src/structures/AttachmentBuilder.js +13 -58
  119. package/src/structures/AutoModerationActionExecution.js +16 -69
  120. package/src/structures/AutoModerationRule.js +32 -164
  121. package/src/structures/AutocompleteInteraction.js +10 -52
  122. package/src/structures/Base.js +2 -10
  123. package/src/structures/BaseChannel.js +16 -80
  124. package/src/structures/BaseGuild.js +13 -59
  125. package/src/structures/BaseGuildEmoji.js +5 -21
  126. package/src/structures/BaseGuildTextChannel.js +19 -100
  127. package/src/structures/BaseGuildVoiceChannel.js +21 -110
  128. package/src/structures/BaseInteraction.js +40 -196
  129. package/src/structures/BaseSelectMenuComponent.js +6 -29
  130. package/src/structures/ButtonBuilder.js +4 -18
  131. package/src/structures/ButtonComponent.js +7 -34
  132. package/src/structures/ButtonInteraction.js +1 -4
  133. package/src/structures/CategoryChannel.js +5 -30
  134. package/src/structures/ChannelSelectMenuBuilder.js +3 -13
  135. package/src/structures/ChannelSelectMenuComponent.js +2 -9
  136. package/src/structures/ChannelSelectMenuInteraction.js +3 -12
  137. package/src/structures/ChatInputCommandInteraction.js +3 -13
  138. package/src/structures/ClientApplication.js +20 -83
  139. package/src/structures/ClientPresence.js +5 -20
  140. package/src/structures/ClientUser.js +21 -118
  141. package/src/structures/CommandInteraction.js +21 -96
  142. package/src/structures/CommandInteractionOptionResolver.js +26 -147
  143. package/src/structures/Component.js +5 -21
  144. package/src/structures/ContextMenuCommandInteraction.js +4 -18
  145. package/src/structures/DMChannel.js +17 -52
  146. package/src/structures/DirectoryChannel.js +4 -16
  147. package/src/structures/Embed.js +21 -107
  148. package/src/structures/EmbedBuilder.js +4 -18
  149. package/src/structures/Emoji.js +12 -60
  150. package/src/structures/ForumChannel.js +30 -140
  151. package/src/structures/Guild.js +117 -697
  152. package/src/structures/GuildAuditLogs.js +7 -32
  153. package/src/structures/GuildAuditLogsEntry.js +27 -135
  154. package/src/structures/GuildBan.js +6 -26
  155. package/src/structures/GuildChannel.js +36 -188
  156. package/src/structures/GuildEmoji.js +13 -67
  157. package/src/structures/GuildMember.js +47 -270
  158. package/src/structures/GuildPreview.js +19 -84
  159. package/src/structures/GuildPreviewEmoji.js +3 -13
  160. package/src/structures/GuildScheduledEvent.js +46 -250
  161. package/src/structures/GuildTemplate.js +24 -108
  162. package/src/structures/Integration.js +25 -103
  163. package/src/structures/IntegrationApplication.js +8 -32
  164. package/src/structures/InteractionCollector.js +22 -113
  165. package/src/structures/InteractionResponse.js +11 -46
  166. package/src/structures/InteractionWebhook.js +8 -33
  167. package/src/structures/Invite.js +27 -131
  168. package/src/structures/InviteGuild.js +2 -8
  169. package/src/structures/InviteStageInstance.js +9 -39
  170. package/src/structures/MentionableSelectMenuBuilder.js +3 -14
  171. package/src/structures/MentionableSelectMenuComponent.js +1 -4
  172. package/src/structures/MentionableSelectMenuInteraction.js +5 -20
  173. package/src/structures/Message.js +85 -460
  174. package/src/structures/MessageCollector.js +14 -70
  175. package/src/structures/MessageComponentInteraction.js +14 -57
  176. package/src/structures/MessageContextMenuCommandInteraction.js +2 -9
  177. package/src/structures/MessageMentions.js +25 -136
  178. package/src/structures/MessagePayload.js +24 -94
  179. package/src/structures/MessageReaction.js +13 -51
  180. package/src/structures/ModalBuilder.js +3 -13
  181. package/src/structures/ModalSubmitFields.js +5 -22
  182. package/src/structures/ModalSubmitInteraction.js +17 -61
  183. package/src/structures/NewsChannel.js +2 -16
  184. package/src/structures/OAuth2Guild.js +3 -12
  185. package/src/structures/PartialGroupDMChannel.js +7 -27
  186. package/src/structures/PermissionOverwrites.js +20 -99
  187. package/src/structures/Presence.js +45 -190
  188. package/src/structures/ReactionCollector.js +20 -108
  189. package/src/structures/ReactionEmoji.js +2 -10
  190. package/src/structures/Role.js +39 -261
  191. package/src/structures/RoleSelectMenuBuilder.js +3 -13
  192. package/src/structures/RoleSelectMenuComponent.js +1 -4
  193. package/src/structures/RoleSelectMenuInteraction.js +3 -12
  194. package/src/structures/SelectMenuBuilder.js +1 -4
  195. package/src/structures/SelectMenuComponent.js +1 -4
  196. package/src/structures/SelectMenuInteraction.js +1 -4
  197. package/src/structures/SelectMenuOptionBuilder.js +1 -4
  198. package/src/structures/StageChannel.js +12 -84
  199. package/src/structures/StageInstance.js +16 -87
  200. package/src/structures/Sticker.js +25 -124
  201. package/src/structures/StickerPack.js +12 -52
  202. package/src/structures/StringSelectMenuBuilder.js +6 -29
  203. package/src/structures/StringSelectMenuComponent.js +2 -9
  204. package/src/structures/StringSelectMenuInteraction.js +2 -8
  205. package/src/structures/StringSelectMenuOptionBuilder.js +4 -18
  206. package/src/structures/Team.js +11 -52
  207. package/src/structures/TeamMember.js +7 -33
  208. package/src/structures/TextChannel.js +3 -14
  209. package/src/structures/TextInputBuilder.js +3 -13
  210. package/src/structures/TextInputComponent.js +3 -14
  211. package/src/structures/ThreadChannel.js +59 -305
  212. package/src/structures/ThreadMember.js +12 -55
  213. package/src/structures/Typing.js +8 -35
  214. package/src/structures/User.js +29 -151
  215. package/src/structures/UserContextMenuCommandInteraction.js +3 -14
  216. package/src/structures/UserSelectMenuBuilder.js +3 -13
  217. package/src/structures/UserSelectMenuComponent.js +1 -4
  218. package/src/structures/UserSelectMenuInteraction.js +4 -16
  219. package/src/structures/VoiceChannel.js +8 -67
  220. package/src/structures/VoiceRegion.js +6 -23
  221. package/src/structures/VoiceState.js +28 -140
  222. package/src/structures/Webhook.js +37 -227
  223. package/src/structures/WelcomeChannel.js +7 -29
  224. package/src/structures/WelcomeScreen.js +5 -20
  225. package/src/structures/Widget.js +9 -40
  226. package/src/structures/WidgetMember.js +15 -61
  227. package/src/structures/interfaces/Application.js +10 -49
  228. package/src/structures/interfaces/Collector.js +34 -155
  229. package/src/structures/interfaces/InteractionResponses.js +25 -164
  230. package/src/structures/interfaces/TextBasedChannel.js +37 -232
  231. package/src/util/APITypes.js +183 -456
  232. package/src/util/ActivityFlagsBitField.js +3 -15
  233. package/src/util/ApplicationFlagsBitField.js +3 -15
  234. package/src/util/BitField.js +17 -82
  235. package/src/util/ChannelFlagsBitField.js +7 -30
  236. package/src/util/Channels.js +5 -35
  237. package/src/util/Colors.js +3 -38
  238. package/src/util/Components.js +21 -75
  239. package/src/util/Constants.js +17 -144
  240. package/src/util/DataResolver.js +20 -77
  241. package/src/util/Events.js +3 -81
  242. package/src/util/Formatters.js +58 -305
  243. package/src/util/GuildMemberFlagsBitField.js +7 -30
  244. package/src/util/IntentsBitField.js +4 -23
  245. package/src/util/LimitedCollection.js +4 -21
  246. package/src/util/MessageFlagsBitField.js +5 -21
  247. package/src/util/Options.js +24 -137
  248. package/src/util/Partials.js +3 -30
  249. package/src/util/PermissionsBitField.js +12 -67
  250. package/src/util/ShardEvents.js +3 -15
  251. package/src/util/Status.js +3 -17
  252. package/src/util/Sweepers.js +35 -184
  253. package/src/util/SystemChannelFlagsBitField.js +7 -32
  254. package/src/util/ThreadMemberFlagsBitField.js +5 -21
  255. package/src/util/Transformers.js +2 -11
  256. package/src/util/UserFlagsBitField.js +5 -21
  257. package/src/util/Util.js +30 -169
  258. package/src/util/WebSocketShardEvents.js +3 -14
@@ -1,165 +1,6 @@
1
1
  'use strict';
2
2
 
3
- /**
4
- * @typedef {Object} DiscordjsErrorCodes
5
-
6
- * @property {'ClientInvalidOption'} ClientInvalidOption
7
- * @property {'ClientInvalidProvidedShards'} ClientInvalidProvidedShards
8
- * @property {'ClientMissingIntents'} ClientMissingIntents
9
- * @property {'ClientNotReady'} ClientNotReady
10
-
11
- * @property {'TokenInvalid'} TokenInvalid
12
- * @property {'TokenMissing'} TokenMissing
13
- * @property {'ApplicationCommandPermissionsTokenMissing'} ApplicationCommandPermissionsTokenMissing
14
-
15
- * @property {'WSCloseRequested'} WSCloseRequested
16
- * <warn>This property is deprecated.</warn>
17
- * @property {'WSConnectionExists'} WSConnectionExists
18
- * <warn>This property is deprecated.</warn>
19
- * @property {'WSNotOpen'} WSNotOpen
20
- * <warn>This property is deprecated.</warn>
21
- * @property {'ManagerDestroyed'} ManagerDestroyed
22
-
23
- * @property {'BitFieldInvalid'} BitFieldInvalid
24
-
25
- * @property {'ShardingInvalid'} ShardingInvalid
26
- * <warn>This property is deprecated.</warn>
27
- * @property {'ShardingRequired'} ShardingRequired
28
- * <warn>This property is deprecated.</warn>
29
- * @property {'InvalidIntents'} InvalidIntents
30
- * <warn>This property is deprecated.</warn>
31
- * @property {'DisallowedIntents'} DisallowedIntents
32
- * <warn>This property is deprecated.</warn>
33
- * @property {'ShardingNoShards'} ShardingNoShards
34
- * @property {'ShardingInProcess'} ShardingInProcess
35
- * @property {'ShardingInvalidEvalBroadcast'} ShardingInvalidEvalBroadcast
36
- * @property {'ShardingShardNotFound'} ShardingShardNotFound
37
- * @property {'ShardingAlreadySpawned'} ShardingAlreadySpawned
38
- * @property {'ShardingProcessExists'} ShardingProcessExists
39
- * @property {'ShardingWorkerExists'} ShardingWorkerExists
40
- * @property {'ShardingReadyTimeout'} ShardingReadyTimeout
41
- * @property {'ShardingReadyDisconnected'} ShardingReadyDisconnected
42
- * @property {'ShardingReadyDied'} ShardingReadyDied
43
- * @property {'ShardingNoChildExists'} ShardingNoChildExists
44
- * @property {'ShardingShardMiscalculation'} ShardingShardMiscalculation
45
-
46
- * @property {'ColorRange'} ColorRange
47
- * @property {'ColorConvert'} ColorConvert
48
-
49
- * @property {'InviteOptionsMissingChannel'} InviteOptionsMissingChannel
50
-
51
- * @property {'ButtonLabel'} ButtonLabel
52
- * @property {'ButtonURL'} ButtonURL
53
- * @property {'ButtonCustomId'} ButtonCustomId
54
-
55
- * @property {'SelectMenuCustomId'} SelectMenuCustomId
56
- * @property {'SelectMenuPlaceholder'} SelectMenuPlaceholder
57
- * @property {'SelectOptionLabel'} SelectOptionLabel
58
- * @property {'SelectOptionValue'} SelectOptionValue
59
- * @property {'SelectOptionDescription'} SelectOptionDescription
60
3
 
61
- * @property {'InteractionCollectorError'} InteractionCollectorError
62
-
63
- * @property {'FileNotFound'} FileNotFound
64
-
65
- * @property {'UserBannerNotFetched'} UserBannerNotFetched
66
- * @property {'UserNoDMChannel'} UserNoDMChannel
67
-
68
- * @property {'VoiceNotStageChannel'} VoiceNotStageChannel
69
-
70
- * @property {'VoiceStateNotOwn'} VoiceStateNotOwn
71
- * @property {'VoiceStateInvalidType'} VoiceStateInvalidType
72
-
73
- * @property {'ReqResourceType'} ReqResourceType
74
-
75
- * @property {'ImageFormat'} ImageFormat
76
- * @property {'ImageSize'} ImageSize
77
-
78
- * @property {'MessageBulkDeleteType'} MessageBulkDeleteType
79
- * @property {'MessageNonceType'} MessageNonceType
80
- * @property {'MessageContentType'} MessageContentType
81
-
82
- * @property {'SplitMaxLen'} SplitMaxLen
83
-
84
- * @property {'BanResolveId'} BanResolveId
85
- * @property {'FetchBanResolveId'} FetchBanResolveId
86
-
87
- * @property {'PruneDaysType'} PruneDaysType
88
-
89
- * @property {'GuildChannelResolve'} GuildChannelResolve
90
- * @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve
91
- * @property {'GuildChannelOrphan'} GuildChannelOrphan
92
- * @property {'GuildChannelUnowned'} GuildChannelUnowned
93
- * @property {'GuildOwned'} GuildOwned
94
- * @property {'GuildMembersTimeout'} GuildMembersTimeout
95
- * @property {'GuildUncachedMe'} GuildUncachedMe
96
- * @property {'ChannelNotCached'} ChannelNotCached
97
- * @property {'StageChannelResolve'} StageChannelResolve
98
- * @property {'GuildScheduledEventResolve'} GuildScheduledEventResolve
99
- * @property {'FetchOwnerId'} FetchOwnerId
100
-
101
- * @property {'InvalidType'} InvalidType
102
- * @property {'InvalidElement'} InvalidElement
103
-
104
- * @property {'MessageThreadParent'} MessageThreadParent
105
- * @property {'MessageExistingThread'} MessageExistingThread
106
- * @property {'ThreadInvitableType'} ThreadInvitableType
107
-
108
- * @property {'WebhookMessage'} WebhookMessage
109
- * @property {'WebhookTokenUnavailable'} WebhookTokenUnavailable
110
- * @property {'WebhookURLInvalid'} WebhookURLInvalid
111
- * @property {'WebhookApplication'} WebhookApplication
112
- * @property {'MessageReferenceMissing'} MessageReferenceMissing
113
-
114
- * @property {'EmojiType'} EmojiType
115
- * @property {'EmojiManaged'} EmojiManaged
116
- * @property {'MissingManageGuildExpressionsPermission'} MissingManageGuildExpressionsPermission
117
- * @property {'MissingManageEmojisAndStickersPermission'} MissingManageEmojisAndStickersPermission
118
- * <warn>This property is deprecated. Use `MissingManageGuildExpressionsPermission` instead.</warn>
119
- *
120
- * @property {'NotGuildSticker'} NotGuildSticker
121
-
122
- * @property {'ReactionResolveUser'} ReactionResolveUser
123
-
124
- * @property {'VanityURL'} VanityURL
125
-
126
- * @property {'InviteResolveCode'} InviteResolveCode
127
-
128
- * @property {'InviteNotFound'} InviteNotFound
129
-
130
- * @property {'DeleteGroupDMChannel'} DeleteGroupDMChannel
131
- * @property {'FetchGroupDMChannel'} FetchGroupDMChannel
132
-
133
- * @property {'MemberFetchNonceLength'} MemberFetchNonceLength
134
-
135
- * @property {'GlobalCommandPermissions'} GlobalCommandPermissions
136
- * @property {'GuildUncachedEntityResolve'} GuildUncachedEntityResolve
137
-
138
- * @property {'InteractionAlreadyReplied'} InteractionAlreadyReplied
139
- * @property {'InteractionNotReplied'} InteractionNotReplied
140
- * @property {'InteractionEphemeralReplied'} InteractionEphemeralReplied
141
- * <warn>This property is deprecated.</warn>
142
-
143
- * @property {'CommandInteractionOptionNotFound'} CommandInteractionOptionNotFound
144
- * @property {'CommandInteractionOptionType'} CommandInteractionOptionType
145
- * @property {'CommandInteractionOptionEmpty'} CommandInteractionOptionEmpty
146
- * @property {'CommandInteractionOptionNoSubcommand'} CommandInteractionOptionNoSubcommand
147
- * @property {'CommandInteractionOptionNoSubcommandGroup'} CommandInteractionOptionNoSubcommandGroup
148
- * @property {'CommandInteractionOptionInvalidChannelType'} CommandInteractionOptionInvalidChannelType
149
- * @property {'AutocompleteInteractionOptionNoFocusedOption'} AutocompleteInteractionOptionNoFocusedOption
150
-
151
- * @property {'ModalSubmitInteractionFieldNotFound'} ModalSubmitInteractionFieldNotFound
152
- * @property {'ModalSubmitInteractionFieldType'} ModalSubmitInteractionFieldType
153
-
154
- * @property {'InvalidMissingScopes'} InvalidMissingScopes
155
- * @property {'InvalidScopesWithPermissions'} InvalidScopesWithPermissions
156
-
157
- * @property {'NotImplemented'} NotImplemented
158
-
159
- * @property {'GuildForumMessageRequired'} GuildForumMessageRequired
160
-
161
- * @property {'SweepFilterReturn'} SweepFilterReturn
162
- */
163
4
 
164
5
  const keys = [
165
6
  'ClientInvalidOption',
@@ -311,9 +152,6 @@ const keys = [
311
152
  'GuildForumMessageRequired',
312
153
  ];
313
154
 
314
- // JSDoc for IntelliSense purposes
315
- /**
316
- * @type {DiscordjsErrorCodes}
317
- * @ignore
318
- */
155
+
156
+
319
157
  module.exports = Object.fromEntries(keys.map(key => [key, key]));
package/src/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { __exportStar } = require('tslib');
4
4
 
5
- // "Root" classes (starting points)
5
+
6
6
  exports.BaseClient = require('./client/BaseClient');
7
7
  exports.Client = require('./client/Client');
8
8
  exports.Shard = require('./sharding/Shard');
@@ -10,13 +10,13 @@ exports.ShardClientUtil = require('./sharding/ShardClientUtil');
10
10
  exports.ShardingManager = require('./sharding/ShardingManager');
11
11
  exports.WebhookClient = require('./client/WebhookClient');
12
12
 
13
- // Errors
13
+
14
14
  exports.DiscordjsError = require('./errors/DJSError').DiscordjsError;
15
15
  exports.DiscordjsTypeError = require('./errors/DJSError').DiscordjsTypeError;
16
16
  exports.DiscordjsRangeError = require('./errors/DJSError').DiscordjsRangeError;
17
17
  exports.DiscordjsErrorCodes = require('./errors/ErrorCodes');
18
18
 
19
- // Utilities
19
+
20
20
  exports.ActivityFlagsBitField = require('./util/ActivityFlagsBitField');
21
21
  exports.ApplicationFlagsBitField = require('./util/ApplicationFlagsBitField');
22
22
  exports.BaseManager = require('./managers/BaseManager');
@@ -46,7 +46,7 @@ __exportStar(require('./util/Util.js'), exports);
46
46
  exports.WebSocketShardEvents = require('./util/WebSocketShardEvents');
47
47
  exports.version = require('../package.json').version;
48
48
 
49
- // Managers
49
+
50
50
  exports.ApplicationCommandManager = require('./managers/ApplicationCommandManager');
51
51
  exports.ApplicationCommandPermissionsManager = require('./managers/ApplicationCommandPermissionsManager');
52
52
  exports.AutoModerationRuleManager = require('./managers/AutoModerationRuleManager');
@@ -82,7 +82,7 @@ exports.VoiceStateManager = require('./managers/VoiceStateManager');
82
82
  exports.WebSocketManager = require('./client/websocket/WebSocketManager');
83
83
  exports.WebSocketShard = require('./client/websocket/WebSocketShard');
84
84
 
85
- // Structures
85
+
86
86
  exports.ActionRow = require('./structures/ActionRow');
87
87
  exports.ActionRowBuilder = require('./structures/ActionRowBuilder');
88
88
  exports.Activity = require('./structures/Presence').Activity;
@@ -204,7 +204,7 @@ exports.WidgetMember = require('./structures/WidgetMember');
204
204
  exports.WelcomeChannel = require('./structures/WelcomeChannel');
205
205
  exports.WelcomeScreen = require('./structures/WelcomeScreen');
206
206
 
207
- // External
207
+
208
208
  __exportStar(require('discord-api-types/v10'), exports);
209
209
  __exportStar(require('@discordjs/builders'), exports);
210
210
  __exportStar(require('@discordjs/formatters'), exports);
@@ -10,39 +10,22 @@ const { DiscordjsTypeError, ErrorCodes } = require('../errors');
10
10
  const ApplicationCommand = require('../structures/ApplicationCommand');
11
11
  const PermissionsBitField = require('../util/PermissionsBitField');
12
12
 
13
- /**
14
- * Manages API methods for application commands and stores their cache.
15
- * @extends {CachedManager}
16
- */
13
+
17
14
  class ApplicationCommandManager extends CachedManager {
18
15
  constructor(client, iterable) {
19
16
  super(client, ApplicationCommand, iterable);
20
17
 
21
- /**
22
- * The manager for permissions of arbitrary commands on arbitrary guilds
23
- * @type {ApplicationCommandPermissionsManager}
24
- */
18
+
25
19
  this.permissions = new ApplicationCommandPermissionsManager(this);
26
20
  }
27
21
 
28
- /**
29
- * The cache of this manager
30
- * @type {Collection<Snowflake, ApplicationCommand>}
31
- * @name ApplicationCommandManager#cache
32
- */
22
+
33
23
 
34
24
  _add(data, cache, guildId) {
35
25
  return super._add(data, cache, { extras: [this.guild, guildId] });
36
26
  }
37
27
 
38
- /**
39
- * The APIRouter path to the commands
40
- * @param {Snowflake} [options.id] The application command's id
41
- * @param {Snowflake} [options.guildId] The guild's id to use in the path,
42
- * ignored when using a {@link GuildApplicationCommandManager}
43
- * @returns {string}
44
- * @private
45
- */
28
+
46
29
  commandPath({ id, guildId } = {}) {
47
30
  if (this.guild ?? guildId) {
48
31
  if (id) {
@@ -59,49 +42,15 @@ class ApplicationCommandManager extends CachedManager {
59
42
  return Routes.applicationCommands(this.client.application.id);
60
43
  }
61
44
 
62
- /**
63
- * Data that resolves to give an ApplicationCommand object. This can be:
64
- * * An ApplicationCommand object
65
- * * A Snowflake
66
- * @typedef {ApplicationCommand|Snowflake} ApplicationCommandResolvable
67
- */
45
+
68
46
 
69
- /**
70
- * Data that resolves to the data of an ApplicationCommand
71
- * @typedef {ApplicationCommandData|APIApplicationCommand} ApplicationCommandDataResolvable
72
- */
47
+
73
48
 
74
- /**
75
- * Options used to fetch data from Discord
76
- * @typedef {Object} BaseFetchOptions
77
- * @property {boolean} [cache=true] Whether to cache the fetched data if it wasn't already
78
- * @property {boolean} [force=false] Whether to skip the cache check and request the API
79
- */
49
+
80
50
 
81
- /**
82
- * Options used to fetch Application Commands from Discord
83
- * @typedef {BaseFetchOptions} FetchApplicationCommandOptions
84
- * @property {Snowflake} [guildId] The guild's id to fetch commands for, for when the guild is not cached
85
- * @property {LocaleString} [locale] The locale to use when fetching this command
86
- * @property {boolean} [withLocalizations] Whether to fetch all localization data
87
- */
51
+
88
52
 
89
- /**
90
- * Obtains one or multiple application commands from Discord, or the cache if it's already available.
91
- * @param {Snowflake} [id] The application command's id
92
- * @param {FetchApplicationCommandOptions} [options] Additional options for this fetch
93
- * @returns {Promise<ApplicationCommand|Collection<Snowflake, ApplicationCommand>>}
94
- * @example
95
- * // Fetch a single command
96
- * client.application.commands.fetch('123456789012345678')
97
- * .then(command => console.log(`Fetched command ${command.name}`))
98
- * .catch(console.error);
99
- * @example
100
- * // Fetch all commands
101
- * guild.commands.fetch()
102
- * .then(commands => console.log(`Fetched ${commands.size} commands`))
103
- * .catch(console.error);
104
- */
53
+
105
54
  async fetch(id, { guildId, cache = true, force = false, locale, withLocalizations } = {}) {
106
55
  if (typeof id === 'object') {
107
56
  ({ guildId, cache = true, locale, withLocalizations } = id);
@@ -123,21 +72,7 @@ class ApplicationCommandManager extends CachedManager {
123
72
  return data.reduce((coll, command) => coll.set(command.id, this._add(command, cache, guildId)), new Collection());
124
73
  }
125
74
 
126
- /**
127
- * Creates an application command.
128
- * @param {ApplicationCommandDataResolvable} command The command
129
- * @param {Snowflake} [guildId] The guild's id to create this command in,
130
- * ignored when using a {@link GuildApplicationCommandManager}
131
- * @returns {Promise<ApplicationCommand>}
132
- * @example
133
- * // Create a new command
134
- * client.application.commands.create({
135
- * name: 'test',
136
- * description: 'A test command',
137
- * })
138
- * .then(console.log)
139
- * .catch(console.error);
140
- */
75
+
141
76
  async create(command, guildId) {
142
77
  const data = await this.client.rest.post(this.commandPath({ guildId }), {
143
78
  body: this.constructor.transformCommand(command),
@@ -145,28 +80,7 @@ class ApplicationCommandManager extends CachedManager {
145
80
  return this._add(data, true, guildId);
146
81
  }
147
82
 
148
- /**
149
- * Sets all the commands for this application or guild.
150
- * @param {ApplicationCommandDataResolvable[]} commands The commands
151
- * @param {Snowflake} [guildId] The guild's id to create the commands in,
152
- * ignored when using a {@link GuildApplicationCommandManager}
153
- * @returns {Promise<Collection<Snowflake, ApplicationCommand>>}
154
- * @example
155
- * // Set all commands to just this one
156
- * client.application.commands.set([
157
- * {
158
- * name: 'test',
159
- * description: 'A test command',
160
- * },
161
- * ])
162
- * .then(console.log)
163
- * .catch(console.error);
164
- * @example
165
- * // Remove all commands
166
- * guild.commands.set([])
167
- * .then(console.log)
168
- * .catch(console.error);
169
- */
83
+
170
84
  async set(commands, guildId) {
171
85
  const data = await this.client.rest.put(this.commandPath({ guildId }), {
172
86
  body: commands.map(c => this.constructor.transformCommand(c)),
@@ -174,21 +88,7 @@ class ApplicationCommandManager extends CachedManager {
174
88
  return data.reduce((coll, command) => coll.set(command.id, this._add(command, true, guildId)), new Collection());
175
89
  }
176
90
 
177
- /**
178
- * Edits an application command.
179
- * @param {ApplicationCommandResolvable} command The command to edit
180
- * @param {Partial<ApplicationCommandDataResolvable>} data The data to update the command with
181
- * @param {Snowflake} [guildId] The guild's id where the command registered,
182
- * ignored when using a {@link GuildApplicationCommandManager}
183
- * @returns {Promise<ApplicationCommand>}
184
- * @example
185
- * // Edit an existing command
186
- * client.application.commands.edit('123456789012345678', {
187
- * description: 'New description',
188
- * })
189
- * .then(console.log)
190
- * .catch(console.error);
191
- */
91
+
192
92
  async edit(command, data, guildId) {
193
93
  const id = this.resolveId(command);
194
94
  if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'command', 'ApplicationCommandResolvable');
@@ -199,18 +99,7 @@ class ApplicationCommandManager extends CachedManager {
199
99
  return this._add(patched, true, guildId);
200
100
  }
201
101
 
202
- /**
203
- * Deletes an application command.
204
- * @param {ApplicationCommandResolvable} command The command to delete
205
- * @param {Snowflake} [guildId] The guild's id where the command is registered,
206
- * ignored when using a {@link GuildApplicationCommandManager}
207
- * @returns {Promise<?ApplicationCommand>}
208
- * @example
209
- * // Delete a command
210
- * guild.commands.delete('123456789012345678')
211
- * .then(console.log)
212
- * .catch(console.error);
213
- */
102
+
214
103
  async delete(command, guildId) {
215
104
  const id = this.resolveId(command);
216
105
  if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'command', 'ApplicationCommandResolvable');
@@ -222,12 +111,7 @@ class ApplicationCommandManager extends CachedManager {
222
111
  return cached ?? null;
223
112
  }
224
113
 
225
- /**
226
- * Transforms an {@link ApplicationCommandData} object into something that can be used with the API.
227
- * @param {ApplicationCommandDataResolvable} command The command to transform
228
- * @returns {APIApplicationCommand}
229
- * @private
230
- */
114
+
231
115
  static transformCommand(command) {
232
116
  if (isJSONEncodable(command)) return command.toJSON();
233
117