mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
add clientuser#friends (#807)
* add client#friends * Update Ready.js * Update Client.js * move friends to client.user * Update ClientUser.js * Update ClientUser.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
fc307fab8a
commit
e04dbbdb82
File diff suppressed because one or more lines are too long
@@ -16,6 +16,11 @@ class ReadyHandler extends AbstractHandler {
|
||||
for (const guild of data.guilds) client.dataManager.newGuild(guild);
|
||||
for (const privateDM of data.private_channels) client.dataManager.newChannel(privateDM);
|
||||
|
||||
for (const relation of data.relationships) {
|
||||
const friend = client.dataManager.newUser(relation.user);
|
||||
client.user.friends.set(friend.id, friend);
|
||||
}
|
||||
|
||||
data.presences = data.presences || [];
|
||||
for (const presence of data.presences) {
|
||||
client.dataManager.newUser(presence.user);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const User = require('./User');
|
||||
const Collection = require('../util/Collection');
|
||||
|
||||
/**
|
||||
* Represents the logged in client's Discord User
|
||||
@@ -21,6 +22,13 @@ class ClientUser extends User {
|
||||
this.email = data.email;
|
||||
this.localPresence = {};
|
||||
this._typing = new Map();
|
||||
|
||||
/**
|
||||
* A Collection of friends for the logged in user.
|
||||
* <warn>This is only filled for user accounts, not bot accounts!</warn>
|
||||
* @type {Collection<string, User>}
|
||||
*/
|
||||
this.friends = new Collection();
|
||||
}
|
||||
|
||||
edit(data) {
|
||||
|
||||
Reference in New Issue
Block a user