galactic-bot/structure/extensions/Guild.js

60 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-04-08 18:08:46 +02:00
const { Structures } = require('discord.js');
const Guild = Structures.extend('Guild', (Guild) => {
class ExtendedGuild extends Guild {
constructor(...args) {
super(...args);
this._settings = null; //internal cache of current guild's settings; should ALWAYS stay the same as database.
}
2020-04-11 10:06:39 +02:00
async resolveMembers(members, strict = false) {
return await this.client.resolver.resolveMembers(members, this, strict);
}
async resolveMember(member, strict) {
let [ result ] = await this.resolveMembers([ member ], strict);
return result;
2020-04-11 10:06:39 +02:00
}
async resolveChannels(channels, strict = false) {
return await this.client.resolver.resolveChannels(channels, this, strict);
}
async resolveChannel(channel, strict) {
let [ result ] = await this.resolveMembers([ channel ], strict);
return result;
}
2020-04-11 10:06:39 +02:00
async resolveRoles(roles, strict = false) {
return await this.client.resolver.resolveRoles(roles, this, strict);
}
async resolveRole(role, strict) {
let [ result ] = await this.resolveRoles([ role ], strict);
return result;
}
2020-04-08 18:08:46 +02:00
}
return ExtendedGuild;
});
module.exports = Guild;