perms fetch

This commit is contained in:
Erik 2022-03-28 01:43:12 +03:00
parent f165ee2016
commit d29107cced
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -17,6 +17,14 @@ class GuildWrapper {
}
async checkInvite(code) {
// Is maintained by the utility hook
if (!this.invites && this.me.hasPermission('MANAGE_GUILD')) this.invites = await this.fetchInvites();
return this.invites?.has(code) || false;
}
async settings(forceFetch = false) {
if (this._settings && !forceFetch) return this._settings;
@ -43,6 +51,16 @@ class GuildWrapper {
}
}
async permissions() {
if (this._permissions) return this._permissions;
const perms = await this.client.storageManager.mongodb.permissions.findOne({ guildId: this.id });
if (!perms) this._permissions = { guildId: this.id };
else this._permissions = perms;
return this._permissions;
}
/**
* Update a webhook entry in the database
*