djs-selfbot-v13 3.1.7 → 3.2.2

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 (155) hide show
  1. package/README.md +18 -35
  2. package/package.json +85 -100
  3. package/src/client/BaseClient.js +3 -4
  4. package/src/client/Client.js +249 -530
  5. package/src/client/actions/Action.js +18 -13
  6. package/src/client/actions/ActionsManager.js +7 -1
  7. package/src/client/actions/AutoModerationActionExecution.js +1 -0
  8. package/src/client/actions/AutoModerationRuleCreate.js +1 -0
  9. package/src/client/actions/AutoModerationRuleDelete.js +1 -0
  10. package/src/client/actions/AutoModerationRuleUpdate.js +1 -0
  11. package/src/client/actions/GuildMemberRemove.js +0 -1
  12. package/src/client/actions/GuildMemberUpdate.js +0 -1
  13. package/src/client/actions/MessageCreate.js +0 -4
  14. package/src/client/actions/PresenceUpdate.js +17 -16
  15. package/src/client/websocket/WebSocketManager.js +11 -31
  16. package/src/client/websocket/WebSocketShard.js +39 -38
  17. package/src/client/websocket/handlers/CALL_CREATE.js +3 -3
  18. package/src/client/websocket/handlers/CALL_DELETE.js +2 -2
  19. package/src/client/websocket/handlers/CALL_UPDATE.js +2 -2
  20. package/src/client/websocket/handlers/CHANNEL_RECIPIENT_ADD.js +16 -13
  21. package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
  22. package/src/client/websocket/handlers/GUILD_CREATE.js +19 -13
  23. package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +0 -1
  24. package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +1 -0
  25. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.js +22 -0
  26. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.js +12 -0
  27. package/src/client/websocket/handlers/READY.js +90 -140
  28. package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +7 -5
  29. package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +7 -5
  30. package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +32 -9
  31. package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +2 -8
  32. package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
  33. package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +78 -0
  34. package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +1 -5
  35. package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +12 -0
  36. package/src/client/websocket/handlers/index.js +17 -20
  37. package/src/errors/Messages.js +25 -69
  38. package/src/index.js +13 -43
  39. package/src/managers/ApplicationCommandManager.js +9 -12
  40. package/src/managers/ApplicationCommandPermissionsManager.js +3 -11
  41. package/src/managers/ChannelManager.js +2 -3
  42. package/src/managers/ClientUserSettingManager.js +162 -280
  43. package/src/managers/GuildBanManager.js +47 -1
  44. package/src/managers/GuildChannelManager.js +2 -16
  45. package/src/managers/GuildForumThreadManager.js +24 -30
  46. package/src/managers/GuildManager.js +1 -1
  47. package/src/managers/GuildMemberManager.js +50 -222
  48. package/src/managers/GuildSettingManager.js +22 -15
  49. package/src/managers/MessageManager.js +42 -44
  50. package/src/managers/PermissionOverwriteManager.js +1 -1
  51. package/src/managers/ReactionUserManager.js +5 -5
  52. package/src/managers/RelationshipManager.js +83 -76
  53. package/src/managers/ThreadManager.js +12 -45
  54. package/src/managers/ThreadMemberManager.js +1 -1
  55. package/src/managers/UserManager.js +6 -10
  56. package/src/managers/UserNoteManager.js +53 -0
  57. package/src/rest/APIRequest.js +48 -20
  58. package/src/rest/DiscordAPIError.js +17 -16
  59. package/src/rest/RESTManager.js +1 -21
  60. package/src/rest/RequestHandler.js +35 -21
  61. package/src/structures/ApplicationCommand.js +19 -456
  62. package/src/structures/ApplicationRoleConnectionMetadata.js +3 -0
  63. package/src/structures/AutoModerationRule.js +5 -5
  64. package/src/structures/AutocompleteInteraction.js +1 -0
  65. package/src/structures/BaseGuildTextChannel.js +10 -12
  66. package/src/structures/BaseGuildVoiceChannel.js +16 -18
  67. package/src/structures/{Call.js → CallState.js} +17 -12
  68. package/src/structures/CategoryChannel.js +2 -0
  69. package/src/structures/Channel.js +2 -3
  70. package/src/structures/ClientPresence.js +20 -19
  71. package/src/structures/ClientUser.js +117 -338
  72. package/src/structures/ContextMenuInteraction.js +1 -1
  73. package/src/structures/DMChannel.js +29 -92
  74. package/src/structures/ForumChannel.js +0 -10
  75. package/src/structures/GroupDMChannel.js +387 -0
  76. package/src/structures/Guild.js +135 -271
  77. package/src/structures/GuildAuditLogs.js +0 -5
  78. package/src/structures/GuildChannel.js +16 -2
  79. package/src/structures/GuildMember.js +27 -145
  80. package/src/structures/Interaction.js +1 -62
  81. package/src/structures/Invite.js +35 -52
  82. package/src/structures/Message.js +220 -203
  83. package/src/structures/MessageAttachment.js +11 -0
  84. package/src/structures/MessageButton.js +1 -67
  85. package/src/structures/MessageEmbed.js +1 -1
  86. package/src/structures/MessageMentions.js +3 -2
  87. package/src/structures/MessagePayload.js +6 -46
  88. package/src/structures/MessagePoll.js +238 -0
  89. package/src/structures/MessageReaction.js +1 -1
  90. package/src/structures/MessageSelectMenu.js +1 -252
  91. package/src/structures/Modal.js +70 -188
  92. package/src/structures/Presence.js +787 -129
  93. package/src/structures/Role.js +18 -2
  94. package/src/structures/SelectMenuInteraction.js +2 -151
  95. package/src/structures/Team.js +0 -49
  96. package/src/structures/TextInputComponent.js +0 -70
  97. package/src/structures/ThreadChannel.js +0 -19
  98. package/src/structures/User.js +145 -339
  99. package/src/structures/UserContextMenuInteraction.js +2 -2
  100. package/src/structures/VoiceState.js +74 -39
  101. package/src/structures/WebEmbed.js +38 -52
  102. package/src/structures/Webhook.js +17 -11
  103. package/src/structures/interfaces/Application.js +146 -23
  104. package/src/structures/interfaces/TextBasedChannel.js +409 -256
  105. package/src/util/ApplicationFlags.js +1 -1
  106. package/src/util/AttachmentFlags.js +38 -0
  107. package/src/util/Constants.js +120 -285
  108. package/src/util/Formatters.js +16 -2
  109. package/src/util/InviteFlags.js +29 -0
  110. package/src/util/LimitedCollection.js +1 -1
  111. package/src/util/Options.js +48 -74
  112. package/src/util/Permissions.js +15 -0
  113. package/src/util/PurchasedFlags.js +2 -0
  114. package/src/util/RemoteAuth.js +221 -356
  115. package/src/util/RoleFlags.js +37 -0
  116. package/src/util/Sweepers.js +1 -1
  117. package/src/util/Util.js +158 -32
  118. package/typings/enums.d.ts +24 -73
  119. package/typings/index.d.ts +978 -1288
  120. package/typings/rawDataTypes.d.ts +68 -9
  121. package/src/client/actions/InteractionCreate.js +0 -115
  122. package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +0 -23
  123. package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +0 -11
  124. package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +0 -55
  125. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +0 -0
  126. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +0 -0
  127. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.js +0 -0
  128. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +0 -0
  129. package/src/client/websocket/handlers/INTERACTION_CREATE.js +0 -16
  130. package/src/client/websocket/handlers/INTERACTION_FAILURE.js +0 -18
  131. package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +0 -30
  132. package/src/client/websocket/handlers/MESSAGE_ACK.js +0 -16
  133. package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
  134. package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
  135. package/src/managers/DeveloperPortalManager.js +0 -104
  136. package/src/managers/GuildApplicationCommandManager.js +0 -28
  137. package/src/managers/GuildFolderManager.js +0 -24
  138. package/src/managers/SessionManager.js +0 -57
  139. package/src/rest/CaptchaSolver.js +0 -132
  140. package/src/structures/ClientApplication.js +0 -204
  141. package/src/structures/DeveloperPortalApplication.js +0 -520
  142. package/src/structures/GuildFolder.js +0 -75
  143. package/src/structures/InteractionResponse.js +0 -114
  144. package/src/structures/PartialGroupDMChannel.js +0 -433
  145. package/src/structures/RichPresence.js +0 -722
  146. package/src/structures/Session.js +0 -81
  147. package/src/util/Voice.js +0 -1456
  148. package/src/util/arRPC/index.js +0 -229
  149. package/src/util/arRPC/process/detectable.json +0 -1
  150. package/src/util/arRPC/process/index.js +0 -102
  151. package/src/util/arRPC/process/native/index.js +0 -5
  152. package/src/util/arRPC/process/native/linux.js +0 -37
  153. package/src/util/arRPC/process/native/win32.js +0 -25
  154. package/src/util/arRPC/transports/ipc.js +0 -281
  155. package/src/util/arRPC/transports/websocket.js +0 -128
@@ -3,14 +3,12 @@
3
3
  const { setInterval } = require('node:timers');
4
4
  const { Collection } = require('@discordjs/collection');
5
5
  const Invite = require('./Invite');
6
- const { Message } = require('./Message');
7
6
  const User = require('./User');
8
- const { Util } = require('..');
9
- const { Error: Error_ } = require('../errors');
10
- const { Opcodes, NitroType, HypeSquadType } = require('../util/Constants');
11
7
  const DataResolver = require('../util/DataResolver');
12
8
  const PremiumUsageFlags = require('../util/PremiumUsageFlags');
13
9
  const PurchasedFlags = require('../util/PurchasedFlags');
10
+ const Util = require('../util/Util');
11
+
14
12
  /**
15
13
  * Represents the logged in client's Discord user.
16
14
  * @extends {User}
@@ -36,7 +34,7 @@ class ClientUser extends User {
36
34
 
37
35
  if ('mfa_enabled' in data) {
38
36
  /**
39
- * If the bot's {@link ClientApplication#owner Owner} has MFA enabled on their account
37
+ * If the bot's {@link Application#owner Owner} has MFA enabled on their account
40
38
  * @type {?boolean}
41
39
  */
42
40
  this.mfaEnabled = typeof data.mfa_enabled === 'boolean' ? data.mfa_enabled : null;
@@ -46,30 +44,24 @@ class ClientUser extends User {
46
44
 
47
45
  if ('token' in data) this.client.token = data.token;
48
46
 
49
- // Todo: Add (Selfbot)
50
- if ('premium_type' in data) {
51
- const nitro = NitroType[data.premium_type ?? 0];
52
- /**
53
- * Nitro type of the client user.
54
- * @type {NitroType}
55
- */
56
- this.nitroType = nitro ?? `UNKNOWN_TYPE_${data.premium_type}`;
57
- }
58
-
59
47
  if ('purchased_flags' in data) {
60
48
  /**
61
49
  * Purchased state of the client user.
62
- * @type {?PurchasedFlags}
50
+ * @type {Readonly<PurchasedFlags>}
63
51
  */
64
- this.purchasedFlags = new PurchasedFlags(data.purchased_flags || 0);
52
+ this.purchasedFlags = new PurchasedFlags(data.purchased_flags || 0).freeze();
53
+ } else {
54
+ this.purchasedFlags = new PurchasedFlags().freeze();
65
55
  }
66
56
 
67
57
  if ('premium_usage_flags' in data) {
68
58
  /**
69
59
  * Premium usage state of the client user.
70
- * @type {?PremiumUsageFlags}
60
+ * @type {Readonly<PremiumUsageFlags>}
71
61
  */
72
62
  this.premiumUsageFlags = new PremiumUsageFlags(data.premium_usage_flags || 0);
63
+ } else {
64
+ this.premiumUsageFlags = new PremiumUsageFlags().freeze();
73
65
  }
74
66
 
75
67
  if ('phone' in data) {
@@ -77,7 +69,7 @@ class ClientUser extends User {
77
69
  * Phone number of the client user.
78
70
  * @type {?string}
79
71
  */
80
- this.phoneNumber = data.phone;
72
+ this.phone = data.phone;
81
73
  }
82
74
 
83
75
  if ('nsfw_allowed' in data) {
@@ -93,50 +85,37 @@ class ClientUser extends User {
93
85
  * Email address of the client user.
94
86
  * @type {?string}
95
87
  */
96
- this.emailAddress = data.email;
88
+ this.email = data.email;
97
89
  }
98
90
 
99
91
  if ('bio' in data) {
92
+ /**
93
+ * About me (User)
94
+ * <info>The user must be force fetched for this property to be present or be updated</info>
95
+ * @type {?string}
96
+ */
100
97
  this.bio = data.bio;
101
98
  }
102
99
 
103
100
  if ('pronouns' in data) {
101
+ /**
102
+ * Pronouns (User)
103
+ * <info>The user must be force fetched for this property to be present or be updated</info>
104
+ * @type {?string}
105
+ */
104
106
  this.pronouns = data.pronouns;
105
107
  }
106
108
 
107
- if (!this.friendNicknames?.size) {
109
+ if ('premium_type' in data) {
108
110
  /**
109
- * The friend nicknames cache of the client user.
110
- * @type {Collection<Snowflake, string>}
111
- * @private
111
+ * Premium types denote the level of premium a user has.
112
+ * @type {number}
113
+ * @see {@link https://discord-userdoccers.vercel.app/resources/user#premium-type}
112
114
  */
113
- this.friendNicknames = new Collection();
114
- }
115
-
116
- if (!this._intervalSamsungPresence) {
117
- this._intervalSamsungPresence = setInterval(() => {
118
- this.client.emit('debug', `Samsung Presence: ${this._packageName}`);
119
- if (!this._packageName) return;
120
- this.setSamsungActivity(this._packageName, 'UPDATE');
121
- }, 1000 * 60 * 10).unref();
122
- // 20 minutes max
115
+ this.premiumType = data.premium_type;
123
116
  }
124
117
  }
125
118
 
126
- /**
127
- * Patch note
128
- * @param {Object} data Note data
129
- * @private
130
- */
131
- _patchNote(data) {
132
- /**
133
- * The notes cache of the client user.
134
- * @type {Collection<Snowflake, string>}
135
- * @private
136
- */
137
- this.notes = data ? new Collection(Object.entries(data)) : new Collection();
138
- }
139
-
140
119
  /**
141
120
  * Represents the client user's presence
142
121
  * @type {ClientPresence}
@@ -172,22 +151,16 @@ class ClientUser extends User {
172
151
  * <info>Changing usernames in Discord is heavily rate limited, with only 2 requests
173
152
  * every hour. Use this sparingly!</info>
174
153
  * @param {string} username The new username
175
- * @param {string} password The password of the account
154
+ * @param {string} password Current Password
176
155
  * @returns {Promise<ClientUser>}
177
156
  * @example
178
157
  * // Set username
179
- * client.user.setUsername('discordjs')
158
+ * client.user.setUsername('discordjs', 'passw@rd')
180
159
  * .then(user => console.log(`My new username is ${user.username}`))
181
160
  * .catch(console.error);
182
161
  */
183
162
  setUsername(username, password) {
184
- if (!password && !this.client.password) {
185
- throw new Error('A password is required to change a username.');
186
- }
187
- return this.edit({
188
- username,
189
- password: this.client.password ? this.client.password : password,
190
- });
163
+ return this.edit({ username, password });
191
164
  }
192
165
 
193
166
  /**
@@ -204,191 +177,12 @@ class ClientUser extends User {
204
177
  avatar = avatar && (await DataResolver.resolveImage(avatar));
205
178
  return this.edit({ avatar });
206
179
  }
207
- /**
208
- * Sets the banner of the logged in client.
209
- * @param {?(BufferResolvable|Base64Resolvable)} banner The new banner
210
- * @returns {Promise<ClientUser>}
211
- * @example
212
- * // Set banner
213
- * client.user.setBanner('./banner.png')
214
- * .then(user => console.log(`New banner set!`))
215
- * .catch(console.error);
216
- */
217
- async setBanner(banner) {
218
- if (this.nitroType !== 'NITRO_BOOST') {
219
- throw new Error('You must be a Nitro Boosted User to change your banner.');
220
- }
221
- banner = banner && (await DataResolver.resolveImage(banner));
222
- return this.edit({ banner });
223
- }
224
-
225
- /**
226
- * Set HyperSquad House
227
- * @param {HypeSquadType} type
228
- * * `LEAVE`: 0
229
- * * `HOUSE_BRAVERY`: 1
230
- * * `HOUSE_BRILLIANCE`: 2
231
- * * `HOUSE_BALANCE`: 3
232
- * @returns {Promise<void>}
233
- * @example
234
- * // Set HyperSquad HOUSE_BRAVERY
235
- * client.user.setHypeSquad(1); || client.user.setHypeSquad('HOUSE_BRAVERY');
236
- * // Leave
237
- * client.user.setHypeSquad(0);
238
- */
239
- async setHypeSquad(type) {
240
- const id = typeof type === 'string' ? HypeSquadType[type] : type;
241
- if (!id && id !== 0) throw new Error('Invalid HypeSquad type.');
242
- if (id !== 0) {
243
- const data = await this.client.api.hypesquad.online.post({
244
- data: { house_id: id },
245
- });
246
- return data;
247
- } else {
248
- const data = await this.client.api.hypesquad.online.delete();
249
- return data;
250
- }
251
- }
252
-
253
- /**
254
- * Set Accent color
255
- * @param {ColorResolvable} color Color to set
256
- * @returns {Promise<ClientUser>}
257
- */
258
- setAccentColor(color = null) {
259
- return this.edit({ accent_color: color ? Util.resolveColor(color) : null });
260
- }
261
-
262
- /**
263
- * Set discriminator
264
- * @param {User.discriminator} discriminator It is #1234
265
- * @param {string} password The password of the account
266
- * @returns {Promise<ClientUser>}
267
- */
268
- setDiscriminator(discriminator, password) {
269
- if (this.nitroType == 'NONE') throw new Error('You must be a Nitro User to change your discriminator.');
270
- if (!password && !this.client.password) {
271
- throw new Error('A password is required to change a discriminator.');
272
- }
273
- return this.edit({
274
- discriminator,
275
- username: this.username,
276
- password: this.client.password ? this.client.password : password,
277
- });
278
- }
279
-
280
- /**
281
- * Set About me
282
- * @param {string | null} bio Bio to set
283
- * @returns {Promise<ClientUser>}
284
- */
285
- setAboutMe(bio = null) {
286
- return this.edit({
287
- bio,
288
- });
289
- }
290
-
291
- /**
292
- * Change the email
293
- * @param {Email<string>} email Email to change
294
- * @param {string} password Password of the account
295
- * @returns {Promise<ClientUser>}
296
- */
297
- setEmail(email, password) {
298
- throw new Error('This method is not available yet. Please use the official Discord client to change your email.');
299
- // eslint-disable-next-line no-unreachable
300
- if (!password && !this.client.password) {
301
- throw new Error('A password is required to change a email.');
302
- }
303
- return this.edit({
304
- email,
305
- password: this.client.password ? this.client.password : password,
306
- });
307
- }
308
-
309
- /**
310
- * Set new password
311
- * @param {string} oldPassword Old password
312
- * @param {string} newPassword New password to set
313
- * @returns {Promise<ClientUser>}
314
- */
315
- setPassword(oldPassword, newPassword) {
316
- if (!oldPassword && !this.client.password) {
317
- throw new Error('A password is required to change a password.');
318
- }
319
- if (!newPassword) throw new Error('New password is required.');
320
- return this.edit({
321
- password: this.client.password ? this.client.password : oldPassword,
322
- new_password: newPassword,
323
- });
324
- }
325
-
326
- /**
327
- * Disable account
328
- * @param {string} password Password of the account
329
- * @returns {Promise<ClientUser>}
330
- */
331
- async disableAccount(password) {
332
- if (!password && !this.client.password) {
333
- throw new Error('A password is required to disable an account.');
334
- }
335
- const data = await this.client.api.users['@me'].disable.post({
336
- data: {
337
- password: this.client.password ? this.client.password : password,
338
- },
339
- });
340
- return data;
341
- }
342
-
343
- /**
344
- * Set selfdeaf (Global)
345
- * @param {boolean} status Whether or not the ClientUser is deafened
346
- * @returns {boolean}
347
- */
348
- setDeaf(status) {
349
- if (typeof status !== 'boolean') throw new Error('Deaf status must be a boolean.');
350
- this.client.ws.broadcast({
351
- op: Opcodes.VOICE_STATE_UPDATE,
352
- d: { self_deaf: status },
353
- });
354
- return status;
355
- }
356
-
357
- /**
358
- * Set selfmute (Global)
359
- * @param {boolean} status Whether or not the ClientUser is muted
360
- * @returns {boolean}
361
- */
362
- setMute(status) {
363
- if (typeof status !== 'boolean') throw new Error('Mute status must be a boolean.');
364
- this.client.ws.broadcast({
365
- op: Opcodes.VOICE_STATE_UPDATE,
366
- d: { self_mute: status },
367
- });
368
- return status;
369
- }
370
-
371
- /**
372
- * Delete account. Warning: Cannot be changed once used!
373
- * @param {string} password Password of the account
374
- * @returns {Promise<ClientUser>}
375
- */
376
- async deleteAccount(password) {
377
- if (!password && !this.client.password) {
378
- throw new Error('A password is required to delete an account.');
379
- }
380
- const data = await this.client.api.users['@me/delete'].post({
381
- data: {
382
- password: this.client.password ? this.client.password : password,
383
- },
384
- });
385
- return data;
386
- }
387
180
 
388
181
  /**
389
182
  * Options for setting activities
390
183
  * @typedef {Object} ActivitiesOptions
391
- * @property {string} [name] Name of the activity
184
+ * @property {string} name Name of the activity
185
+ * @property {string} [state] State of the activity
392
186
  * @property {ActivityType|number} [type] Type of the activity
393
187
  * @property {string} [url] Twitch / YouTube stream URL
394
188
  */
@@ -409,7 +203,6 @@ class ClientUser extends User {
409
203
  * @example
410
204
  * // Set the client user's presence
411
205
  * client.user.setPresence({ activities: [{ name: 'with discord.js' }], status: 'idle' });
412
- * @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/RichPresence.md}
413
206
  */
414
207
  setPresence(data) {
415
208
  return this.client.presence.set(data);
@@ -440,7 +233,7 @@ class ClientUser extends User {
440
233
  /**
441
234
  * Options for setting an activity.
442
235
  * @typedef {Object} ActivityOptions
443
- * @property {string} [name] Name of the activity
236
+ * @property {string} name Name of the activity
444
237
  * @property {string} [url] Twitch / YouTube stream URL
445
238
  * @property {ActivityType|number} [type] Type of the activity
446
239
  * @property {number|number[]} [shardId] Shard Id(s) to have the activity set on
@@ -448,24 +241,18 @@ class ClientUser extends User {
448
241
 
449
242
  /**
450
243
  * Sets the activity the client user is playing.
451
- * @param {string|ActivityOptions} [name] Activity being played, or options for setting the activity
244
+ * @param {string|ActivityOptions} name Activity being played, or options for setting the activity
452
245
  * @param {ActivityOptions} [options] Options for setting the activity
453
246
  * @returns {ClientPresence}
454
247
  * @example
455
248
  * // Set the client user's activity
456
249
  * client.user.setActivity('discord.js', { type: 'WATCHING' });
457
- * @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/RichPresence.md}
458
250
  */
459
251
  setActivity(name, options = {}) {
460
- if (!name) {
461
- return this.setPresence({ activities: [], shardId: options.shardId });
462
- }
252
+ if (!name) return this.setPresence({ activities: [], shardId: options.shardId });
463
253
 
464
254
  const activity = Object.assign({}, options, typeof name === 'object' ? name : { name });
465
- return this.setPresence({
466
- activities: [activity],
467
- shardId: activity.shardId,
468
- });
255
+ return this.setPresence({ activities: [activity], shardId: activity.shardId });
469
256
  }
470
257
 
471
258
  /**
@@ -478,6 +265,81 @@ class ClientUser extends User {
478
265
  return this.setPresence({ afk, shardId });
479
266
  }
480
267
 
268
+ /**
269
+ * Sets the banner of the logged in client.
270
+ * @param {?(BufferResolvable|Base64Resolvable)} banner The new banner
271
+ * @returns {Promise<ClientUser>}
272
+ * @example
273
+ * // Set banner
274
+ * client.user.setBanner('./banner.png')
275
+ * .then(user => console.log(`New banner set!`))
276
+ * .catch(console.error);
277
+ */
278
+ async setBanner(banner) {
279
+ banner = banner && (await DataResolver.resolveImage(banner));
280
+ return this.edit({ banner });
281
+ }
282
+
283
+ /**
284
+ * Set HyperSquad House
285
+ * @param {string|number} type
286
+ * * `LEAVE`: 0
287
+ * * `HOUSE_BRAVERY`: 1
288
+ * * `HOUSE_BRILLIANCE`: 2
289
+ * * `HOUSE_BALANCE`: 3
290
+ * @returns {Promise<void>}
291
+ * @example
292
+ * // Set HyperSquad HOUSE_BRAVERY
293
+ * client.user.setHypeSquad(1); || client.user.setHypeSquad('HOUSE_BRAVERY');
294
+ * // Leave
295
+ * client.user.setHypeSquad(0);
296
+ */
297
+ setHypeSquad(type) {
298
+ switch (type) {
299
+ case 'LEAVE': {
300
+ type = 0;
301
+ break;
302
+ }
303
+ case 'HOUSE_BRAVERY': {
304
+ type = 1;
305
+ break;
306
+ }
307
+ case 'HOUSE_BRILLIANCE': {
308
+ type = 2;
309
+ break;
310
+ }
311
+ case 'HOUSE_BALANCE': {
312
+ type = 3;
313
+ break;
314
+ }
315
+ }
316
+ if (type == 0) {
317
+ return this.client.api.hypesquad.online.delete();
318
+ } else {
319
+ return this.client.api.hypesquad.online.post({
320
+ data: { house_id: type },
321
+ });
322
+ }
323
+ }
324
+
325
+ /**
326
+ * Set Accent color
327
+ * @param {ColorResolvable} color Color to set
328
+ * @returns {Promise<ClientUser>}
329
+ */
330
+ setAccentColor(color = null) {
331
+ return this.edit({ accent_color: color ? Util.resolveColor(color) : null });
332
+ }
333
+
334
+ /**
335
+ * Set About me
336
+ * @param {string} [bio=null] Bio to set
337
+ * @returns {Promise<ClientUser>}
338
+ */
339
+ setAboutMe(bio = null) {
340
+ return this.edit({ bio });
341
+ }
342
+
481
343
  /**
482
344
  * Create an invite [Friend Invites]
483
345
  * maxAge: 604800 | maxUses: 1
@@ -511,63 +373,10 @@ class ClientUser extends User {
511
373
 
512
374
  /**
513
375
  * Revoke all friend invites
514
- * @returns {Promise<Collection<string, Invite>>}
515
- */
516
- async revokeAllFriendInvites() {
517
- const data = await this.client.api.users['@me'].invites.delete();
518
- const collection = new Collection();
519
- for (const invite of data) {
520
- collection.set(invite.code, new Invite(this.client, invite));
521
- }
522
- return collection;
523
- }
524
-
525
- /**
526
- * Get a collection of messages mentioning clientUser
527
- * @param {number} [limit=25] Maximum number of messages to get
528
- * @param {boolean} [mentionRoles=true] Whether or not to mention roles
529
- * @param {boolean} [mentionEveryone=true] Whether or not to mention `@everyone`
530
- * @returns {Promise<Collection<Snowflake, Message>>}
531
- */
532
- async getMentions(limit = 25, mentionRoles = true, mentionEveryone = true) {
533
- // https://canary.discord.com/api/v9/users/@me/mentions?limit=25&roles=true&everyone=true
534
- const data = await this.client.api.users['@me'].mentions.get({
535
- query: {
536
- limit,
537
- roles: mentionRoles,
538
- everyone: mentionEveryone,
539
- },
540
- });
541
- const collection = new Collection();
542
- for (const msg of data) {
543
- collection.set(msg.id, new Message(this.client, msg));
544
- }
545
- return collection;
546
- }
547
-
548
- /**
549
- * Change Theme color
550
- * @param {ColorResolvable} primary The primary color of the user's profile
551
- * @param {ColorResolvable} accent The accent color of the user's profile
552
- * @returns {Promise<ClientUser>}
376
+ * @returns {Promise<void>}
553
377
  */
554
- async setThemeColors(primary, accent) {
555
- if (!primary || !accent) throw new Error('PRIMARY_COLOR or ACCENT_COLOR are required.');
556
- // Check nitro
557
- if (this.nitroType !== 'NITRO_BOOST') {
558
- throw new Error_('NITRO_BOOST_REQUIRED', 'themeColors');
559
- }
560
- primary = Util.resolveColor(primary) || this.themeColors[0];
561
- accent = Util.resolveColor(accent) || this.themeColors[1];
562
- const data_ = await this.client.api.users['@me'].profile.patch({
563
- data: {
564
- theme_colors: [primary, accent],
565
- },
566
- });
567
- this._ProfilePatch({
568
- user_profile: data_,
569
- });
570
- return this;
378
+ revokeAllFriendInvites() {
379
+ return this.client.api.users['@me'].invites.delete();
571
380
  }
572
381
 
573
382
  /**
@@ -593,48 +402,18 @@ class ClientUser extends User {
593
402
  update: type,
594
403
  },
595
404
  });
596
- if (type !== 'STOP') this._packageName = packageName;
597
- else this._packageName = null;
405
+ if (type !== 'STOP') this.#packageName = packageName;
406
+ else this.#packageName = null;
598
407
  return this;
599
408
  }
600
409
 
601
- /**
602
- * Sets Discord Playing status to "Playing on Samsung Galaxy". Only selected gamss from discords database works
603
- * @param {string} packageName Android package name
604
- * @param {?string} type Must be START, UPDATE, or STOP
605
- * @returns {Promise<ClientUser>}
606
- * @example
607
- * // Set the client user's status
608
- * client.user.setSamsungActivity('com.YostarJP.BlueArchive', 'START');
609
- * // Update
610
- * client.user.setSamsungActivity('com.miHoYo.bh3oversea', 'UPDATE');
611
- * // Stop
612
- * client.user.setSamsungActivity('com.miHoYo.GenshinImpact', 'STOP');
613
- */
614
- async setSamsungActivity(packageName, type = 'START') {
615
- type = type.toUpperCase();
616
- if (!packageName || typeof packageName !== 'string') throw new Error('Package name is required.');
617
- if (!['START', 'UPDATE', 'STOP'].includes(type)) throw new Error('Invalid type (Must be START, UPDATE, or STOP)');
618
- await this.client.api.presences.post({
619
- data: {
620
- package_name: packageName,
621
- update: type,
622
- },
623
- });
624
- if (type !== 'STOP') this.#packageName = packageName;
625
- else this.#packageName = null;
626
- return this;
627
- }
628
-
629
410
  /**
630
411
  * Stop ringing
631
412
  * @param {ChannelResolvable} channel DMChannel | GroupDMChannel
632
413
  * @returns {Promise<void>}
633
414
  */
634
415
  stopRinging(channel) {
635
- const id = this.client.channels.resolveId(channel);
636
- if (!channel) return false;
637
- return this.client.api.channels(id).call['stop-ringing'].post({
416
+ return this.client.api.channels(this.client.channels.resolveId(channel)).call['stop-ringing'].post({
638
417
  data: {},
639
418
  });
640
419
  }
@@ -22,7 +22,7 @@ class ContextMenuInteraction extends BaseCommandInteraction {
22
22
  );
23
23
 
24
24
  /**
25
- * The id of the target of the interaction
25
+ * The id of the target of this interaction
26
26
  * @type {Snowflake}
27
27
  */
28
28
  this.targetId = data.data.target_id;