merge default perms for users

This commit is contained in:
Erik 2022-03-23 17:09:21 +02:00
parent 51601e9972
commit cf1711ead7
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589

View File

@ -26,7 +26,7 @@ class Users extends EventEmitter {
const id = user.id || user;
this.emit('debug', `User perms query for ${id}`);
const userPartial = await this.database.findOne(this.collection, { id });
user = { ...user, ...userPartial };
user = { ...this.defaultPermissions, ...userPartial, ...user };
user.tag = `${user.username}#${user.discriminator}`;
this.emit('debug', `Result for ${id}: ${JSON.stringify(userPartial)}`);
if (userPartial) return user;
@ -44,6 +44,13 @@ class Users extends EventEmitter {
}
get defaultPermissions() {
return {
admin: false,
upload: false
};
}
}
module.exports = Users;