mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Updated user class
This commit is contained in:
48
lib/user.js
48
lib/user.js
@@ -18,33 +18,29 @@ var User = (function () {
|
||||
|
||||
// access using user.avatarURL;
|
||||
|
||||
User.prototype.mention = function mention() {
|
||||
return "<@" + this.id + ">";
|
||||
};
|
||||
|
||||
User.prototype.toString = function toString() {
|
||||
/*
|
||||
if we embed a user in a String - like so:
|
||||
"Yo " + user + " what's up?"
|
||||
It would generate something along the lines of:
|
||||
"Yo @hydrabolt what's up?"
|
||||
*/
|
||||
return this.mention();
|
||||
};
|
||||
|
||||
User.prototype.equals = function equals(object) {
|
||||
return object.id === this.id;
|
||||
};
|
||||
|
||||
User.prototype.equalsStrict = function equalsStrict(object) {
|
||||
return object.id === this.id && object.avatar === this.avatar && object.username === this.username && object.discriminator === this.discriminator;
|
||||
};
|
||||
|
||||
_createClass(User, [{
|
||||
key: "mention",
|
||||
value: function mention() {
|
||||
return "<@" + this.id + ">";
|
||||
}
|
||||
}, {
|
||||
key: "toString",
|
||||
value: function toString() {
|
||||
/*
|
||||
if we embed a user in a String - like so:
|
||||
"Yo " + user + " what's up?"
|
||||
It would generate something along the lines of:
|
||||
"Yo @hydrabolt what's up?"
|
||||
*/
|
||||
return this.mention();
|
||||
}
|
||||
}, {
|
||||
key: "equals",
|
||||
value: function equals(object) {
|
||||
return object.id === this.id;
|
||||
}
|
||||
}, {
|
||||
key: "equalsStrict",
|
||||
value: function equalsStrict(object) {
|
||||
return object.id === this.id && object.avatar === this.avatar && object.username === this.username && object.discriminator === this.discriminator;
|
||||
}
|
||||
}, {
|
||||
key: "avatarURL",
|
||||
get: function get() {
|
||||
if (!this.avatar) return null;
|
||||
|
||||
Reference in New Issue
Block a user