@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
@@ -2,88 +2,47 @@
2
2
 
3
3
  const { DiscordjsRangeError, ErrorCodes } = require('../errors');
4
4
 
5
- /**
6
- * Data structure that makes it easy to interact with a bitfield.
7
- */
5
+
8
6
  class BitField {
9
- /**
10
- * Numeric bitfield flags.
11
- * <info>Defined in extension classes</info>
12
- * @type {Object}
13
- * @memberof BitField
14
- * @abstract
15
- */
7
+
16
8
  static Flags = {};
17
9
 
18
- /**
19
- * @type {number|bigint}
20
- * @memberof BitField
21
- * @private
22
- */
10
+
23
11
  static DefaultBit = 0;
24
12
 
25
- /**
26
- * @param {BitFieldResolvable} [bits=this.constructor.DefaultBit] Bit(s) to read from
27
- */
13
+
28
14
  constructor(bits = this.constructor.DefaultBit) {
29
- /**
30
- * Bitfield of the packed bits
31
- * @type {number|bigint}
32
- */
15
+
33
16
  this.bitfield = this.constructor.resolve(bits);
34
17
  }
35
18
 
36
- /**
37
- * Checks whether the bitfield has a bit, or any of multiple bits.
38
- * @param {BitFieldResolvable} bit Bit(s) to check for
39
- * @returns {boolean}
40
- */
19
+
41
20
  any(bit) {
42
21
  return (this.bitfield & this.constructor.resolve(bit)) !== this.constructor.DefaultBit;
43
22
  }
44
23
 
45
- /**
46
- * Checks if this bitfield equals another
47
- * @param {BitFieldResolvable} bit Bit(s) to check for
48
- * @returns {boolean}
49
- */
24
+
50
25
  equals(bit) {
51
26
  return this.bitfield === this.constructor.resolve(bit);
52
27
  }
53
28
 
54
- /**
55
- * Checks whether the bitfield has a bit, or multiple bits.
56
- * @param {BitFieldResolvable} bit Bit(s) to check for
57
- * @returns {boolean}
58
- */
29
+
59
30
  has(bit) {
60
31
  bit = this.constructor.resolve(bit);
61
32
  return (this.bitfield & bit) === bit;
62
33
  }
63
34
 
64
- /**
65
- * Gets all given bits that are missing from the bitfield.
66
- * @param {BitFieldResolvable} bits Bit(s) to check for
67
- * @param {...*} hasParams Additional parameters for the has method, if any
68
- * @returns {string[]}
69
- */
35
+
70
36
  missing(bits, ...hasParams) {
71
37
  return new this.constructor(bits).remove(this).toArray(...hasParams);
72
38
  }
73
39
 
74
- /**
75
- * Freezes these bits, making them immutable.
76
- * @returns {Readonly<BitField>}
77
- */
40
+
78
41
  freeze() {
79
42
  return Object.freeze(this);
80
43
  }
81
44
 
82
- /**
83
- * Adds bits to these ones.
84
- * @param {...BitFieldResolvable} [bits] Bits to add
85
- * @returns {BitField} These bits or new BitField if the instance is frozen.
86
- */
45
+
87
46
  add(...bits) {
88
47
  let total = this.constructor.DefaultBit;
89
48
  for (const bit of bits) {
@@ -94,11 +53,7 @@ class BitField {
94
53
  return this;
95
54
  }
96
55
 
97
- /**
98
- * Removes bits from these.
99
- * @param {...BitFieldResolvable} [bits] Bits to remove
100
- * @returns {BitField} These bits or new BitField if the instance is frozen.
101
- */
56
+
102
57
  remove(...bits) {
103
58
  let total = this.constructor.DefaultBit;
104
59
  for (const bit of bits) {
@@ -109,12 +64,7 @@ class BitField {
109
64
  return this;
110
65
  }
111
66
 
112
- /**
113
- * Gets an object mapping field names to a {@link boolean} indicating whether the
114
- * bit is available.
115
- * @param {...*} hasParams Additional parameters for the has method, if any
116
- * @returns {Object}
117
- */
67
+
118
68
  serialize(...hasParams) {
119
69
  const serialized = {};
120
70
  for (const [flag, bit] of Object.entries(this.constructor.Flags)) {
@@ -123,11 +73,7 @@ class BitField {
123
73
  return serialized;
124
74
  }
125
75
 
126
- /**
127
- * Gets an {@link Array} of bitfield names based on the bits available.
128
- * @param {...*} hasParams Additional parameters for the has method, if any
129
- * @returns {string[]}
130
- */
76
+
131
77
  toArray(...hasParams) {
132
78
  return [...this[Symbol.iterator](...hasParams)];
133
79
  }
@@ -146,20 +92,9 @@ class BitField {
146
92
  }
147
93
  }
148
94
 
149
- /**
150
- * Data that can be resolved to give a bitfield. This can be:
151
- * * A bit number (this can be a number literal or a value taken from {@link BitField.Flags})
152
- * * A string bit number
153
- * * An instance of BitField
154
- * * An Array of BitFieldResolvable
155
- * @typedef {number|string|bigint|BitField|BitFieldResolvable[]} BitFieldResolvable
156
- */
157
-
158
- /**
159
- * Resolves bitfields to their numeric form.
160
- * @param {BitFieldResolvable} [bit] bit(s) to resolve
161
- * @returns {number|bigint}
162
- */
95
+
96
+
97
+
163
98
  static resolve(bit) {
164
99
  const { DefaultBit } = this;
165
100
  if (typeof DefaultBit === typeof bit && bit >= DefaultBit) return bit;
@@ -3,39 +3,16 @@
3
3
  const { ChannelFlags } = require('discord-api-types/v10');
4
4
  const BitField = require('./BitField');
5
5
 
6
- /**
7
- * Data structure that makes it easy to interact with a {@link BaseChannel#flags} bitfield.
8
- * @extends {BitField}
9
- */
6
+
10
7
  class ChannelFlagsBitField extends BitField {
11
- /**
12
- * Numeric guild channel flags.
13
- * @type {ChannelFlags}
14
- * @memberof ChannelFlagsBitField
15
- */
8
+
16
9
  static Flags = ChannelFlags;
17
10
  }
18
11
 
19
- /**
20
- * @name ChannelFlagsBitField
21
- * @kind constructor
22
- * @memberof ChannelFlagsBitField
23
- * @param {BitFieldResolvable} [bits=0] Bit(s) to read from
24
- */
25
-
26
- /**
27
- * Bitfield of the packed bits
28
- * @type {number}
29
- * @name ChannelFlagsBitField#bitfield
30
- */
31
-
32
- /**
33
- * Data that can be resolved to give a channel flag bitfield. This can be:
34
- * * A string (see {@link ChannelFlagsBitField.Flags})
35
- * * A channel flag
36
- * * An instance of ChannelFlagsBitField
37
- * * An Array of ChannelFlagsResolvable
38
- * @typedef {string|number|ChannelFlagsBitField|ChannelFlagsResolvable[]} ChannelFlagsResolvable
39
- */
12
+
13
+
14
+
15
+
16
+
40
17
 
41
18
  module.exports = ChannelFlagsBitField;
@@ -14,15 +14,7 @@ const getDirectoryChannel = lazy(() => require('../structures/DirectoryChannel')
14
14
  const getPartialGroupDMChannel = lazy(() => require('../structures/PartialGroupDMChannel'));
15
15
  const getForumChannel = lazy(() => require('../structures/ForumChannel'));
16
16
 
17
- /**
18
- * Creates a discord.js channel from data received from the API.
19
- * @param {Client} client The client
20
- * @param {APIChannel} data The data of the channel to create
21
- * @param {Guild} [guild] The guild where this channel belongs
22
- * @param {Object} [extras] Extra information to supply for creating this channel
23
- * @returns {Channel} Any kind of channel.
24
- * @ignore
25
- */
17
+
26
18
  function createChannel(client, data, guild, { allowUnknownGuild } = {}) {
27
19
  let channel;
28
20
  if (!data.guild_id && !guild) {
@@ -76,12 +68,7 @@ function createChannel(client, data, guild, { allowUnknownGuild } = {}) {
76
68
  return channel;
77
69
  }
78
70
 
79
- /**
80
- * Transforms an API guild forum tag to camel-cased guild forum tag.
81
- * @param {APIGuildForumTag} tag The tag to transform
82
- * @returns {GuildForumTag}
83
- * @ignore
84
- */
71
+
85
72
  function transformAPIGuildForumTag(tag) {
86
73
  return {
87
74
  id: tag.id,
@@ -97,12 +84,7 @@ function transformAPIGuildForumTag(tag) {
97
84
  };
98
85
  }
99
86
 
100
- /**
101
- * Transforms a camel-cased guild forum tag to an API guild forum tag.
102
- * @param {GuildForumTag} tag The tag to transform
103
- * @returns {APIGuildForumTag}
104
- * @ignore
105
- */
87
+
106
88
  function transformGuildForumTag(tag) {
107
89
  return {
108
90
  id: tag.id,
@@ -113,13 +95,7 @@ function transformGuildForumTag(tag) {
113
95
  };
114
96
  }
115
97
 
116
- /**
117
- * Transforms an API guild forum default reaction object to a
118
- * camel-cased guild forum default reaction object.
119
- * @param {APIGuildForumDefaultReactionEmoji} defaultReaction The default reaction to transform
120
- * @returns {DefaultReactionEmoji}
121
- * @ignore
122
- */
98
+
123
99
  function transformAPIGuildDefaultReaction(defaultReaction) {
124
100
  return {
125
101
  id: defaultReaction.emoji_id,
@@ -127,13 +103,7 @@ function transformAPIGuildDefaultReaction(defaultReaction) {
127
103
  };
128
104
  }
129
105
 
130
- /**
131
- * Transforms a camel-cased guild forum default reaction object to an
132
- * API guild forum default reaction object.
133
- * @param {DefaultReactionEmoji} defaultReaction The default reaction to transform
134
- * @returns {APIGuildForumDefaultReactionEmoji}
135
- * @ignore
136
- */
106
+
137
107
  function transformGuildDefaultReaction(defaultReaction) {
138
108
  return {
139
109
  emoji_id: defaultReaction.id,
@@ -1,44 +1,9 @@
1
1
  'use strict';
2
2
 
3
- /**
4
- * @typedef {Object} Colors
5
- * @property {number} Default 0x000000 | rgb(0,0,0)
6
- * @property {number} White 0xFFFFFF | rgb(255,255,255)
7
- * @property {number} Aqua 0x1ABC9C | rgb(26,188,156)
8
- * @property {number} Green 0x57F287 | rgb(87,242,135)
9
- * @property {number} Blue 0x3498DB | rgb(52,152,219)
10
- * @property {number} Yellow 0xFEE75C | rgb(254,231,92)
11
- * @property {number} Purple 0x9B59B6 | rgb(155,89,182)
12
- * @property {number} LuminousVividPink 0xE91E63 | rgb(233,30,99)
13
- * @property {number} Fuchsia 0xEB459E | rgb(235,69,158)
14
- * @property {number} Gold 0xF1C40F | rgb(241,196,15)
15
- * @property {number} Orange 0xE67E22 | rgb(230,126,34)
16
- * @property {number} Red 0xED4245 | rgb(237,66,69)
17
- * @property {number} Grey 0x95A5A6 | rgb(149,165,166)
18
- * @property {number} Navy 0x34495E | rgb(52,73,94)
19
- * @property {number} DarkAqua 0x11806A | rgb(17,128,106)
20
- * @property {number} DarkGreen 0x1F8B4C | rgb(31,139,76)
21
- * @property {number} DarkBlue 0x206694 | rgb(32,102,148)
22
- * @property {number} DarkPurple 0x71368A | rgb(113,54,138)
23
- * @property {number} DarkVividPink 0xAD1457 | rgb(173,20,87)
24
- * @property {number} DarkGold 0xC27C0E | rgb(194,124,14)
25
- * @property {number} DarkOrange 0xA84300 | rgb(168,67,0)
26
- * @property {number} DarkRed 0x992D22 | rgb(153,45,34)
27
- * @property {number} DarkGrey 0x979C9F | rgb(151,156,159)
28
- * @property {number} DarkerGrey 0x7F8C8D | rgb(127,140,141)
29
- * @property {number} LightGrey 0xBCC0C0 | rgb(188,192,192)
30
- * @property {number} DarkNavy 0x2C3E50 | rgb(44,62,80)
31
- * @property {number} Blurple 0x5865F2 | rgb(88,101,242)
32
- * @property {number} Greyple 0x99AAb5 | rgb(153,170,181)
33
- * @property {number} DarkButNotBlack 0x2C2F33 | rgb(44,47,51)
34
- * @property {number} NotQuiteBlack 0x23272A | rgb(35,39,42)
35
- */
36
3
 
37
- // JSDoc for IntelliSense purposes
38
- /**
39
- * @type {Colors}
40
- * @ignore
41
- */
4
+
5
+
6
+
42
7
  module.exports = {
43
8
  Default: 0x000000,
44
9
  White: 0xffffff,
@@ -1,77 +1,27 @@
1
1
  'use strict';
2
2
 
3
- // This file contains the typedefs for camel-cased JSON data
3
+
4
4
  const { ComponentBuilder } = require('@discordjs/builders');
5
5
  const { ComponentType } = require('discord-api-types/v10');
6
- /**
7
- * @typedef {Object} BaseComponentData
8
- * @property {ComponentType} type The type of component
9
- */
10
-
11
- /**
12
- * @typedef {BaseComponentData} ActionRowData
13
- * @property {ComponentData[]} components The components in this action row
14
- */
15
-
16
- /**
17
- * @typedef {BaseComponentData} ButtonComponentData
18
- * @property {ButtonStyle} style The style of the button
19
- * @property {?boolean} disabled Whether this button is disabled
20
- * @property {string} label The label of this button
21
- * @property {?APIMessageComponentEmoji} emoji The emoji on this button
22
- * @property {?string} customId The custom id of the button
23
- * @property {?string} url The URL of the button
24
- */
25
-
26
- /**
27
- * @typedef {object} SelectMenuComponentOptionData
28
- * @property {string} label The label of the option
29
- * @property {string} value The value of the option
30
- * @property {?string} description The description of the option
31
- * @property {?APIMessageComponentEmoji} emoji The emoji on the option
32
- * @property {?boolean} default Whether this option is selected by default
33
- */
34
-
35
- /**
36
- * @typedef {BaseComponentData} SelectMenuComponentData
37
- * @property {string} customId The custom id of the select menu
38
- * @property {?boolean} disabled Whether the select menu is disabled or not
39
- * @property {?number} maxValues The maximum amount of options that can be selected
40
- * @property {?number} minValues The minimum amount of options that can be selected
41
- * @property {?SelectMenuComponentOptionData[]} options The options in this select menu
42
- * @property {?string} placeholder The placeholder of the select menu
43
- */
44
-
45
- /**
46
- * @typedef {ActionRowData|ButtonComponentData|SelectMenuComponentData} MessageComponentData
47
- */
48
-
49
- /**
50
- * @typedef {BaseComponentData} TextInputComponentData
51
- * @property {string} customId The custom id of the text input
52
- * @property {TextInputStyle} style The style of the text input
53
- * @property {string} label The text that appears on top of the text input field
54
- * @property {?number} minLength The minimum number of characters that can be entered in the text input
55
- * @property {?number} maxLength The maximum number of characters that can be entered in the text input
56
- * @property {?boolean} required Whether or not the text input is required or not
57
- * @property {?string} value The pre-filled text in the text input
58
- * @property {?string} placeholder Placeholder for the text input
59
- */
60
-
61
- /**
62
- * @typedef {ActionRowData|ButtonComponentData|SelectMenuComponentData|TextInputComponentData} ComponentData
63
- */
64
-
65
- /**
66
- * Any emoji data that can be used within a button
67
- * @typedef {APIMessageComponentEmoji|string} ComponentEmojiResolvable
68
- */
69
-
70
- /**
71
- * Transforms API data into a component
72
- * @param {APIMessageComponent|Component} data The data to create the component from
73
- * @returns {Component}
74
- */
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
75
25
  function createComponent(data) {
76
26
  if (data instanceof Component) {
77
27
  return data;
@@ -99,11 +49,7 @@ function createComponent(data) {
99
49
  }
100
50
  }
101
51
 
102
- /**
103
- * Transforms API data into a component builder
104
- * @param {APIMessageComponent|ComponentBuilder} data The data to create the component from
105
- * @returns {ComponentBuilder}
106
- */
52
+
107
53
  function createComponentBuilder(data) {
108
54
  if (data instanceof ComponentBuilder) {
109
55
  return data;
@@ -2,31 +2,10 @@
2
2
 
3
3
  const { ChannelType, MessageType, ComponentType, ImageFormat, StickerFormatType } = require('discord-api-types/v10');
4
4
 
5
- /**
6
- * Max bulk deletable message age
7
- * @typedef {number} MaxBulkDeletableMessageAge
8
- */
5
+
9
6
  exports.MaxBulkDeletableMessageAge = 1_209_600_000;
10
7
 
11
- /**
12
- * The name of an item to be swept in Sweepers
13
- * * `autoModerationRules`
14
- * * `applicationCommands` - both global and guild commands
15
- * * `bans`
16
- * * `emojis`
17
- * * `invites` - accepts the `lifetime` property, using it will sweep based on expires timestamp
18
- * * `guildMembers`
19
- * * `messages` - accepts the `lifetime` property, using it will sweep based on edited or created timestamp
20
- * * `presences`
21
- * * `reactions`
22
- * * `stageInstances`
23
- * * `stickers`
24
- * * `threadMembers`
25
- * * `threads` - accepts the `lifetime` property, using it will sweep archived threads based on archived timestamp
26
- * * `users`
27
- * * `voiceStates`
28
- * @typedef {string} SweeperKey
29
- */
8
+
30
9
  exports.SweeperKeys = [
31
10
  'autoModerationRules',
32
11
  'applicationCommands',
@@ -45,14 +24,7 @@ exports.SweeperKeys = [
45
24
  'voiceStates',
46
25
  ];
47
26
 
48
- /**
49
- * The types of messages that are not `System`. The available types are:
50
- * * {@link MessageType.Default}
51
- * * {@link MessageType.Reply}
52
- * * {@link MessageType.ChatInputCommand}
53
- * * {@link MessageType.ContextMenuCommand}
54
- * @typedef {MessageType[]} NonSystemMessageTypes
55
- */
27
+
56
28
  exports.NonSystemMessageTypes = [
57
29
  MessageType.Default,
58
30
  MessageType.Reply,
@@ -60,27 +32,9 @@ exports.NonSystemMessageTypes = [
60
32
  MessageType.ContextMenuCommand,
61
33
  ];
62
34
 
63
- /**
64
- * The guild channels that are text-based.
65
- * * TextChannel
66
- * * NewsChannel
67
- * * ThreadChannel
68
- * * VoiceChannel
69
- * * StageChannel
70
- * @typedef {TextChannel|NewsChannel|ThreadChannel|VoiceChannel|StageChannel} GuildTextBasedChannel
71
- */
72
-
73
- /**
74
- * The types of guild channels that are text-based. The available types are:
75
- * * {@link ChannelType.GuildText}
76
- * * {@link ChannelType.GuildAnnouncement}
77
- * * {@link ChannelType.AnnouncementThread}
78
- * * {@link ChannelType.PublicThread}
79
- * * {@link ChannelType.PrivateThread}
80
- * * {@link ChannelType.GuildVoice}
81
- * * {@link ChannelType.GuildStageVoice}
82
- * @typedef {ChannelType[]} GuildTextBasedChannelTypes
83
- */
35
+
36
+
37
+
84
38
  exports.GuildTextBasedChannelTypes = [
85
39
  ChannelType.GuildText,
86
40
  ChannelType.GuildAnnouncement,
@@ -91,60 +45,20 @@ exports.GuildTextBasedChannelTypes = [
91
45
  ChannelType.GuildStageVoice,
92
46
  ];
93
47
 
94
- /**
95
- * The channels that are text-based.
96
- * * DMChannel
97
- * * GuildTextBasedChannel
98
- * @typedef {DMChannel|GuildTextBasedChannel} TextBasedChannels
99
- */
100
-
101
- /**
102
- * Data that resolves to give a text-based channel. This can be:
103
- * * A text-based channel
104
- * * A snowflake
105
- * @typedef {TextBasedChannels|Snowflake} TextBasedChannelsResolvable
106
- */
107
-
108
- /**
109
- * The types of channels that are text-based. The available types are:
110
- * * {@link ChannelType.DM}
111
- * * {@link ChannelType.GuildText}
112
- * * {@link ChannelType.GuildAnnouncement}
113
- * * {@link ChannelType.AnnouncementThread}
114
- * * {@link ChannelType.PublicThread}
115
- * * {@link ChannelType.PrivateThread}
116
- * * {@link ChannelType.GuildVoice}
117
- * * {@link ChannelType.GuildStageVoice}
118
- * @typedef {ChannelType[]} TextBasedChannelTypes
119
- */
48
+
49
+
50
+
51
+
52
+
120
53
  exports.TextBasedChannelTypes = [...exports.GuildTextBasedChannelTypes, ChannelType.DM];
121
54
 
122
- /**
123
- * The types of channels that are threads. The available types are:
124
- * * {@link ChannelType.AnnouncementThread}
125
- * * {@link ChannelType.PublicThread}
126
- * * {@link ChannelType.PrivateThread}
127
- * @typedef {ChannelType[]} ThreadChannelTypes
128
- */
55
+
129
56
  exports.ThreadChannelTypes = [ChannelType.AnnouncementThread, ChannelType.PublicThread, ChannelType.PrivateThread];
130
57
 
131
- /**
132
- * The types of channels that are voice-based. The available types are:
133
- * * {@link ChannelType.GuildVoice}
134
- * * {@link ChannelType.GuildStageVoice}
135
- * @typedef {ChannelType[]} VoiceBasedChannelTypes
136
- */
58
+
137
59
  exports.VoiceBasedChannelTypes = [ChannelType.GuildVoice, ChannelType.GuildStageVoice];
138
60
 
139
- /**
140
- * The types of select menus. The available types are:
141
- * * {@link ComponentType.StringSelect}
142
- * * {@link ComponentType.UserSelect}
143
- * * {@link ComponentType.RoleSelect}
144
- * * {@link ComponentType.MentionableSelect}
145
- * * {@link ComponentType.ChannelSelect}
146
- * @typedef {ComponentType[]} SelectMenuTypes
147
- */
61
+
148
62
  exports.SelectMenuTypes = [
149
63
  ComponentType.StringSelect,
150
64
  ComponentType.UserSelect,
@@ -153,31 +67,7 @@ exports.SelectMenuTypes = [
153
67
  ComponentType.ChannelSelect,
154
68
  ];
155
69
 
156
- /**
157
- * The types of messages that can be deleted. The available types are:
158
- * * {@link MessageType.AutoModerationAction}
159
- * * {@link MessageType.ChannelFollowAdd}
160
- * * {@link MessageType.ChannelPinnedMessage}
161
- * * {@link MessageType.ChatInputCommand}
162
- * * {@link MessageType.ContextMenuCommand}
163
- * * {@link MessageType.Default}
164
- * * {@link MessageType.GuildBoost}
165
- * * {@link MessageType.GuildBoostTier1}
166
- * * {@link MessageType.GuildBoostTier2}
167
- * * {@link MessageType.GuildBoostTier3}
168
- * * {@link MessageType.GuildInviteReminder}
169
- * * {@link MessageType.InteractionPremiumUpsell}
170
- * * {@link MessageType.Reply}
171
- * * {@link MessageType.RoleSubscriptionPurchase}
172
- * * {@link MessageType.StageEnd}
173
- * * {@link MessageType.StageRaiseHand}
174
- * * {@link MessageType.StageSpeaker}
175
- * * {@link MessageType.StageStart}
176
- * * {@link MessageType.StageTopic}
177
- * * {@link MessageType.ThreadCreated}
178
- * * {@link MessageType.UserJoin}
179
- * @typedef {MessageType[]} DeletableMessageTypes
180
- */
70
+
181
71
  exports.DeletableMessageTypes = [
182
72
  MessageType.AutoModerationAction,
183
73
  MessageType.ChannelFollowAdd,
@@ -202,14 +92,7 @@ exports.DeletableMessageTypes = [
202
92
  MessageType.UserJoin,
203
93
  ];
204
94
 
205
- /**
206
- * A mapping between sticker formats and their respective image formats.
207
- * * {@link StickerFormatType.PNG} -> {@link ImageFormat.PNG}
208
- * * {@link StickerFormatType.APNG} -> {@link ImageFormat.PNG}
209
- * * {@link StickerFormatType.Lottie} -> {@link ImageFormat.Lottie}
210
- * * {@link StickerFormatType.GIF} -> {@link ImageFormat.GIF}
211
- * @typedef {Object} StickerFormatExtensionMap
212
- */
95
+
213
96
  exports.StickerFormatExtensionMap = {
214
97
  [StickerFormatType.PNG]: ImageFormat.PNG,
215
98
  [StickerFormatType.APNG]: ImageFormat.PNG,
@@ -217,14 +100,4 @@ exports.StickerFormatExtensionMap = {
217
100
  [StickerFormatType.GIF]: ImageFormat.GIF,
218
101
  };
219
102
 
220
- /**
221
- * @typedef {Object} Constants Constants that can be used in an enum or object-like way.
222
- * @property {number} MaxBulkDeletableMessageAge Max bulk deletable message age
223
- * @property {SweeperKey[]} SweeperKeys The possible names of items that can be swept in sweepers
224
- * @property {NonSystemMessageTypes} NonSystemMessageTypes The types of messages that are not deemed a system type
225
- * @property {TextBasedChannelTypes} TextBasedChannelTypes The types of channels that are text-based
226
- * @property {ThreadChannelTypes} ThreadChannelTypes The types of channels that are threads
227
- * @property {VoiceBasedChannelTypes} VoiceBasedChannelTypes The types of channels that are voice-based
228
- * @property {SelectMenuTypes} SelectMenuTypes The types of components that are select menus.
229
- * @property {Object} StickerFormatExtensionMap A mapping between sticker formats and their respective image formats.
230
- */
103
+