singular resolvers

This commit is contained in:
Erik 2020-05-17 14:04:58 +03:00
parent c779b21311
commit e355d535b6

View File

@ -138,7 +138,7 @@ class Resolver {
async resolveUser(resolveable, strict) { async resolveUser(resolveable, strict) {
let result = await this.resolveUsers([ resolveable ], strict); let result = await this.resolveUsers([ resolveable ], strict);
return result; return result ? result[0] : false;
} }
/** /**
@ -204,7 +204,7 @@ class Resolver {
async resolveMember(resolveable, guild, strict) { async resolveMember(resolveable, guild, strict) {
let result = await this.resolveMembers([ resolveable ], guild, strict); let result = await this.resolveMembers([ resolveable ], guild, strict);
return result; return result ? result[0] : false;
} }
@ -217,7 +217,7 @@ class Resolver {
* @returns {array<GuildChannel> || false} an array of guild channels or false if none were resolved * @returns {array<GuildChannel> || false} an array of guild channels or false if none were resolved
* @memberof Resolver * @memberof Resolver
*/ */
async resolveChannels(resolveables = [], guild, strict = false) { resolveChannels(resolveables = [], guild, strict = false) {
if(typeof resolveables === 'string') resolveables = [ resolveables ]; if(typeof resolveables === 'string') resolveables = [ resolveables ];
if(resolveables.length === 0) return false; if(resolveables.length === 0) return false;
@ -264,6 +264,13 @@ class Resolver {
} }
resolveChannel(resolveable, guild, strict) {
let result = this.resolveChannels([resolveable], guild, strict);
return result ? result[0] : false;
}
/** /**
* Resolve multiple roles * Resolve multiple roles
* *
@ -310,6 +317,13 @@ class Resolver {
} }
async resolveRole(resolveable, guild, strict) {
let result = await this.resolveRoles([resolveable], guild, strict);
return result ? result[0] : false;
}
} }
module.exports = Resolver; module.exports = Resolver;