mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
refactor(Presences): remove from User, nullable on GuildMember (#6055)
as well as on Client#presenceUpdate
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const { Presence } = require('./Presence');
|
||||
const VoiceState = require('./VoiceState');
|
||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||
const { Error } = require('../errors');
|
||||
@@ -133,19 +132,11 @@ class GuildMember extends Base {
|
||||
|
||||
/**
|
||||
* The presence of this guild member
|
||||
* @type {Presence}
|
||||
* @type {?Presence}
|
||||
* @readonly
|
||||
*/
|
||||
get presence() {
|
||||
return (
|
||||
this.guild.presences.cache.get(this.id) ??
|
||||
new Presence(this.client, {
|
||||
user: {
|
||||
id: this.id,
|
||||
},
|
||||
guild: this.guild,
|
||||
})
|
||||
);
|
||||
return this.guild.presences.resolve(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const { Presence } = require('./Presence');
|
||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||
const { Error } = require('../errors');
|
||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||
@@ -122,18 +121,6 @@ class User extends Base {
|
||||
return new Date(this.createdTimestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* The presence of this user
|
||||
* @type {Presence}
|
||||
* @readonly
|
||||
*/
|
||||
get presence() {
|
||||
for (const guild of this.client.guilds.cache.values()) {
|
||||
if (guild.presences.cache.has(this.id)) return guild.presences.cache.get(this.id);
|
||||
}
|
||||
return new Presence(this.client, { user: { id: this.id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* A link to the user's avatar.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
|
||||
Reference in New Issue
Block a user