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,18 +121,22 @@ 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.attempt()) return; if (this.quotas.userset) {
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;
Database.getUserData(this, this.server).then((usr) => { if (!this.user.hasFlag('freeze_name', true)) {
Database.updateUser(this.user._id, this.user); Database.getUserData(this, this.server).then((usr) => {
Database.updateUser(this.user._id, this.user);
this.server.rooms.forEach((room) => { this.server.rooms.forEach((room) => {
room.updateParticipant(this.user._id, { room.updateParticipant(this.user._id, {
name: name name: name
});
}); });
}); });
}); }
} }
} }