fetch settings

This commit is contained in:
Erik 2020-04-19 22:54:57 +03:00
parent e05ebb9b62
commit b393478796

View File

@ -18,6 +18,14 @@ const User = Structures.extend('User', (User) => {
return Date.now()-this._cached;
}
async settings() {
if (!this._settings) this._settings = this.client.transactionHandler._send({ provider: 'mongodb', request: { collection: 'user_settings', type: 'findOne', query: { user: this.id } } });
if (this._settings instanceof Promise) this._settings = await this._settings || {};
return this._settings;
}
}
return ExtendedUser;