Fix error when adding counter without triggers

This commit is contained in:
Dragory 2021-05-03 19:33:59 +03:00
parent a568e86d78
commit 9bae5eaea7
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -62,7 +62,7 @@ const configPreprocessor: ConfigPreprocessorFn<CountersPluginType> = options =>
counter.per_user = counter.per_user ?? false;
counter.per_channel = counter.per_channel ?? false;
counter.initial_value = counter.initial_value ?? 0;
counter.triggers = counter.triggers || [];
counter.triggers = counter.triggers || {};
if (Object.values(counter.triggers).length > MAX_TRIGGERS_PER_COUNTER) {
throw new StrictValidationError([`You can only have at most ${MAX_TRIGGERS_PER_COUNTER} triggers per counter`]);