mirror of
https://github.com/projectdysnomia/dysnomia.git
synced 2026-12-02 13:48:31 +02:00
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
const User = require("./User");
|
|
|
|
/**
|
|
* Represents an extended user
|
|
* @extends User
|
|
*/
|
|
class ExtendedUser extends User {
|
|
update(data) {
|
|
super.update(data);
|
|
if(data.email !== undefined) {
|
|
/**
|
|
* The email of the user
|
|
* @type {String?}
|
|
*/
|
|
this.email = data.email;
|
|
}
|
|
if(data.verified !== undefined) {
|
|
/**
|
|
* Whether the account email has been verified
|
|
* @type {Boolean?}
|
|
*/
|
|
this.verified = data.verified;
|
|
}
|
|
if(data.mfa_enabled !== undefined) {
|
|
/**
|
|
* Whether the user has enabled two-factor authentication
|
|
* @type {Boolean?}
|
|
*/
|
|
this.mfaEnabled = data.mfa_enabled;
|
|
}
|
|
if(data.premium_type !== undefined) {
|
|
/**
|
|
* The type of Nitro subscription on the user's account
|
|
* @type {Number?}
|
|
*/
|
|
this.premiumType = data.premium_type;
|
|
}
|
|
}
|
|
|
|
toJSON(props = []) {
|
|
return super.toJSON([
|
|
"email",
|
|
"mfaEnabled",
|
|
"premium",
|
|
"verified",
|
|
...props
|
|
]);
|
|
}
|
|
}
|
|
|
|
module.exports = ExtendedUser;
|