lolka.js 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/README.md +6 -6
  2. package/package.json +21 -52
  3. package/src/client/BaseClient.js +120 -0
  4. package/src/client/Client.js +147 -446
  5. package/src/client/WebhookClient.js +103 -0
  6. package/src/client/actions/Action.js +3 -4
  7. package/src/client/actions/ActionsManager.js +65 -55
  8. package/src/client/actions/ApplicationCommandPermissionsUpdate.js +34 -0
  9. package/src/client/actions/AutoModerationActionExecution.js +26 -0
  10. package/src/client/actions/AutoModerationRuleCreate.js +27 -0
  11. package/src/client/actions/AutoModerationRuleDelete.js +31 -0
  12. package/src/client/actions/AutoModerationRuleUpdate.js +29 -0
  13. package/src/client/actions/ChannelCreate.js +3 -5
  14. package/src/client/actions/ChannelDelete.js +3 -4
  15. package/src/client/actions/ChannelUpdate.js +3 -3
  16. package/src/client/actions/EntitlementCreate.js +23 -0
  17. package/src/client/actions/EntitlementDelete.js +27 -0
  18. package/src/client/actions/EntitlementUpdate.js +25 -0
  19. package/src/client/actions/GuildAuditLogEntryCreate.js +29 -0
  20. package/src/client/actions/GuildBanAdd.js +20 -0
  21. package/src/client/actions/GuildBanRemove.js +25 -0
  22. package/src/client/actions/GuildChannelsPositionUpdate.js +3 -3
  23. package/src/client/actions/GuildDelete.js +44 -0
  24. package/src/client/actions/GuildEmojiCreate.js +3 -4
  25. package/src/client/actions/GuildEmojiDelete.js +3 -4
  26. package/src/client/actions/GuildEmojiUpdate.js +3 -4
  27. package/src/client/actions/GuildEmojisUpdate.js +2 -2
  28. package/src/client/actions/GuildIntegrationsUpdate.js +19 -0
  29. package/src/client/actions/GuildMemberRemove.js +6 -8
  30. package/src/client/actions/GuildMemberUpdate.js +6 -7
  31. package/src/client/actions/GuildRoleCreate.js +4 -6
  32. package/src/client/actions/GuildRoleDelete.js +3 -4
  33. package/src/client/actions/GuildRoleUpdate.js +39 -0
  34. package/src/client/actions/GuildRolesPositionUpdate.js +3 -3
  35. package/src/client/actions/GuildScheduledEventCreate.js +27 -0
  36. package/src/client/actions/GuildScheduledEventDelete.js +3 -4
  37. package/src/client/actions/GuildScheduledEventUpdate.js +30 -0
  38. package/src/client/actions/GuildScheduledEventUserAdd.js +3 -4
  39. package/src/client/actions/GuildScheduledEventUserRemove.js +3 -4
  40. package/src/client/actions/GuildSoundboardSoundDelete.js +3 -4
  41. package/src/client/actions/GuildStickerCreate.js +3 -4
  42. package/src/client/actions/GuildStickerDelete.js +3 -4
  43. package/src/client/actions/GuildStickerUpdate.js +3 -4
  44. package/src/client/actions/GuildStickersUpdate.js +2 -2
  45. package/src/client/actions/GuildUpdate.js +3 -4
  46. package/src/client/actions/InteractionCreate.js +15 -18
  47. package/src/client/actions/InviteCreate.js +27 -0
  48. package/src/client/actions/InviteDelete.js +29 -0
  49. package/src/client/actions/MessageCreate.js +3 -4
  50. package/src/client/actions/MessageDelete.js +3 -4
  51. package/src/client/actions/MessageDeleteBulk.js +3 -5
  52. package/src/client/actions/MessagePollVoteAdd.js +3 -4
  53. package/src/client/actions/MessagePollVoteRemove.js +3 -4
  54. package/src/client/actions/MessageReactionAdd.js +5 -7
  55. package/src/client/actions/MessageReactionRemove.js +4 -5
  56. package/src/client/actions/MessageReactionRemoveAll.js +4 -5
  57. package/src/client/actions/MessageReactionRemoveEmoji.js +4 -5
  58. package/src/client/actions/MessageUpdate.js +2 -2
  59. package/src/client/actions/PresenceUpdate.js +45 -0
  60. package/src/client/actions/StageInstanceCreate.js +3 -4
  61. package/src/client/actions/StageInstanceDelete.js +3 -4
  62. package/src/client/actions/StageInstanceUpdate.js +3 -4
  63. package/src/client/actions/ThreadCreate.js +3 -5
  64. package/src/client/actions/ThreadDelete.js +26 -0
  65. package/src/client/actions/ThreadListSync.js +60 -0
  66. package/src/client/actions/ThreadMemberUpdate.js +30 -0
  67. package/src/client/actions/ThreadMembersUpdate.js +3 -5
  68. package/src/client/actions/TypingStart.js +5 -6
  69. package/src/client/actions/UserUpdate.js +3 -4
  70. package/src/client/actions/VoiceStateUpdate.js +43 -0
  71. package/src/client/actions/WebhooksUpdate.js +37 -0
  72. package/src/client/voice/ClientVoiceManager.js +6 -10
  73. package/src/client/websocket/WebSocketManager.js +407 -0
  74. package/src/client/websocket/WebSocketShard.js +234 -0
  75. package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +2 -27
  76. package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +2 -15
  77. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +2 -16
  78. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +2 -19
  79. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +2 -18
  80. package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +1 -2
  81. package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -2
  82. package/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +2 -12
  83. package/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +2 -16
  84. package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +2 -14
  85. package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +2 -17
  86. package/src/client/websocket/handlers/GUILD_BAN_ADD.js +2 -13
  87. package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +2 -18
  88. package/src/client/websocket/handlers/GUILD_CREATE.js +5 -7
  89. package/src/client/websocket/handlers/GUILD_DELETE.js +2 -34
  90. package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +2 -13
  91. package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +1 -3
  92. package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +11 -9
  93. package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +2 -2
  94. package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +2 -2
  95. package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +2 -19
  96. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +2 -15
  97. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +2 -17
  98. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +1 -2
  99. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +1 -2
  100. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +1 -2
  101. package/src/client/websocket/handlers/INVITE_CREATE.js +2 -18
  102. package/src/client/websocket/handlers/INVITE_DELETE.js +2 -21
  103. package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -2
  104. package/src/client/websocket/handlers/PRESENCE_UPDATE.js +2 -40
  105. package/src/client/websocket/handlers/RATE_LIMITED.js +2 -1
  106. package/src/client/websocket/handlers/READY.js +5 -8
  107. package/src/client/websocket/handlers/RESUMED.js +14 -0
  108. package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +1 -2
  109. package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.js +1 -2
  110. package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.js +1 -2
  111. package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.js +1 -2
  112. package/src/client/websocket/handlers/THREAD_DELETE.js +2 -15
  113. package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +2 -49
  114. package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +2 -23
  115. package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -2
  116. package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +2 -3
  117. package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +3 -30
  118. package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +2 -35
  119. package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +2 -14
  120. package/src/client/websocket/handlers/index.js +75 -74
  121. package/src/errors/DJSError.js +7 -7
  122. package/src/errors/ErrorCodes.js +134 -58
  123. package/src/errors/Messages.js +143 -115
  124. package/src/errors/index.js +3 -5
  125. package/src/index.js +227 -234
  126. package/src/managers/ApplicationCommandManager.js +24 -60
  127. package/src/managers/ApplicationCommandPermissionsManager.js +33 -57
  128. package/src/managers/ApplicationEmojiManager.js +8 -18
  129. package/src/managers/AutoModerationRuleManager.js +6 -24
  130. package/src/managers/BaseGuildEmojiManager.js +85 -0
  131. package/src/managers/BaseManager.js +1 -3
  132. package/src/managers/CachedManager.js +8 -12
  133. package/src/managers/CategoryChannelChildManager.js +4 -10
  134. package/src/managers/ChannelManager.js +8 -70
  135. package/src/managers/DMMessageManager.js +2 -4
  136. package/src/managers/DataManager.js +5 -10
  137. package/src/managers/EntitlementManager.js +8 -19
  138. package/src/managers/GuildApplicationCommandManager.js +3 -6
  139. package/src/managers/GuildBanManager.js +52 -27
  140. package/src/managers/GuildChannelManager.js +54 -91
  141. package/src/managers/GuildEmojiManager.js +18 -108
  142. package/src/managers/GuildEmojiRoleManager.js +14 -24
  143. package/src/managers/GuildForumThreadManager.js +5 -10
  144. package/src/managers/GuildInviteManager.js +27 -51
  145. package/src/managers/GuildManager.js +185 -45
  146. package/src/managers/GuildMemberManager.js +105 -89
  147. package/src/managers/GuildMemberRoleManager.js +14 -29
  148. package/src/managers/GuildMessageManager.js +2 -20
  149. package/src/managers/GuildScheduledEventManager.js +13 -31
  150. package/src/managers/GuildSoundboardSoundManager.js +5 -17
  151. package/src/managers/GuildStickerManager.js +21 -34
  152. package/src/managers/GuildTextThreadManager.js +5 -9
  153. package/src/managers/MessageManager.js +77 -64
  154. package/src/managers/PartialGroupDMMessageManager.js +2 -4
  155. package/src/managers/PermissionOverwriteManager.js +15 -26
  156. package/src/managers/PollAnswerVoterManager.js +2 -14
  157. package/src/managers/PresenceManager.js +6 -11
  158. package/src/managers/ReactionManager.js +6 -13
  159. package/src/managers/ReactionUserManager.js +4 -11
  160. package/src/managers/RoleManager.js +74 -76
  161. package/src/managers/StageInstanceManager.js +8 -18
  162. package/src/managers/SubscriptionManager.js +4 -9
  163. package/src/managers/ThreadManager.js +13 -33
  164. package/src/managers/ThreadMemberManager.js +34 -27
  165. package/src/managers/UserManager.js +34 -32
  166. package/src/managers/VoiceStateManager.js +4 -9
  167. package/src/sharding/Shard.js +40 -64
  168. package/src/sharding/ShardClientUtil.js +60 -60
  169. package/src/sharding/ShardingManager.js +30 -89
  170. package/src/structures/ActionRow.js +18 -6
  171. package/src/structures/ActionRowBuilder.js +35 -0
  172. package/src/structures/AnonymousGuild.js +10 -14
  173. package/src/structures/ApplicationCommand.js +49 -67
  174. package/src/structures/ApplicationEmoji.js +5 -22
  175. package/src/structures/ApplicationRoleConnectionMetadata.js +0 -6
  176. package/src/structures/Attachment.js +7 -25
  177. package/src/structures/AttachmentBuilder.js +111 -0
  178. package/src/structures/AutoModerationActionExecution.js +2 -17
  179. package/src/structures/AutoModerationRule.js +17 -46
  180. package/src/structures/AutocompleteInteraction.js +4 -14
  181. package/src/structures/Base.js +2 -4
  182. package/src/structures/BaseChannel.js +4 -21
  183. package/src/structures/BaseGuild.js +7 -19
  184. package/src/structures/BaseGuildEmoji.js +13 -13
  185. package/src/structures/BaseGuildTextChannel.js +16 -45
  186. package/src/structures/BaseGuildVoiceChannel.js +12 -43
  187. package/src/structures/BaseInteraction.js +25 -54
  188. package/src/structures/BaseSelectMenuComponent.js +2 -8
  189. package/src/structures/ButtonBuilder.js +44 -0
  190. package/src/structures/ButtonComponent.js +2 -9
  191. package/src/structures/ButtonInteraction.js +2 -3
  192. package/src/structures/CategoryChannel.js +3 -8
  193. package/src/structures/ChannelSelectMenuBuilder.js +31 -0
  194. package/src/structures/ChannelSelectMenuComponent.js +2 -4
  195. package/src/structures/ChannelSelectMenuInteraction.js +2 -5
  196. package/src/structures/ChatInputCommandInteraction.js +4 -7
  197. package/src/structures/ClientApplication.js +12 -60
  198. package/src/structures/ClientPresence.js +10 -15
  199. package/src/structures/ClientUser.js +19 -36
  200. package/src/structures/CommandInteraction.js +7 -27
  201. package/src/structures/CommandInteractionOptionResolver.js +8 -36
  202. package/src/structures/Component.js +1 -7
  203. package/src/structures/ContainerComponent.js +3 -9
  204. package/src/structures/ContextMenuCommandInteraction.js +5 -9
  205. package/src/structures/DMChannel.js +15 -34
  206. package/src/structures/DirectoryChannel.js +2 -6
  207. package/src/structures/Embed.js +2 -19
  208. package/src/structures/EmbedBuilder.js +50 -0
  209. package/src/structures/Emoji.js +19 -19
  210. package/src/structures/Entitlement.js +2 -22
  211. package/src/structures/FileComponent.js +3 -7
  212. package/src/structures/ForumChannel.js +3 -6
  213. package/src/structures/Guild.js +131 -187
  214. package/src/structures/GuildAuditLogs.js +6 -12
  215. package/src/structures/GuildAuditLogsEntry.js +63 -88
  216. package/src/structures/GuildBan.js +3 -9
  217. package/src/structures/GuildChannel.js +33 -68
  218. package/src/structures/GuildEmoji.js +7 -19
  219. package/src/structures/GuildMember.js +58 -107
  220. package/src/structures/GuildOnboarding.js +2 -9
  221. package/src/structures/GuildOnboardingPrompt.js +2 -12
  222. package/src/structures/GuildOnboardingPromptOption.js +2 -12
  223. package/src/structures/GuildPreview.js +21 -30
  224. package/src/structures/GuildPreviewEmoji.js +2 -5
  225. package/src/structures/GuildScheduledEvent.js +19 -59
  226. package/src/structures/GuildTemplate.js +45 -24
  227. package/src/structures/Integration.js +7 -30
  228. package/src/structures/IntegrationApplication.js +12 -9
  229. package/src/structures/InteractionCallback.js +1 -10
  230. package/src/structures/InteractionCallbackResource.js +2 -7
  231. package/src/structures/InteractionCallbackResponse.js +3 -6
  232. package/src/structures/InteractionCollector.js +36 -23
  233. package/src/structures/InteractionResponse.js +102 -0
  234. package/src/structures/InteractionWebhook.js +6 -14
  235. package/src/structures/Invite.js +341 -0
  236. package/src/structures/InviteGuild.js +4 -6
  237. package/src/structures/InviteStageInstance.js +87 -0
  238. package/src/structures/LabelComponent.js +3 -3
  239. package/src/structures/MediaChannel.js +2 -3
  240. package/src/structures/MediaGalleryComponent.js +3 -6
  241. package/src/structures/MediaGalleryItem.js +2 -7
  242. package/src/structures/MentionableSelectMenuBuilder.js +32 -0
  243. package/src/structures/MentionableSelectMenuComponent.js +2 -3
  244. package/src/structures/MentionableSelectMenuInteraction.js +3 -8
  245. package/src/structures/Message.js +100 -169
  246. package/src/structures/MessageCollector.js +5 -16
  247. package/src/structures/MessageComponentInteraction.js +14 -34
  248. package/src/structures/MessageContextMenuCommandInteraction.js +2 -4
  249. package/src/structures/MessageMentions.js +4 -30
  250. package/src/structures/MessagePayload.js +90 -92
  251. package/src/structures/MessageReaction.js +17 -31
  252. package/src/structures/ModalBuilder.js +36 -0
  253. package/src/structures/{ModalComponentResolver.js → ModalSubmitFields.js} +31 -37
  254. package/src/structures/ModalSubmitInteraction.js +55 -54
  255. package/src/structures/NewsChannel.js +32 -0
  256. package/src/structures/OAuth2Guild.js +3 -6
  257. package/src/structures/PartialGroupDMChannel.js +11 -23
  258. package/src/structures/PermissionOverwrites.js +25 -47
  259. package/src/structures/Poll.js +4 -19
  260. package/src/structures/PollAnswer.js +29 -13
  261. package/src/structures/Presence.js +13 -57
  262. package/src/structures/PrimaryEntryPointCommandInteraction.js +2 -3
  263. package/src/structures/ReactionCollector.js +4 -21
  264. package/src/structures/ReactionEmoji.js +3 -5
  265. package/src/structures/Role.js +48 -65
  266. package/src/structures/RoleSelectMenuBuilder.js +31 -0
  267. package/src/structures/RoleSelectMenuComponent.js +2 -3
  268. package/src/structures/RoleSelectMenuInteraction.js +2 -5
  269. package/src/structures/SKU.js +2 -9
  270. package/src/structures/SectionComponent.js +3 -7
  271. package/src/structures/SelectMenuBuilder.js +26 -0
  272. package/src/structures/SelectMenuComponent.js +26 -0
  273. package/src/structures/SelectMenuInteraction.js +26 -0
  274. package/src/structures/SelectMenuOptionBuilder.js +26 -0
  275. package/src/structures/SeparatorComponent.js +2 -5
  276. package/src/structures/SoundboardSound.js +2 -18
  277. package/src/structures/StageChannel.js +4 -13
  278. package/src/structures/StageInstance.js +16 -19
  279. package/src/structures/Sticker.js +4 -28
  280. package/src/structures/StickerPack.js +4 -16
  281. package/src/structures/StringSelectMenuBuilder.js +79 -0
  282. package/src/structures/StringSelectMenuComponent.js +2 -4
  283. package/src/structures/StringSelectMenuInteraction.js +2 -4
  284. package/src/structures/StringSelectMenuOptionBuilder.js +49 -0
  285. package/src/structures/Subscription.js +1 -15
  286. package/src/structures/Team.js +7 -16
  287. package/src/structures/TeamMember.js +15 -9
  288. package/src/structures/TextChannel.js +3 -6
  289. package/src/structures/TextDisplayComponent.js +2 -4
  290. package/src/structures/TextInputBuilder.js +31 -0
  291. package/src/structures/TextInputComponent.js +2 -5
  292. package/src/structures/ThreadChannel.js +35 -85
  293. package/src/structures/ThreadMember.js +12 -17
  294. package/src/structures/ThreadOnlyChannel.js +15 -36
  295. package/src/structures/ThumbnailComponent.js +3 -8
  296. package/src/structures/Typing.js +2 -10
  297. package/src/structures/UnfurledMediaItem.js +2 -5
  298. package/src/structures/User.js +68 -60
  299. package/src/structures/UserContextMenuCommandInteraction.js +2 -5
  300. package/src/structures/UserSelectMenuBuilder.js +31 -0
  301. package/src/structures/UserSelectMenuComponent.js +2 -3
  302. package/src/structures/UserSelectMenuInteraction.js +3 -7
  303. package/src/structures/VoiceChannel.js +4 -11
  304. package/src/structures/VoiceChannelEffect.js +2 -12
  305. package/src/structures/VoiceRegion.js +2 -7
  306. package/src/structures/VoiceState.js +10 -36
  307. package/src/structures/Webhook.js +37 -65
  308. package/src/structures/WelcomeChannel.js +5 -12
  309. package/src/structures/WelcomeScreen.js +3 -8
  310. package/src/structures/Widget.js +3 -13
  311. package/src/structures/WidgetMember.js +2 -17
  312. package/src/structures/interfaces/Application.js +10 -19
  313. package/src/structures/interfaces/Collector.js +12 -45
  314. package/src/structures/interfaces/InteractionResponses.js +152 -43
  315. package/src/structures/interfaces/TextBasedChannel.js +99 -83
  316. package/src/util/APITypes.js +16 -30
  317. package/src/util/ActivityFlagsBitField.js +2 -5
  318. package/src/util/ApplicationFlagsBitField.js +6 -11
  319. package/src/util/AttachmentFlagsBitField.js +2 -5
  320. package/src/util/BitField.js +8 -27
  321. package/src/util/ChannelFlagsBitField.js +6 -11
  322. package/src/util/Channels.js +61 -73
  323. package/src/util/Colors.js +43 -43
  324. package/src/util/Components.js +82 -61
  325. package/src/util/Constants.js +124 -94
  326. package/src/util/DataResolver.js +17 -36
  327. package/src/util/Enums.js +1 -2
  328. package/src/util/Events.js +14 -3
  329. package/src/util/Formatters.js +413 -0
  330. package/src/util/GuildMemberFlagsBitField.js +5 -9
  331. package/src/util/IntentsBitField.js +6 -10
  332. package/src/util/InviteFlagsBitField.js +1 -2
  333. package/src/util/LimitedCollection.js +6 -13
  334. package/src/util/LolkaSnowflake.js +14 -1
  335. package/src/util/MessageFlagsBitField.js +6 -11
  336. package/src/util/Options.js +57 -35
  337. package/src/util/Partials.js +4 -5
  338. package/src/util/PermissionsBitField.js +8 -21
  339. package/src/util/RoleFlagsBitField.js +2 -5
  340. package/src/util/SKUFlagsBitField.js +1 -4
  341. package/src/util/ShardEvents.js +3 -1
  342. package/src/util/Status.js +21 -5
  343. package/src/util/Sweepers.js +13 -59
  344. package/src/util/SystemChannelFlagsBitField.js +6 -11
  345. package/src/util/ThreadMemberFlagsBitField.js +2 -6
  346. package/src/util/Transformers.js +18 -17
  347. package/src/util/UserFlagsBitField.js +2 -6
  348. package/src/util/Util.js +97 -148
  349. package/src/util/WebSocketShardEvents.js +25 -0
  350. package/typings/index.d.mts +2392 -1768
  351. package/typings/index.d.ts +2392 -1768
  352. package/typings/rawDataTypes.d.ts +211 -0
  353. package/src/structures/ActivityInstance.js +0 -52
  354. package/src/structures/ActivityLocation.js +0 -65
  355. package/src/structures/AnnouncementChannel.js +0 -29
  356. package/src/structures/AuthorizingIntegrationOwners.js +0 -64
  357. package/src/structures/BaseInvite.js +0 -187
  358. package/src/structures/GroupDMInvite.js +0 -37
  359. package/src/structures/GuildInvite.js +0 -223
  360. package/src/util/Invites.js +0 -31
@@ -1,19 +1,18 @@
1
1
  'use strict';
2
2
 
3
+ const { DiscordAPIError } = require('@discordjs/rest');
3
4
  const { lazy } = require('@discordjs/util');
4
- const { ChannelFlags, ChannelType, PermissionFlagsBits, Routes } = require('discord-api-types/v10');
5
- const { DiscordjsRangeError, ErrorCodes } = require('../errors/index.js');
6
- const { GuildMessageManager } = require('../managers/GuildMessageManager.js');
7
- const { ThreadMemberManager } = require('../managers/ThreadMemberManager.js');
8
- const { ChannelFlagsBitField } = require('../util/ChannelFlagsBitField.js');
9
- const { BaseChannel } = require('./BaseChannel.js');
10
- const { TextBasedChannel } = require('./interfaces/TextBasedChannel.js');
11
-
12
- const getThreadOnlyChannel = lazy(() => require('./ThreadOnlyChannel.js'));
5
+ const { RESTJSONErrorCodes, ChannelFlags, ChannelType, PermissionFlagsBits, Routes } = require('discord-api-types/v10');
6
+ const { BaseChannel } = require('./BaseChannel');
7
+ const getThreadOnlyChannel = lazy(() => require('./ThreadOnlyChannel'));
8
+ const TextBasedChannel = require('./interfaces/TextBasedChannel');
9
+ const { DiscordjsRangeError, ErrorCodes } = require('../errors');
10
+ const GuildMessageManager = require('../managers/GuildMessageManager');
11
+ const ThreadMemberManager = require('../managers/ThreadMemberManager');
12
+ const ChannelFlagsBitField = require('../util/ChannelFlagsBitField');
13
13
 
14
14
  /**
15
15
  * Represents a thread channel on Discord.
16
- *
17
16
  * @extends {BaseChannel}
18
17
  * @implements {TextBasedChannel}
19
18
  */
@@ -23,35 +22,30 @@ class ThreadChannel extends BaseChannel {
23
22
 
24
23
  /**
25
24
  * The guild the thread is in
26
- *
27
25
  * @type {Guild}
28
26
  */
29
27
  this.guild = guild;
30
28
 
31
29
  /**
32
30
  * The id of the guild the channel is in
33
- *
34
31
  * @type {Snowflake}
35
32
  */
36
33
  this.guildId = guild?.id ?? data.guild_id;
37
34
 
38
35
  /**
39
36
  * The id of the member who created this thread
40
- *
41
37
  * @type {Snowflake}
42
38
  */
43
39
  this.ownerId = data.owner_id;
44
40
 
45
41
  /**
46
42
  * A manager of the messages sent to this thread
47
- *
48
43
  * @type {GuildMessageManager}
49
44
  */
50
45
  this.messages = new GuildMessageManager(this);
51
46
 
52
47
  /**
53
48
  * A manager of the members that are part of this thread
54
- *
55
49
  * @type {ThreadMemberManager}
56
50
  */
57
51
  this.members = new ThreadMemberManager(this);
@@ -66,7 +60,6 @@ class ThreadChannel extends BaseChannel {
66
60
  if ('name' in data) {
67
61
  /**
68
62
  * The name of the thread
69
- *
70
63
  * @type {string}
71
64
  */
72
65
  this.name = data.name;
@@ -79,7 +72,6 @@ class ThreadChannel extends BaseChannel {
79
72
  if ('parent_id' in data) {
80
73
  /**
81
74
  * The id of the parent channel of this thread
82
- *
83
75
  * @type {?Snowflake}
84
76
  */
85
77
  this.parentId = data.parent_id;
@@ -90,7 +82,6 @@ class ThreadChannel extends BaseChannel {
90
82
  if ('thread_metadata' in data) {
91
83
  /**
92
84
  * Whether the thread is locked
93
- *
94
85
  * @type {?boolean}
95
86
  */
96
87
  this.locked = data.thread_metadata.locked ?? false;
@@ -99,21 +90,18 @@ class ThreadChannel extends BaseChannel {
99
90
  * Whether members without the {@link PermissionFlagsBits.ManageThreads} permission
100
91
  * can invite other members to this thread.
101
92
  * <info>This property is always `null` in public threads.</info>
102
- *
103
93
  * @type {?boolean}
104
94
  */
105
95
  this.invitable = this.type === ChannelType.PrivateThread ? (data.thread_metadata.invitable ?? false) : null;
106
96
 
107
97
  /**
108
98
  * Whether the thread is archived
109
- *
110
99
  * @type {?boolean}
111
100
  */
112
101
  this.archived = data.thread_metadata.archived;
113
102
 
114
103
  /**
115
104
  * The amount of time (in minutes) after which the thread will automatically archive in case of no recent activity
116
- *
117
105
  * @type {?ThreadAutoArchiveDuration}
118
106
  */
119
107
  this.autoArchiveDuration = data.thread_metadata.auto_archive_duration;
@@ -122,7 +110,6 @@ class ThreadChannel extends BaseChannel {
122
110
  * The timestamp when the thread's archive status was last changed
123
111
  * <info>If the thread was never archived or unarchived, this is the timestamp at which the thread was
124
112
  * created</info>
125
- *
126
113
  * @type {?number}
127
114
  */
128
115
  this.archiveTimestamp = Date.parse(data.thread_metadata.archive_timestamp);
@@ -144,7 +131,6 @@ class ThreadChannel extends BaseChannel {
144
131
  if ('last_message_id' in data) {
145
132
  /**
146
133
  * The last message id sent in this thread, if one was sent
147
- *
148
134
  * @type {?Snowflake}
149
135
  */
150
136
  this.lastMessageId = data.last_message_id;
@@ -155,7 +141,6 @@ class ThreadChannel extends BaseChannel {
155
141
  if ('last_pin_timestamp' in data) {
156
142
  /**
157
143
  * The timestamp when the last pinned message was pinned, if there was one
158
- *
159
144
  * @type {?number}
160
145
  */
161
146
  this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
@@ -166,7 +151,6 @@ class ThreadChannel extends BaseChannel {
166
151
  if ('rate_limit_per_user' in data) {
167
152
  /**
168
153
  * The rate limit per user (slowmode) for this thread in seconds
169
- *
170
154
  * @type {?number}
171
155
  */
172
156
  this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
@@ -179,7 +163,6 @@ class ThreadChannel extends BaseChannel {
179
163
  * The approximate count of messages in this thread
180
164
  * <info>Threads created before July 1, 2022 may have an inaccurate count.
181
165
  * If you need an approximate value higher than that, use `ThreadChannel#messages.cache.size`</info>
182
- *
183
166
  * @type {?number}
184
167
  */
185
168
  this.messageCount = data.message_count;
@@ -192,7 +175,6 @@ class ThreadChannel extends BaseChannel {
192
175
  * The approximate count of users in this thread
193
176
  * <info>This stops counting at 50. If you need an approximate value higher than that, use
194
177
  * `ThreadChannel#members.cache.size`</info>
195
- *
196
178
  * @type {?number}
197
179
  */
198
180
  this.memberCount = data.member_count;
@@ -204,7 +186,6 @@ class ThreadChannel extends BaseChannel {
204
186
  /**
205
187
  * The number of messages ever sent in a thread, similar to {@link ThreadChannel#messageCount} except it
206
188
  * will not decrement whenever a message is deleted
207
- *
208
189
  * @type {?number}
209
190
  */
210
191
  this.totalMessageSent = data.total_message_sent;
@@ -218,7 +199,6 @@ class ThreadChannel extends BaseChannel {
218
199
  if ('applied_tags' in data) {
219
200
  /**
220
201
  * The tags applied to this thread
221
- *
222
202
  * @type {Snowflake[]}
223
203
  */
224
204
  this.appliedTags = data.applied_tags;
@@ -230,7 +210,6 @@ class ThreadChannel extends BaseChannel {
230
210
  /**
231
211
  * The timestamp when this thread was created. This isn't available for threads
232
212
  * created before 2022-01-09
233
- *
234
213
  * @type {?number}
235
214
  * @readonly
236
215
  */
@@ -240,7 +219,6 @@ class ThreadChannel extends BaseChannel {
240
219
 
241
220
  /**
242
221
  * A collection of associated guild member objects of this thread's members
243
- *
244
222
  * @type {Collection<Snowflake, GuildMember>}
245
223
  * @readonly
246
224
  */
@@ -251,7 +229,6 @@ class ThreadChannel extends BaseChannel {
251
229
  /**
252
230
  * The time at which this thread's archive status was last changed
253
231
  * <info>If the thread was never archived or unarchived, this is the time at which the thread was created</info>
254
- *
255
232
  * @type {?Date}
256
233
  * @readonly
257
234
  */
@@ -261,7 +238,6 @@ class ThreadChannel extends BaseChannel {
261
238
 
262
239
  /**
263
240
  * The time the thread was created at
264
- *
265
241
  * @type {?Date}
266
242
  * @readonly
267
243
  */
@@ -271,8 +247,7 @@ class ThreadChannel extends BaseChannel {
271
247
 
272
248
  /**
273
249
  * The parent channel of this thread
274
- *
275
- * @type {?(AnnouncementChannel|TextChannel|ForumChannel|MediaChannel)}
250
+ * @type {?(NewsChannel|TextChannel|ForumChannel|MediaChannel)}
276
251
  * @readonly
277
252
  */
278
253
  get parent() {
@@ -281,7 +256,6 @@ class ThreadChannel extends BaseChannel {
281
256
 
282
257
  /**
283
258
  * Makes the client user join the thread.
284
- *
285
259
  * @returns {Promise<ThreadChannel>}
286
260
  */
287
261
  async join() {
@@ -291,7 +265,6 @@ class ThreadChannel extends BaseChannel {
291
265
 
292
266
  /**
293
267
  * Makes the client user leave the thread.
294
- *
295
268
  * @returns {Promise<ThreadChannel>}
296
269
  */
297
270
  async leave() {
@@ -302,8 +275,7 @@ class ThreadChannel extends BaseChannel {
302
275
  /**
303
276
  * Gets the overall set of permissions for a member or role in this thread's parent channel, taking overwrites into
304
277
  * account.
305
- *
306
- * @param {UserResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
278
+ * @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
307
279
  * @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
308
280
  * will return all permissions
309
281
  * @returns {?Readonly<PermissionsBitField>}
@@ -314,7 +286,6 @@ class ThreadChannel extends BaseChannel {
314
286
 
315
287
  /**
316
288
  * Options used to fetch a thread owner.
317
- *
318
289
  * @typedef {BaseFetchOptions} FetchThreadOwnerOptions
319
290
  * @property {boolean} [withMember] Whether to also return the guild member associated with this thread member
320
291
  */
@@ -322,12 +293,20 @@ class ThreadChannel extends BaseChannel {
322
293
  /**
323
294
  * Fetches the owner of this thread. If the thread member object isn't needed,
324
295
  * use {@link ThreadChannel#ownerId} instead.
325
- *
326
296
  * @param {FetchThreadOwnerOptions} [options] Options for fetching the owner
327
- * @returns {Promise<ThreadMember>}
297
+ * @returns {Promise<?ThreadMember>}
328
298
  */
329
299
  async fetchOwner(options) {
330
- return this.members._fetchSingle({ ...options, member: this.ownerId });
300
+ // TODO: Remove that catch in the next major version
301
+ const member = await this.members._fetchSingle({ ...options, member: this.ownerId }).catch(error => {
302
+ if (error instanceof DiscordAPIError && error.code === RESTJSONErrorCodes.UnknownMember) {
303
+ return null;
304
+ }
305
+
306
+ throw error;
307
+ });
308
+
309
+ return member;
331
310
  }
332
311
 
333
312
  /**
@@ -335,7 +314,6 @@ class ThreadChannel extends BaseChannel {
335
314
  * <info>The `Promise` will reject if the original message in a forum post is deleted
336
315
  * or when the original message in the parent channel is deleted.
337
316
  * If you just need the id of that message, use {@link BaseChannel#id} instead.</info>
338
- *
339
317
  * @param {BaseFetchOptions} [options] Additional options for this fetch
340
318
  * @returns {Promise<?Message<true>>}
341
319
  */
@@ -346,7 +324,6 @@ class ThreadChannel extends BaseChannel {
346
324
 
347
325
  /**
348
326
  * The options used to edit a thread channel
349
- *
350
327
  * @typedef {Object} ThreadEditOptions
351
328
  * @property {string} [name] The new name for the thread
352
329
  * @property {boolean} [archived] Whether the thread is archived
@@ -363,7 +340,6 @@ class ThreadChannel extends BaseChannel {
363
340
 
364
341
  /**
365
342
  * Edits this thread.
366
- *
367
343
  * @param {ThreadEditOptions} options The options to provide
368
344
  * @returns {Promise<ThreadChannel>}
369
345
  * @example
@@ -392,7 +368,6 @@ class ThreadChannel extends BaseChannel {
392
368
 
393
369
  /**
394
370
  * Sets whether the thread is archived.
395
- *
396
371
  * @param {boolean} [archived=true] Whether the thread is archived
397
372
  * @param {string} [reason] Reason for archiving or unarchiving
398
373
  * @returns {Promise<ThreadChannel>}
@@ -402,13 +377,12 @@ class ThreadChannel extends BaseChannel {
402
377
  * .then(newThread => console.log(`Thread is now ${newThread.archived ? 'archived' : 'active'}`))
403
378
  * .catch(console.error);
404
379
  */
405
- async setArchived(archived = true, reason = undefined) {
380
+ setArchived(archived = true, reason) {
406
381
  return this.edit({ archived, reason });
407
382
  }
408
383
 
409
384
  /**
410
385
  * Sets the duration after which the thread will automatically archive in case of no recent activity.
411
- *
412
386
  * @param {ThreadAutoArchiveDuration} autoArchiveDuration The amount of time after which the thread
413
387
  * should automatically archive in case of no recent activity
414
388
  * @param {string} [reason] Reason for changing the auto archive duration
@@ -421,23 +395,21 @@ class ThreadChannel extends BaseChannel {
421
395
  * });
422
396
  * .catch(console.error);
423
397
  */
424
- async setAutoArchiveDuration(autoArchiveDuration, reason) {
398
+ setAutoArchiveDuration(autoArchiveDuration, reason) {
425
399
  return this.edit({ autoArchiveDuration, reason });
426
400
  }
427
401
 
428
402
  /**
429
403
  * Sets whether members without the {@link PermissionFlagsBits.ManageThreads} permission
430
404
  * can invite other members to this thread.
431
- *
432
405
  * @param {boolean} [invitable=true] Whether non-moderators can invite non-moderators to this thread
433
406
  * @param {string} [reason] Reason for changing invite
434
407
  * @returns {Promise<ThreadChannel>}
435
408
  */
436
- async setInvitable(invitable = true, reason = undefined) {
409
+ async setInvitable(invitable = true, reason) {
437
410
  if (this.type !== ChannelType.PrivateThread) {
438
411
  throw new DiscordjsRangeError(ErrorCodes.ThreadInvitableType, this.type);
439
412
  }
440
-
441
413
  return this.edit({ invitable, reason });
442
414
  }
443
415
 
@@ -445,7 +417,6 @@ class ThreadChannel extends BaseChannel {
445
417
  * Sets whether the thread can be **unarchived** by anyone with the
446
418
  * {@link PermissionFlagsBits.SendMessages} permission. When a thread is locked, only members with the
447
419
  * {@link PermissionFlagsBits.ManageThreads} permission can unarchive it.
448
- *
449
420
  * @param {boolean} [locked=true] Whether the thread is locked
450
421
  * @param {string} [reason] Reason for locking or unlocking the thread
451
422
  * @returns {Promise<ThreadChannel>}
@@ -455,13 +426,12 @@ class ThreadChannel extends BaseChannel {
455
426
  * .then(newThread => console.log(`Thread is now ${newThread.locked ? 'locked' : 'unlocked'}`))
456
427
  * .catch(console.error);
457
428
  */
458
- async setLocked(locked = true, reason = undefined) {
429
+ setLocked(locked = true, reason) {
459
430
  return this.edit({ locked, reason });
460
431
  }
461
432
 
462
433
  /**
463
434
  * Sets a new name for this thread.
464
- *
465
435
  * @param {string} name The new name for the thread
466
436
  * @param {string} [reason] Reason for changing the thread's name
467
437
  * @returns {Promise<ThreadChannel>}
@@ -471,55 +441,50 @@ class ThreadChannel extends BaseChannel {
471
441
  * .then(newThread => console.log(`Thread's new name is ${newThread.name}`))
472
442
  * .catch(console.error);
473
443
  */
474
- async setName(name, reason) {
444
+ setName(name, reason) {
475
445
  return this.edit({ name, reason });
476
446
  }
477
447
 
478
448
  /**
479
449
  * Sets the rate limit per user (slowmode) for this thread.
480
- *
481
450
  * @param {number} rateLimitPerUser The new rate limit in seconds
482
451
  * @param {string} [reason] Reason for changing the thread's rate limit
483
452
  * @returns {Promise<ThreadChannel>}
484
453
  */
485
- async setRateLimitPerUser(rateLimitPerUser, reason) {
454
+ setRateLimitPerUser(rateLimitPerUser, reason) {
486
455
  return this.edit({ rateLimitPerUser, reason });
487
456
  }
488
457
 
489
458
  /**
490
459
  * Set the applied tags for this channel (only applicable to forum threads)
491
- *
492
460
  * @param {Snowflake[]} appliedTags The tags to set for this channel
493
461
  * @param {string} [reason] Reason for changing the thread's applied tags
494
462
  * @returns {Promise<ThreadChannel>}
495
463
  */
496
- async setAppliedTags(appliedTags, reason) {
464
+ setAppliedTags(appliedTags, reason) {
497
465
  return this.edit({ appliedTags, reason });
498
466
  }
499
467
 
500
468
  /**
501
469
  * Pins this thread from the forum channel (only applicable to forum threads).
502
- *
503
470
  * @param {string} [reason] Reason for pinning
504
471
  * @returns {Promise<ThreadChannel>}
505
472
  */
506
- async pin(reason) {
473
+ pin(reason) {
507
474
  return this.edit({ flags: this.flags.add(ChannelFlags.Pinned), reason });
508
475
  }
509
476
 
510
477
  /**
511
478
  * Unpins this thread from the forum channel (only applicable to forum threads).
512
- *
513
479
  * @param {string} [reason] Reason for unpinning
514
480
  * @returns {Promise<ThreadChannel>}
515
481
  */
516
- async unpin(reason) {
482
+ unpin(reason) {
517
483
  return this.edit({ flags: this.flags.remove(ChannelFlags.Pinned), reason });
518
484
  }
519
485
 
520
486
  /**
521
487
  * Whether the client user is a member of the thread.
522
- *
523
488
  * @type {boolean}
524
489
  * @readonly
525
490
  */
@@ -529,7 +494,6 @@ class ThreadChannel extends BaseChannel {
529
494
 
530
495
  /**
531
496
  * Whether the thread is editable by the client user (name, archived, autoArchiveDuration)
532
- *
533
497
  * @type {boolean}
534
498
  * @readonly
535
499
  */
@@ -542,7 +506,6 @@ class ThreadChannel extends BaseChannel {
542
506
 
543
507
  /**
544
508
  * Whether the thread is joinable by the client user
545
- *
546
509
  * @type {boolean}
547
510
  * @readonly
548
511
  */
@@ -559,7 +522,6 @@ class ThreadChannel extends BaseChannel {
559
522
 
560
523
  /**
561
524
  * Whether the thread is manageable by the client user, for deleting or editing rateLimitPerUser or locked.
562
- *
563
525
  * @type {boolean}
564
526
  * @readonly
565
527
  */
@@ -577,11 +539,11 @@ class ThreadChannel extends BaseChannel {
577
539
 
578
540
  /**
579
541
  * Whether the thread is viewable by the client user
580
- *
581
542
  * @type {boolean}
582
543
  * @readonly
583
544
  */
584
545
  get viewable() {
546
+ if (this.client.user.id === this.guild.ownerId) return true;
585
547
  const permissions = this.permissionsFor(this.client.user);
586
548
  if (!permissions) return false;
587
549
  return permissions.has(PermissionFlagsBits.ViewChannel, false);
@@ -589,7 +551,6 @@ class ThreadChannel extends BaseChannel {
589
551
 
590
552
  /**
591
553
  * Whether the client user can send messages in this thread
592
- *
593
554
  * @type {boolean}
594
555
  * @readonly
595
556
  */
@@ -609,7 +570,6 @@ class ThreadChannel extends BaseChannel {
609
570
 
610
571
  /**
611
572
  * Whether the thread is unarchivable by the client user
612
- *
613
573
  * @type {boolean}
614
574
  * @readonly
615
575
  */
@@ -619,7 +579,6 @@ class ThreadChannel extends BaseChannel {
619
579
 
620
580
  /**
621
581
  * Deletes this thread.
622
- *
623
582
  * @param {string} [reason] Reason for deleting this thread
624
583
  * @returns {Promise<ThreadChannel>}
625
584
  * @example
@@ -634,29 +593,20 @@ class ThreadChannel extends BaseChannel {
634
593
  }
635
594
 
636
595
  // These are here only for documentation purposes - they are implemented by TextBasedChannel
637
-
638
- /* eslint-disable getter-return */
596
+ /* eslint-disable no-empty-function */
639
597
  get lastMessage() {}
640
-
641
598
  get lastPinAt() {}
642
-
643
599
  send() {}
644
-
645
600
  sendTyping() {}
646
-
647
601
  createMessageCollector() {}
648
-
649
602
  awaitMessages() {}
650
-
651
603
  createMessageComponentCollector() {}
652
-
653
604
  awaitMessageComponent() {}
654
-
655
605
  bulkDelete() {}
656
606
  // Doesn't work on Thread channels; setRateLimitPerUser() {}
657
607
  // Doesn't work on Thread channels; setNSFW() {}
658
608
  }
659
609
 
660
- TextBasedChannel.applyToClass(ThreadChannel, ['fetchWebhooks', 'setRateLimitPerUser', 'setNSFW']);
610
+ TextBasedChannel.applyToClass(ThreadChannel, true, ['fetchWebhooks', 'setRateLimitPerUser', 'setNSFW']);
661
611
 
662
- exports.ThreadChannel = ThreadChannel;
612
+ module.exports = ThreadChannel;
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const { ThreadMemberFlagsBitField } = require('../util/ThreadMemberFlagsBitField.js');
4
- const { Base } = require('./Base.js');
3
+ const Base = require('./Base');
4
+ const ThreadMemberFlagsBitField = require('../util/ThreadMemberFlagsBitField');
5
+ const { emitDeprecationWarningForRemoveThreadMember } = require('../util/Util');
5
6
 
6
7
  /**
7
8
  * Represents a Member for a Thread.
8
- *
9
9
  * @extends {Base}
10
10
  */
11
11
  class ThreadMember extends Base {
@@ -14,28 +14,24 @@ class ThreadMember extends Base {
14
14
 
15
15
  /**
16
16
  * The thread that this member is a part of
17
- *
18
17
  * @type {ThreadChannel}
19
18
  */
20
19
  this.thread = thread;
21
20
 
22
21
  /**
23
22
  * The timestamp the member last joined the thread at
24
- *
25
23
  * @type {?number}
26
24
  */
27
25
  this.joinedTimestamp = null;
28
26
 
29
27
  /**
30
28
  * The flags for this thread member. This will be `null` if partial.
31
- *
32
29
  * @type {?ThreadMemberFlagsBitField}
33
30
  */
34
31
  this.flags = null;
35
32
 
36
33
  /**
37
34
  * The id of the thread member
38
- *
39
35
  * @type {Snowflake}
40
36
  */
41
37
  this.id = data.user_id;
@@ -50,7 +46,6 @@ class ThreadMember extends Base {
50
46
  if ('member' in data) {
51
47
  /**
52
48
  * The guild member associated with this thread member.
53
- *
54
49
  * @type {?GuildMember}
55
50
  * @private
56
51
  */
@@ -62,7 +57,6 @@ class ThreadMember extends Base {
62
57
 
63
58
  /**
64
59
  * Whether this thread member is a partial
65
- *
66
60
  * @type {boolean}
67
61
  * @readonly
68
62
  */
@@ -72,7 +66,6 @@ class ThreadMember extends Base {
72
66
 
73
67
  /**
74
68
  * The guild member associated with this thread member
75
- *
76
69
  * @type {?GuildMember}
77
70
  * @readonly
78
71
  */
@@ -82,7 +75,6 @@ class ThreadMember extends Base {
82
75
 
83
76
  /**
84
77
  * The last time this member joined the thread
85
- *
86
78
  * @type {?Date}
87
79
  * @readonly
88
80
  */
@@ -92,7 +84,6 @@ class ThreadMember extends Base {
92
84
 
93
85
  /**
94
86
  * The user associated with this thread member
95
- *
96
87
  * @type {?User}
97
88
  * @readonly
98
89
  */
@@ -102,7 +93,6 @@ class ThreadMember extends Base {
102
93
 
103
94
  /**
104
95
  * Whether the client user can manage this thread member
105
- *
106
96
  * @type {boolean}
107
97
  * @readonly
108
98
  */
@@ -112,13 +102,18 @@ class ThreadMember extends Base {
112
102
 
113
103
  /**
114
104
  * Removes this member from the thread.
115
- *
105
+ * @param {string} [reason] Reason for removing the member
106
+ * <warn>This parameter is **deprecated**. Reasons cannot be used.</warn>
116
107
  * @returns {Promise<ThreadMember>}
117
108
  */
118
- async remove() {
119
- await this.thread.members.remove(this.id);
109
+ async remove(reason) {
110
+ if (reason !== undefined) {
111
+ emitDeprecationWarningForRemoveThreadMember(this.constructor.name);
112
+ }
113
+
114
+ await this.thread.members.remove(this.id, reason);
120
115
  return this;
121
116
  }
122
117
  }
123
118
 
124
- exports.ThreadMember = ThreadMember;
119
+ module.exports = ThreadMember;