This commit is contained in:
Hri7566 2022-09-23 23:46:06 -04:00
parent bef6dbecf6
commit 9fd2a80167
1 changed files with 12 additions and 8 deletions

View File

@ -121,9 +121,12 @@ class Client extends EventEmitter {
*/ */
userset(name, admin) { userset(name, admin) {
if (name.length > 40 && !admin) return; if (name.length > 40 && !admin) return;
if (this.quotas.userset) {
if (!this.quotas.userset.attempt()) return; if (!this.quotas.userset.attempt()) return;
}
if (!this.user.hasFlag('freeze_name', true) || admin) { if (!this.user.hasFlag('freeze_name', true) || admin) {
this.user.name = name; this.user.name = name;
if (!this.user.hasFlag('freeze_name', true)) {
Database.getUserData(this, this.server).then((usr) => { Database.getUserData(this, this.server).then((usr) => {
Database.updateUser(this.user._id, this.user); Database.updateUser(this.user._id, this.user);
@ -135,6 +138,7 @@ class Client extends EventEmitter {
}); });
} }
} }
}
/** /**
* Set rate limits * Set rate limits