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) {
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) {
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
* @memberof Resolver
*/
async resolveChannels(resolveables = [], guild, strict = false) {
resolveChannels(resolveables = [], guild, strict = false) {
if(typeof resolveables === 'string') resolveables = [ resolveables ];
if(resolveables.length === 0) return false;
@ -263,6 +263,13 @@ class Resolver {
return resolved.length > 0 ? resolved : false;
}
resolveChannel(resolveable, guild, strict) {
let result = this.resolveChannels([resolveable], guild, strict);
return result ? result[0] : false;
}
/**
* Resolve multiple roles
@ -309,6 +316,13 @@ class Resolver {
return resolved.length > 0 ? resolved : false;
}
async resolveRole(resolveable, guild, strict) {
let result = await this.resolveRoles([resolveable], guild, strict);
return result ? result[0] : false;
}
}