mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
2.7.1, user updates are now tracked
This commit is contained in:
46
lib/user.js
46
lib/user.js
@@ -1,31 +1,37 @@
|
||||
exports.User = function(username, id, discriminator, avatar){
|
||||
exports.User = function( username, id, discriminator, avatar ) {
|
||||
|
||||
if(!id){ //there's no second argument
|
||||
var user = username;
|
||||
username = user.username;
|
||||
id = user.id;
|
||||
discriminator = user.discriminator;
|
||||
avatar = user.avatar;
|
||||
}
|
||||
if ( !id ) { //there's no second argument
|
||||
var user = username;
|
||||
username = user.username;
|
||||
id = user.id;
|
||||
discriminator = user.discriminator;
|
||||
avatar = user.avatar;
|
||||
}
|
||||
|
||||
this.username = username;
|
||||
this.discriminator = discriminator;
|
||||
this.id = id;
|
||||
this.avatar = avatar;
|
||||
this.username = username;
|
||||
this.discriminator = discriminator;
|
||||
this.id = id;
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
exports.User.prototype.getAvatarURL = function(){
|
||||
if(!this.avatar)
|
||||
return false;
|
||||
return "https://discordapp.com/api/users/" + this.id + "/avatars/" + this.avatar + ".jpg";
|
||||
exports.User.prototype.getAvatarURL = function() {
|
||||
if ( !this.avatar )
|
||||
return false;
|
||||
return "https://discordapp.com/api/users/" + this.id + "/avatars/" + this.avatar + ".jpg";
|
||||
}
|
||||
|
||||
exports.User.prototype.mention = function(){
|
||||
return "<@"+this.id+">";
|
||||
exports.User.prototype.mention = function() {
|
||||
return "<@" + this.id + ">";
|
||||
}
|
||||
|
||||
exports.User.prototype.equals = function(otherUser){
|
||||
exports.User.prototype.equals = function( otherUser ) {
|
||||
|
||||
return otherUser.id === this.id;
|
||||
return otherUser.id === this.id;
|
||||
|
||||
}
|
||||
|
||||
exports.User.prototype.equalsStrict = function( otherUser ) {
|
||||
|
||||
return ( this.username === otherUser.username && this.discriminator === otherUser.discriminator && this.id === otherUser.id && this.avatar === otherUser.avatar );
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user