djs-selfbot-v13 3.1.6 → 3.1.7

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 (148) hide show
  1. package/README.md +31 -16
  2. package/package.json +15 -8
  3. package/src/client/BaseClient.js +3 -2
  4. package/src/client/Client.js +539 -187
  5. package/src/client/actions/Action.js +13 -18
  6. package/src/client/actions/ActionsManager.js +1 -7
  7. package/src/client/actions/AutoModerationActionExecution.js +0 -1
  8. package/src/client/actions/AutoModerationRuleCreate.js +0 -1
  9. package/src/client/actions/AutoModerationRuleDelete.js +0 -1
  10. package/src/client/actions/AutoModerationRuleUpdate.js +0 -1
  11. package/src/client/actions/InteractionCreate.js +115 -0
  12. package/src/client/actions/MessageCreate.js +4 -0
  13. package/src/client/actions/PresenceUpdate.js +16 -17
  14. package/src/client/websocket/WebSocketManager.js +31 -11
  15. package/src/client/websocket/WebSocketShard.js +38 -39
  16. package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +23 -0
  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 +13 -16
  21. package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
  22. package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +11 -0
  23. package/src/client/websocket/handlers/GUILD_CREATE.js +0 -7
  24. package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +55 -0
  25. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +0 -0
  26. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +0 -0
  27. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.js +0 -0
  28. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +0 -0
  29. package/src/client/websocket/handlers/INTERACTION_CREATE.js +16 -0
  30. package/src/client/websocket/handlers/INTERACTION_FAILURE.js +18 -0
  31. package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +0 -1
  32. package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +30 -0
  33. package/src/client/websocket/handlers/MESSAGE_ACK.js +16 -0
  34. package/src/client/websocket/handlers/READY.js +137 -47
  35. package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +5 -7
  36. package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +4 -6
  37. package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +9 -32
  38. package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
  39. package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +8 -2
  40. package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
  41. package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +5 -1
  42. package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
  43. package/src/client/websocket/handlers/index.js +20 -15
  44. package/src/errors/Messages.js +69 -24
  45. package/src/index.js +43 -12
  46. package/src/managers/ApplicationCommandManager.js +12 -9
  47. package/src/managers/ApplicationCommandPermissionsManager.js +11 -3
  48. package/src/managers/ChannelManager.js +4 -2
  49. package/src/managers/ClientUserSettingManager.js +279 -161
  50. package/src/managers/DeveloperPortalManager.js +104 -0
  51. package/src/managers/GuildApplicationCommandManager.js +28 -0
  52. package/src/managers/GuildBanManager.js +1 -1
  53. package/src/managers/GuildChannelManager.js +0 -2
  54. package/src/managers/GuildFolderManager.js +24 -0
  55. package/src/managers/GuildForumThreadManager.js +28 -22
  56. package/src/managers/GuildMemberManager.js +216 -40
  57. package/src/managers/GuildSettingManager.js +15 -22
  58. package/src/managers/MessageManager.js +44 -42
  59. package/src/managers/PermissionOverwriteManager.js +1 -1
  60. package/src/managers/ReactionUserManager.js +5 -5
  61. package/src/managers/RelationshipManager.js +74 -81
  62. package/src/managers/SessionManager.js +57 -0
  63. package/src/managers/ThreadManager.js +45 -12
  64. package/src/managers/ThreadMemberManager.js +1 -1
  65. package/src/managers/UserManager.js +10 -6
  66. package/src/rest/APIRequest.js +20 -42
  67. package/src/rest/CaptchaSolver.js +132 -0
  68. package/src/rest/DiscordAPIError.js +16 -17
  69. package/src/rest/RESTManager.js +21 -1
  70. package/src/rest/RequestHandler.js +21 -35
  71. package/src/structures/ApplicationCommand.js +456 -19
  72. package/src/structures/ApplicationRoleConnectionMetadata.js +0 -3
  73. package/src/structures/AutoModerationRule.js +5 -5
  74. package/src/structures/AutocompleteInteraction.js +0 -1
  75. package/src/structures/BaseGuildTextChannel.js +12 -10
  76. package/src/structures/BaseGuildVoiceChannel.js +18 -16
  77. package/src/structures/{CallState.js → Call.js} +12 -17
  78. package/src/structures/CategoryChannel.js +0 -2
  79. package/src/structures/Channel.js +3 -2
  80. package/src/structures/ClientApplication.js +204 -0
  81. package/src/structures/ClientPresence.js +8 -12
  82. package/src/structures/ClientUser.js +336 -117
  83. package/src/structures/ContextMenuInteraction.js +1 -1
  84. package/src/structures/DMChannel.js +92 -29
  85. package/src/structures/DeveloperPortalApplication.js +520 -0
  86. package/src/structures/ForumChannel.js +10 -0
  87. package/src/structures/Guild.js +271 -135
  88. package/src/structures/GuildAuditLogs.js +5 -0
  89. package/src/structures/GuildChannel.js +2 -16
  90. package/src/structures/GuildFolder.js +75 -0
  91. package/src/structures/GuildMember.js +145 -27
  92. package/src/structures/Interaction.js +62 -1
  93. package/src/structures/InteractionResponse.js +114 -0
  94. package/src/structures/Invite.js +52 -35
  95. package/src/structures/Message.js +202 -222
  96. package/src/structures/MessageAttachment.js +0 -11
  97. package/src/structures/MessageButton.js +67 -1
  98. package/src/structures/MessageEmbed.js +1 -1
  99. package/src/structures/MessageMentions.js +2 -3
  100. package/src/structures/MessagePayload.js +46 -4
  101. package/src/structures/MessageReaction.js +1 -1
  102. package/src/structures/MessageSelectMenu.js +252 -1
  103. package/src/structures/Modal.js +180 -75
  104. package/src/structures/PartialGroupDMChannel.js +433 -0
  105. package/src/structures/Presence.js +2 -2
  106. package/src/structures/RichPresence.js +34 -14
  107. package/src/structures/Role.js +2 -18
  108. package/src/structures/SelectMenuInteraction.js +151 -2
  109. package/src/structures/Session.js +81 -0
  110. package/src/structures/Team.js +49 -0
  111. package/src/structures/TextInputComponent.js +70 -0
  112. package/src/structures/ThreadChannel.js +19 -0
  113. package/src/structures/User.js +345 -117
  114. package/src/structures/UserContextMenuInteraction.js +2 -2
  115. package/src/structures/VoiceState.js +39 -74
  116. package/src/structures/WebEmbed.js +52 -38
  117. package/src/structures/Webhook.js +11 -17
  118. package/src/structures/interfaces/Application.js +23 -146
  119. package/src/structures/interfaces/TextBasedChannel.js +256 -411
  120. package/src/util/ApplicationFlags.js +1 -1
  121. package/src/util/Constants.js +284 -106
  122. package/src/util/Formatters.js +2 -16
  123. package/src/util/LimitedCollection.js +1 -1
  124. package/src/util/Options.js +68 -48
  125. package/src/util/Permissions.js +0 -5
  126. package/src/util/PurchasedFlags.js +0 -2
  127. package/src/util/RemoteAuth.js +356 -221
  128. package/src/util/Sweepers.js +1 -1
  129. package/src/util/Util.js +36 -76
  130. package/src/util/Voice.js +1456 -0
  131. package/src/util/arRPC/index.js +229 -0
  132. package/src/util/arRPC/process/detectable.json +1 -0
  133. package/src/util/arRPC/process/index.js +102 -0
  134. package/src/util/arRPC/process/native/index.js +5 -0
  135. package/src/util/arRPC/process/native/linux.js +37 -0
  136. package/src/util/arRPC/process/native/win32.js +25 -0
  137. package/src/util/arRPC/transports/ipc.js +281 -0
  138. package/src/util/arRPC/transports/websocket.js +128 -0
  139. package/typings/enums.d.ts +73 -18
  140. package/typings/index.d.ts +1249 -897
  141. package/typings/rawDataTypes.d.ts +9 -68
  142. package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +0 -78
  143. package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +0 -12
  144. package/src/managers/UserNoteManager.js +0 -53
  145. package/src/structures/GroupDMChannel.js +0 -387
  146. package/src/util/AttachmentFlags.js +0 -38
  147. package/src/util/InviteFlags.js +0 -29
  148. package/src/util/RoleFlags.js +0 -37
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ const { Collection } = require('@discordjs/collection');
3
4
  const Base = require('./Base');
5
+ const ClientApplication = require('./ClientApplication');
4
6
  const VoiceState = require('./VoiceState');
5
7
  const TextBasedChannel = require('./interfaces/TextBasedChannel');
6
8
  const { Error } = require('../errors');
7
- const { RelationshipTypes } = require('../util/Constants');
9
+ const { RelationshipTypes, NitroType } = require('../util/Constants');
8
10
  const SnowflakeUtil = require('../util/SnowflakeUtil');
9
11
  const UserFlags = require('../util/UserFlags');
10
12
  const Util = require('../util/Util');
@@ -15,9 +17,8 @@ const Util = require('../util/Util');
15
17
  * @extends {Base}
16
18
  */
17
19
  class User extends Base {
18
- constructor(client, data) {
20
+ constructor(client, data, application) {
19
21
  super(client);
20
-
21
22
  /**
22
23
  * The user's id
23
24
  * @type {Snowflake}
@@ -30,6 +31,52 @@ class User extends Base {
30
31
 
31
32
  this.flags = null;
32
33
 
34
+ /**
35
+ * An array of object (connected accounts), containing the following properties:
36
+ * @property {string} type The account type (twitch, youtube, etc)
37
+ * @property {string} name The account name
38
+ * @property {string} id The account id
39
+ * @property {boolean} verified Whether the account is verified
40
+ * @see {@link https://discord.com/developers/docs/resources/user#connection-object}
41
+ * @typedef {Object} ConnectionAccount
42
+ */
43
+
44
+ /**
45
+ * Accounts connected to this user
46
+ * <info>The user must be force fetched for this property to be present or be updated</info>
47
+ * @type {?ConnectionAccount[]}
48
+ */
49
+ this.connectedAccounts = [];
50
+ /**
51
+ * Time that User has nitro (Unix Timestamp)
52
+ * <info>The user must be force fetched for this property to be present or be updated</info>
53
+ * @type {?number}
54
+ */
55
+ this.premiumSince = null;
56
+ /**
57
+ * Time that User has nitro and boost server (Unix Timestamp)
58
+ * @type {?number}
59
+ */
60
+ this.premiumGuildSince = null;
61
+ /**
62
+ * About me (User)
63
+ * <info>The user must be force fetched for this property to be present or be updated</info>
64
+ * @type {?string}
65
+ */
66
+ this.bio = null;
67
+ /**
68
+ * Pronouns (User)
69
+ * <info>The user must be force fetched for this property to be present or be updated</info>
70
+ * @type {?string}
71
+ */
72
+ this.pronouns = null;
73
+ this._mutualGuilds = [];
74
+ /**
75
+ * [Bot] Application
76
+ * @type {?ClientApplication}
77
+ */
78
+ this.application = application ? new ClientApplication(this.client, application, this) : null;
79
+ this._partial = true;
33
80
  this._patch(data);
34
81
  }
35
82
 
@@ -60,6 +107,10 @@ class User extends Base {
60
107
  * @type {?boolean}
61
108
  */
62
109
  this.bot = Boolean(data.bot);
110
+ if (this.bot === true && !this.application) {
111
+ this.application = new ClientApplication(this.client, { id: this.id }, this);
112
+ this.botInGuildsCount = null;
113
+ }
63
114
  } else if (!this.partial && typeof this.bot !== 'boolean') {
64
115
  this.bot = false;
65
116
  }
@@ -96,17 +147,6 @@ class User extends Base {
96
147
  this.banner ??= undefined;
97
148
  }
98
149
 
99
- if ('banner_color' in data) {
100
- /**
101
- * The user banner's hex
102
- * <info>The user must be force fetched for this property to be present or be updated</info>
103
- * @type {?string}
104
- */
105
- this.bannerColor = data.banner_color;
106
- } else if (this.bannerColor !== null) {
107
- this.bannerColor ??= undefined;
108
- }
109
-
110
150
  if ('accent_color' in data) {
111
151
  /**
112
152
  * The base 10 accent color of the user's banner
@@ -136,23 +176,252 @@ class User extends Base {
136
176
  this.flags = new UserFlags(data.public_flags);
137
177
  }
138
178
 
139
- if ('avatar_decoration_data' in data) {
179
+ if ('approximate_guild_count' in data) {
140
180
  /**
141
- * The user avatar decoration's hash
142
- * @type {?string}
181
+ * Check how many guilds the bot is in (Probably only approximate) (application.fetch() first)
182
+ * @type {?number}
143
183
  */
144
- this.avatarDecoration = data.avatar_decoration_data?.asset;
184
+ this.botInGuildsCount = data.approximate_guild_count;
185
+ }
186
+
187
+ if ('avatar_decoration' in data) {
145
188
  /**
146
- * The ID of the avatar decoration's SKU
147
- * @type {?Snowflake}
189
+ * The user avatar decoration's hash
190
+ * @type {?string}
148
191
  */
149
- this.avatarDecorationSKUId = data.avatar_decoration_data?.sku_id;
192
+ this.avatarDecoration = data.avatar_decoration;
150
193
  } else {
151
194
  this.avatarDecoration ??= null;
152
- this.avatarDecorationSKUId ??= null;
153
195
  }
154
196
  }
155
197
 
198
+ /**
199
+ * This user is on the same servers as Client User
200
+ * <info>The user must be force fetched for this property to be present or be updated</info>
201
+ * @type {Collection<Snowflake, Guild>}
202
+ * @readonly
203
+ */
204
+ get mutualGuilds() {
205
+ return new Collection(this._mutualGuilds.map(obj => [obj.id, obj]));
206
+ }
207
+
208
+ /**
209
+ * Get all mutual friends (Client -> User)
210
+ * @type {Promise<Collection<Snowflake, User>>}
211
+ * @readonly
212
+ */
213
+ get mutualFriends() {
214
+ // eslint-disable-next-line no-async-promise-executor
215
+ return new Promise(async resolve => {
216
+ const all = new Collection();
217
+ if (this.bot || this.client.user.id === this.id) return resolve(all);
218
+ const data = await this.client.api.users(this.id).relationships.get();
219
+ for (const u of data) {
220
+ all.set(u.id, this.client.users._add(u));
221
+ }
222
+ return resolve(all);
223
+ });
224
+ }
225
+
226
+ /**
227
+ * Check relationship status (Client -> User)
228
+ * @type {RelationshipTypes}
229
+ * @readonly
230
+ */
231
+ get relationships() {
232
+ const i = this.client.relationships.cache.get(this.id) ?? 0;
233
+ return RelationshipTypes[parseInt(i)];
234
+ }
235
+
236
+ /**
237
+ * Check note
238
+ * @type {?string}
239
+ * @readonly
240
+ */
241
+ get note() {
242
+ return this.client.user.notes.get(this.id);
243
+ }
244
+
245
+ /**
246
+ * Get friend nickname
247
+ * @type {?string}
248
+ * @readonly
249
+ */
250
+ get nickname() {
251
+ return this.client.user.friendNicknames.get(this.id);
252
+ }
253
+
254
+ /**
255
+ * The voice state of this member
256
+ * @type {VoiceState}
257
+ * @readonly
258
+ */
259
+ get voice() {
260
+ return (
261
+ this.client.voiceStates.cache.get(this.id) ??
262
+ this.client.guilds.cache.find(g => g?.voiceStates?.cache?.get(this.id))?.voiceStates?.cache?.get(this.id) ??
263
+ new VoiceState({ client: this.client }, { user_id: this.id })
264
+ );
265
+ }
266
+
267
+ _ProfilePatch(data) {
268
+ if (!data) return;
269
+
270
+ this._partial = false;
271
+
272
+ if (data.connected_accounts.length > 0) {
273
+ this.connectedAccounts = data.connected_accounts;
274
+ }
275
+
276
+ if ('premium_since' in data) {
277
+ const date = new Date(data.premium_since);
278
+ this.premiumSince = date.getTime();
279
+ }
280
+
281
+ if ('premium_guild_since' in data) {
282
+ const date = new Date(data.premium_guild_since);
283
+ this.premiumGuildSince = date.getTime();
284
+ }
285
+
286
+ if ('premium_type' in data) {
287
+ const nitro = NitroType[data.premium_type ?? 0];
288
+ /**
289
+ * Nitro type of the user.
290
+ * @type {NitroType}
291
+ */
292
+ this.nitroType = nitro ?? `UNKNOWN_TYPE_${data.premium_type}`;
293
+ }
294
+
295
+ if ('user_profile' in data) {
296
+ this.bio = data.user_profile.bio;
297
+ /**
298
+ * The user's theme colors (Profile theme) [Primary, Accent]
299
+ * <info>The user must be force fetched for this property to be present or be updated</info>
300
+ * @type {?Array<number>}
301
+ */
302
+ this.themeColors = data.user_profile.theme_colors;
303
+
304
+ this.pronouns = data.user_profile.pronouns;
305
+ }
306
+
307
+ if ('guild_member_profile' in data && 'guild_member' in data) {
308
+ const guild = this.client.guilds.cache.get(data.guild_member_profile.guild_id);
309
+ const member = guild?.members._add(data.guild_member);
310
+ member._ProfilePatch(data.guild_member_profile);
311
+ }
312
+
313
+ if ('application' in data) {
314
+ this.application = new ClientApplication(this.client, data.application, this);
315
+ }
316
+
317
+ if ('badges' in data) {
318
+ /**
319
+ * @callback BadgeIcon
320
+ * @returns {string}
321
+ */
322
+
323
+ /**
324
+ * @typedef {Object} UserBadge
325
+ * @property {string} id The id of the badge
326
+ * @property {string} description The description of the badge
327
+ * @property {string} icon The icon hash of the badge
328
+ * @property {?string} link The link of the badge
329
+ * @property {BadgeIcon} iconURL The iconURL of the badge
330
+ */
331
+
332
+ /**
333
+ * User badges (Boost, Slash, AutoMod, etc.)
334
+ * @type {?Array<UserBadge>}
335
+ */
336
+ this.badges = data.badges.map(o => ({ ...o, iconURL: () => this.client.rest.cdn.BadgeIcon(o.icon) }));
337
+ }
338
+
339
+ if ('guild_badges' in data) {
340
+ // Unknown
341
+ }
342
+
343
+ if ('mutual_guilds' in data) {
344
+ this._mutualGuilds = data.mutual_guilds;
345
+ }
346
+ }
347
+
348
+ /**
349
+ * Get profile from Discord, if client is in a server with the target.
350
+ * @type {User}
351
+ * @param {Snowflake | null} guildId The guild id to get the profile from
352
+ * @returns {Promise<User>}
353
+ */
354
+ async getProfile(guildId) {
355
+ if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
356
+ const query = guildId
357
+ ? {
358
+ with_mutual_guilds: true,
359
+ guild_id: guildId,
360
+ }
361
+ : {
362
+ with_mutual_guilds: true,
363
+ };
364
+ const data = await this.client.api.users(this.id).profile.get({
365
+ query,
366
+ });
367
+ this._ProfilePatch(data);
368
+ return this;
369
+ }
370
+
371
+ /**
372
+ * Friends the user [If incoming request]
373
+ * @type {boolean}
374
+ * @returns {Promise<boolean>}
375
+ */
376
+ setFriend() {
377
+ return this.client.relationships.addFriend(this);
378
+ }
379
+
380
+ /**
381
+ * Changes the nickname of the friend
382
+ * @param {?string} nickname The nickname to change
383
+ * @type {boolean}
384
+ * @returns {Promise<boolean>}
385
+ */
386
+ setNickname(nickname) {
387
+ return this.client.relationships.setNickname(this.id, nickname);
388
+ }
389
+
390
+ /**
391
+ * Send Friend Request to the user
392
+ * @type {boolean}
393
+ * @returns {Promise<boolean>}
394
+ */
395
+ sendFriendRequest() {
396
+ return this.client.relationships.sendFriendRequest(this.username, this.discriminator);
397
+ }
398
+ /**
399
+ * Blocks the user
400
+ * @type {boolean}
401
+ * @returns {Promise<boolean>}
402
+ */
403
+ setBlock() {
404
+ return this.client.relationships.addBlocked(this);
405
+ }
406
+
407
+ /**
408
+ * Removes the user from your blocks list
409
+ * @type {boolean}
410
+ * @returns {Promise<boolean>}
411
+ */
412
+ unBlock() {
413
+ return this.client.relationships.deleteBlocked(this);
414
+ }
415
+
416
+ /**
417
+ * Removes the user from your friends list
418
+ * @type {boolean}
419
+ * @returns {Promise<boolean>}
420
+ */
421
+ unFriend() {
422
+ return this.client.relationships.deleteFriend(this);
423
+ }
424
+
156
425
  /**
157
426
  * Whether this User is a partial
158
427
  * @type {boolean}
@@ -239,11 +508,47 @@ class User extends Base {
239
508
  * @returns {?string}
240
509
  */
241
510
  bannerURL({ format, size, dynamic } = {}) {
242
- if (typeof this.banner === 'undefined') throw new Error('USER_BANNER_NOT_FETCHED');
511
+ if (typeof this.banner === 'undefined') {
512
+ throw new Error('USER_BANNER_NOT_FETCHED');
513
+ }
243
514
  if (!this.banner) return null;
244
515
  return this.client.rest.cdn.Banner(this.id, this.banner, format, size, dynamic);
245
516
  }
246
517
 
518
+ /**
519
+ * Ring the user's phone / PC (call)
520
+ * @returns {Promise<boolean>}
521
+ */
522
+ ring() {
523
+ if (this.relationships !== 'FRIEND') return Promise.reject(new Error('USER_NOT_FRIEND'));
524
+ if (!this.client.user.voice?.channelId || !this.client.callVoice) {
525
+ return Promise.reject(new Error('CLIENT_NO_CALL'));
526
+ }
527
+ return new Promise((resolve, reject) => {
528
+ this.client.api
529
+ .channels(this.dmChannel.id)
530
+ .call.ring.post({
531
+ data: {
532
+ recipients: [this.id],
533
+ },
534
+ })
535
+ .then(() => resolve(true))
536
+ .catch(e => {
537
+ reject(e);
538
+ });
539
+ });
540
+ }
541
+
542
+ /**
543
+ * The hexadecimal version of the user theme color, with a leading hash [Primary, Accent]
544
+ * <info>The user must be force fetched for this property to be present or be updated</info>
545
+ * @type {?Array<string>}
546
+ * @readonly
547
+ */
548
+ get hexThemeColor() {
549
+ return this.themeColors?.map(c => `#${c.toString(16).padStart(6, '0')}`) || null;
550
+ }
551
+
247
552
  /**
248
553
  * The tag of this user
249
554
  * <info>This user's username, or their legacy tag (e.g. `hydrabolt#0001`)
@@ -311,7 +616,8 @@ class User extends Base {
311
616
  this.avatar === user.avatar &&
312
617
  this.flags?.bitfield === user.flags?.bitfield &&
313
618
  this.banner === user.banner &&
314
- this.accentColor === user.accentColor
619
+ this.accentColor === user.accentColor &&
620
+ this.bio === user.bio
315
621
  );
316
622
  }
317
623
 
@@ -353,28 +659,6 @@ class User extends Base {
353
659
  return this.client.users.fetch(this.id, { force });
354
660
  }
355
661
 
356
- /**
357
- * Returns a user profile object for a given user ID.
358
- * <info>This endpoint requires one of the following:
359
- * - The user is a bot
360
- * - The user shares a mutual guild with the current user
361
- * - The user is a friend of the current user
362
- * - The user is a friend suggestion of the current user
363
- * - The user has an outgoing friend request to the current user</info>
364
- * @param {Snowflake} [guildId] The guild ID to get the user's member profile in
365
- * @returns {Promise<Object>}
366
- * @see {@link https://discord-userdoccers.vercel.app/resources/user#response-body}
367
- */
368
- getProfile(guildId) {
369
- return this.client.api.users(this.id).profile.get({
370
- query: {
371
- with_mutual_guilds: true,
372
- with_mutual_friends_count: true,
373
- guild_id: guildId,
374
- },
375
- });
376
- }
377
-
378
662
  /**
379
663
  * When concatenated with a string, this automatically returns the user's mention instead of the User object.
380
664
  * @returns {string}
@@ -403,85 +687,29 @@ class User extends Base {
403
687
  }
404
688
 
405
689
  /**
406
- * The function updates the note of a user and returns the updated user.
407
- * @param {string|null|undefined} [note=null] - The `note` parameter is the new value that you want to set for the note of the
408
- * user. It is an optional parameter and its default value is `null`.
409
- * @returns {Promise<User>} The `setNote` method is returning the `User` object.
690
+ * Set note to user
691
+ * @param {string} note Note to set
692
+ * @returns {Promise<User>}
410
693
  */
411
694
  async setNote(note = null) {
412
- await this.client.notes.updateNote(this.id, note);
695
+ await this.client.api.users['@me'].notes(this.id).put({ data: { note } });
413
696
  return this;
414
697
  }
415
698
 
416
699
  /**
417
- * The function returns the note associated with a specific client ID from a cache.
418
- * @type {?string} The note that corresponds to the given id.
700
+ * Get presence (~ v12)
701
+ * @returns {Promise<Presence | null>}
419
702
  */
420
- get note() {
421
- return this.client.notes.cache.get(this.id);
422
- }
423
-
424
- /**
425
- * The voice state of this member
426
- * @type {VoiceState}
427
- * @readonly
428
- */
429
- get voice() {
430
- return (
431
- this.client.voiceStates.cache.get(this.id) ??
432
- this.client.guilds.cache.find(g => g?.voiceStates?.cache?.get(this.id))?.voiceStates?.cache?.get(this.id) ??
433
- new VoiceState({ client: this.client }, { user_id: this.id })
703
+ async presenceFetch() {
704
+ let data = null;
705
+ await Promise.all(
706
+ this.client.guilds.cache.map(async guild => {
707
+ const res_ = await guild.presences.resolve(this.id);
708
+ if (res_) return (data = res_);
709
+ return true;
710
+ }),
434
711
  );
435
- }
436
-
437
- /**
438
- * Ring the user's phone / PC (call)
439
- * @returns {Promise<void>}
440
- * @deprecated
441
- */
442
- ring() {
443
- return this.client.api.channels(this.dmChannel.id).call.ring.post({
444
- data: {
445
- recipients: [this.id],
446
- },
447
- });
448
- }
449
-
450
- /**
451
- * Send Friend Request to the user
452
- * @type {boolean}
453
- * @returns {Promise<boolean>}
454
- */
455
- sendFriendRequest() {
456
- return this.client.relationships.sendFriendRequest({ user: this });
457
- }
458
-
459
- /**
460
- * Unblock / Unfriend / Cancels a friend request
461
- * @type {boolean}
462
- * @returns {Promise<boolean>}
463
- */
464
- deleteRelationship() {
465
- return this.client.relationships.deleteRelationship(this);
466
- }
467
-
468
- /**
469
- * Check relationship status (Client -> User)
470
- * @type {RelationshipTypes}
471
- * @readonly
472
- */
473
- get relationship() {
474
- const i = this.client.relationships.cache.get(this.id) ?? 0;
475
- return RelationshipTypes[parseInt(i)];
476
- }
477
-
478
- /**
479
- * Get friend nickname
480
- * @type {?string}
481
- * @readonly
482
- */
483
- get friendNickname() {
484
- return this.client.relationships.friendNicknames.get(this.id);
712
+ return data;
485
713
  }
486
714
  }
487
715
 
@@ -8,7 +8,7 @@ const ContextMenuInteraction = require('./ContextMenuInteraction');
8
8
  */
9
9
  class UserContextMenuInteraction extends ContextMenuInteraction {
10
10
  /**
11
- * The target user from this interaction
11
+ * The user this interaction was sent from
12
12
  * @type {User}
13
13
  * @readonly
14
14
  */
@@ -17,7 +17,7 @@ class UserContextMenuInteraction extends ContextMenuInteraction {
17
17
  }
18
18
 
19
19
  /**
20
- * The target member from this interaction
20
+ * The member this interaction was sent from
21
21
  * @type {?(GuildMember|APIGuildMember)}
22
22
  * @readonly
23
23
  */