3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-13 21:35:02 +00:00

counters: move triggers to counters plugin; architectural tweaks

This commit is contained in:
Dragory 2021-04-02 16:36:45 +03:00
parent 7f75d6d8d3
commit ab8ea2e7e5
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
17 changed files with 357 additions and 200 deletions

View file

@ -1,6 +1,5 @@
import { GuildPluginData } from "knub";
import { CountersPluginType } from "../types";
import { buildConditionString } from "../../../data/GuildCounters";
import { CounterTrigger } from "../../../data/entities/CounterTrigger";
import { emitCounterEvent } from "./emitCounterEvent";
@ -11,13 +10,6 @@ export async function checkAllValuesForReverseTrigger(
) {
const triggeredContexts = await pluginData.state.counters.checkAllValuesForReverseTrigger(counterTrigger);
for (const context of triggeredContexts) {
emitCounterEvent(
pluginData,
"reverseTrigger",
counterName,
buildConditionString(counterTrigger.comparison_op, counterTrigger.comparison_value),
context.channelId,
context.userId,
);
emitCounterEvent(pluginData, "reverseTrigger", counterName, counterTrigger.name, context.channelId, context.userId);
}
}