Fixing in user.js

This commit is contained in:
Akif9748 2022-04-06 21:57:12 +03:00
parent 8178709f67
commit 0144741a97

View file

@ -29,11 +29,13 @@ module.exports = class User {
}
async getByName(Name = this.name) {
const user = await UserModel.findOne({ name: Name });
if (!user) return null;
const { name = "guest", avatar = "/images/guest.png", time = Date.now(), admin = false, deleted = false } = user;
const { id, name = "guest", avatar = "/images/guest.png", time = Date.now(), admin = false, deleted = false } = user;
this.id = Number(id);
this.name = name;
this.avatar = avatar;
this.time = time;