3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-19 16:05:01 +00:00

Migrate SelfGrantableRoles to new Plugin structure

This commit is contained in:
Dark 2020-07-27 00:08:01 +02:00
parent 4b33322127
commit 4c43e7cb28
10 changed files with 418 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import { TSelfGrantableRoleEntry, SelfGrantableRolesPluginType } from "../types";
import { PluginData } from "knub";
export function getApplyingEntries(
pluginData: PluginData<SelfGrantableRolesPluginType>,
msg,
): TSelfGrantableRoleEntry[] {
const config = pluginData.config.getForMessage(msg);
return Object.entries(config.entries)
.filter(
([k, e]) =>
e.can_use && !(!e.can_ignore_cooldown && pluginData.state.cooldowns.isOnCooldown(`${k}:${msg.author.id}`)),
)
.map(pair => pair[1]);
}