bot/src/assertions/userLevel.ts

16 lines
351 B
TypeScript
Raw Normal View History

import { GuildMember, Guild } from 'discord.js';
2020-02-01 23:23:36 +00:00
import { developers } from '@config/bot';
export function calcUserLevel(user: GuildMember, guild: Guild) {
if (developers.includes(user.id)) {
return 5;
}
if (user.id === guild.ownerID) {
return 3;
}
if (user.permissions.has('ADMINISTRATOR', true)) {
return 2;
}
return 0;
}