Files
TTtie dc3129e2a4 refactor: switch to ESLint flat config, add JSDoc linting (#147)
This commit switches Dysnomia over to ESLint flat config for
futureproofing and better maintainability. For the most part, the
codebase will pass the test suite, apart from a few exceptions
introduced by the stylistic plugin which I believe are reasonable to
include.

Additionally, JSDoc linting was added to maintain proper 
alignment of various features.
2024-08-02 18:56:44 +00:00

58 lines
1.3 KiB
JavaScript

"use strict";
const User = require("./User");
/**
* Represents an extended user
* @extends User
*/
class ExtendedUser extends User {
constructor(data, client) {
super(data, client);
}
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;