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:
parent
4b33322127
commit
4c43e7cb28
10 changed files with 418 additions and 0 deletions
|
@ -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]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue