mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
4.0.0 and dists
This commit is contained in:
61
lib/user.js
61
lib/user.js
@@ -1,54 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var User = (function () {
|
||||
function User(data) {
|
||||
_classCallCheck(this, User);
|
||||
|
||||
this.username = data.username;
|
||||
this.discriminator = data.discriminator;
|
||||
this.id = data.id;
|
||||
this.avatar = data.avatar;
|
||||
this.status = data.status || "offline";
|
||||
this.gameId = data.game_id || null;
|
||||
}
|
||||
|
||||
// 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: "avatarURL",
|
||||
get: function get() {
|
||||
if (!this.avatar) return null;
|
||||
return "https://discordapp.com/api/users/" + this.id + "/avatars/" + this.avatar + ".jpg";
|
||||
}
|
||||
}]);
|
||||
|
||||
return User;
|
||||
})();
|
||||
|
||||
module.exports = User;
|
||||
"use strict";var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if("value" in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var User=(function(){function User(data){_classCallCheck(this,User);this.username = data.username;this.discriminator = data.discriminator;this.id = data.id;this.avatar = data.avatar;this.status = data.status || "offline";this.gameId = data.game_id || null;} // 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:"avatarURL",get:function get(){if(!this.avatar)return null;return "https://discordapp.com/api/users/" + this.id + "/avatars/" + this.avatar + ".jpg";}}]);return User;})();module.exports = User;
|
||||
|
||||
Reference in New Issue
Block a user