mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 13:55:03 +00:00
counters: move triggers to counters plugin; architectural tweaks
This commit is contained in:
parent
7f75d6d8d3
commit
ab8ea2e7e5
17 changed files with 357 additions and 200 deletions
|
@ -0,0 +1,17 @@
|
|||
import { CountersPluginType, TTrigger } from "../types";
|
||||
import { GuildPluginData } from "knub";
|
||||
|
||||
export function getPrettyNameForCounterTrigger(
|
||||
pluginData: GuildPluginData<CountersPluginType>,
|
||||
counterName: string,
|
||||
triggerName: string,
|
||||
) {
|
||||
const config = pluginData.config.get();
|
||||
const counter = config.counters[counterName];
|
||||
if (!counter) {
|
||||
return "Unknown Counter Trigger";
|
||||
}
|
||||
|
||||
const trigger = counter.triggers[triggerName] as TTrigger | undefined;
|
||||
return trigger ? trigger.pretty_name || trigger.name : "Unknown Counter Trigger";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue