3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Fix error when using an unknown counter from Automod

This commit is contained in:
Dragory 2021-04-11 13:44:48 +03:00
parent 8763a06ef1
commit ad8aab3937
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
4 changed files with 28 additions and 2 deletions

View file

@ -24,6 +24,7 @@ import {
} from "../../data/entities/CounterTrigger";
import { getPrettyNameForCounter } from "./functions/getPrettyNameForCounter";
import { getPrettyNameForCounterTrigger } from "./functions/getPrettyNameForCounterTrigger";
import { counterExists } from "./functions/counterExists";
const MAX_COUNTERS = 5;
const MAX_TRIGGERS_PER_COUNTER = 5;
@ -115,6 +116,8 @@ export const CountersPlugin = zeppelinGuildPlugin<CountersPluginType>()("counter
configPreprocessor,
public: {
counterExists: mapToPublicFn(counterExists),
// Change a counter's value by a relative amount, e.g. +5
changeCounterValue: mapToPublicFn(changeCounterValue),

View file

@ -0,0 +1,7 @@
import { GuildPluginData } from "knub";
import { CountersPluginType } from "../types";
export function counterExists(pluginData: GuildPluginData<CountersPluginType>, counterName: string) {
const config = pluginData.config.get();
return config.counters[counterName] != null;
}