Make presences track users and guilds, emit them in presenceUpdate

This commit is contained in:
Amish Shah
2018-08-10 16:46:14 +01:00
parent fe8ece0192
commit 08eff66939
7 changed files with 32 additions and 13 deletions

View File

@@ -14,9 +14,27 @@ const { ActivityTypes, ActivityFlags } = require('../util/Constants');
class Presence {
constructor(client, data = {}) {
Object.defineProperty(this, 'client', { value: client });
this.userID = data.user.id;
this.guild = data.guild;
this.patch(data);
}
/**
* The user of this presence
* @type {User}
*/
get user() {
return this.client.users.get(this.userID);
}
/**
* The member of this presence
* @type {GuildMember}
*/
get member() {
return this.guild.members.get(this.userID);
}
patch(data) {
/**
* The status of the presence: