method for checking invite

This commit is contained in:
Erik 2020-11-12 20:12:46 +02:00
parent 6ab22a02bf
commit f632ae54b4

View File

@ -17,8 +17,19 @@ const Guild = Structures.extend('Guild', (Guild) => {
this.callbacks = []; this.callbacks = [];
this.webhooks = new Collection(); this.webhooks = new Collection();
this.invites = null;
} }
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;
}
//Fetch and cache settings //Fetch and cache settings
async settings() { async settings() {
if(!this._settings) this._settings = this.client.storageManager.mongodb.guilds.findOne({ guildId: this.id }); if(!this._settings) this._settings = this.client.storageManager.mongodb.guilds.findOne({ guildId: this.id });