3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 04:45:02 +00:00

Run prettier and check tslint on entire codebase

Mainly to run these checks for the recent pull requests.
This commit is contained in:
Dragory 2020-01-12 11:47:54 +02:00
parent 65880d2e60
commit 1aceb55a87
15 changed files with 89 additions and 60 deletions

View file

@ -956,25 +956,25 @@ export async function resolveMember(bot: Client, guild: Guild, value: string): P
return null;
}
export async function resolveRoleId(bot: Client, guildId: string, value: string){
if(value == null){
export async function resolveRoleId(bot: Client, guildId: string, value: string) {
if (value == null) {
return null;
}
//role mention
// Role mention
const mentionMatch = value.match(/^<@&?(\d+)>$/);
if(mentionMatch){
if (mentionMatch) {
return mentionMatch[1];
}
//role name
let roleList = await bot.getRESTGuildRoles(guildId);
let role = roleList.filter(x => x.name.toLocaleLowerCase() == value.toLocaleLowerCase());
if(role[0]){
// Role name
const roleList = await bot.getRESTGuildRoles(guildId);
const role = roleList.filter(x => x.name.toLocaleLowerCase() === value.toLocaleLowerCase());
if (role[0]) {
return role[0].id;
}
//role ID
// Role ID
const idMatch = value.match(/^\d+$/);
if (idMatch) {
return value;