3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

added match by role name functionality to roles plugin

This commit is contained in:
roflmaoqwerty 2020-01-10 01:04:58 +11:00
parent fa1e8b78f5
commit d16a67bca3
3 changed files with 64 additions and 10 deletions

View file

@ -16,6 +16,7 @@ import {
trimEmptyStartEndLines,
trimIndents,
UnknownUser,
resolveRoleId,
} from "../utils";
import { Invite, Member, User } from "eris";
import DiscordRESTError from "eris/lib/errors/DiscordRESTError"; // tslint:disable-line
@ -237,6 +238,16 @@ export class ZeppelinPlugin<TConfig extends {} = IBasePluginConfig> extends Plug
return user;
}
/**
* Resolves a role from the passed string. The passed string can be a role ID, a role mention or a role name.
* In the event of duplicate role names, this function will return the first one it comes across.
* @param roleResolvable
*/
async resolveRoleId(roleResolvable: string): Promise<string> {
const roleId = await resolveRoleId(this.bot, this.guildId, roleResolvable);
return roleId;
}
/**
* Resolves a member from the passed string. The passed string can be a user id, a user mention, a full username (with discrim), etc.
* If the member is not found in the cache, it's fetched from the API.