mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-25 18:25:03 +00:00
15 lines
642 B
TypeScript
15 lines
642 B
TypeScript
import { GuildPluginData } from "knub";
|
|
import { CounterTrigger } from "../../../data/entities/CounterTrigger";
|
|
import { CountersPluginType } from "../types";
|
|
import { emitCounterEvent } from "./emitCounterEvent";
|
|
|
|
export async function checkAllValuesForTrigger(
|
|
pluginData: GuildPluginData<CountersPluginType>,
|
|
counterName: string,
|
|
counterTrigger: CounterTrigger,
|
|
) {
|
|
const triggeredContexts = await pluginData.state.counters.checkAllValuesForTrigger(counterTrigger);
|
|
for (const context of triggeredContexts) {
|
|
emitCounterEvent(pluginData, "trigger", counterName, counterTrigger.name, context.channelId, context.userId);
|
|
}
|
|
}
|