mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
Make presences track users and guilds, emit them in presenceUpdate
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user