mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Added ClientUser modification support
This commit is contained in:
@@ -14,13 +14,35 @@ class User {
|
||||
this.discriminator = data.discriminator;
|
||||
this.avatar = data.avatar;
|
||||
this.bot = Boolean(data.bot);
|
||||
this.status = data.status || 'offline';
|
||||
this.game = data.game;
|
||||
this.status = data.status || this.status || 'offline';
|
||||
this.game = data.game || this.game;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `<@${this.id}>`;
|
||||
}
|
||||
|
||||
equals(user) {
|
||||
let base = (
|
||||
this.username === user.username &&
|
||||
this.id === user.id &&
|
||||
this.discriminator === user.discriminator &&
|
||||
this.avatar === user.avatar &&
|
||||
this.bot === Boolean(user.bot)
|
||||
);
|
||||
|
||||
if (base) {
|
||||
if (user.status) {
|
||||
base = this.status === user.status;
|
||||
}
|
||||
|
||||
if (user.game) {
|
||||
base = this.game === user.game;
|
||||
}
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = User;
|
||||
|
||||
Reference in New Issue
Block a user