3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-19 16:05:01 +00:00
zeppelin/backend/src/plugins/SelfGrantableRoles/util/getApplyingEntries.ts

15 lines
525 B
TypeScript

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]);
}