3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Fix counters set_value not defaulting nulls if not using per_user/per_channel (#366)

This commit is contained in:
Tiago R 2023-07-01 11:58:01 +01:00 committed by GitHub
parent 0da204ed5a
commit f5d6c895aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -15,7 +15,7 @@ export const SetCounterAction = automodAction({
const countersPlugin = pluginData.getPlugin(CountersPlugin);
if (!countersPlugin.counterExists(actionConfig.counter)) {
pluginData.getPlugin(LogsPlugin).logBotAlert({
body: `Unknown counter \`${actionConfig.counter}\` in \`add_to_counter\` action of Automod rule \`${ruleName}\``,
body: `Unknown counter \`${actionConfig.counter}\` in \`set_counter\` action of Automod rule \`${ruleName}\``,
});
return;
}

View file

@ -25,6 +25,9 @@ export async function setCounterValue(
throw new Error(`Counter is per user but no user ID was supplied`);
}
channelId = counter.per_channel ? channelId : null;
userId = counter.per_user ? userId : null;
const counterId = pluginData.state.counterIds[counterName];
const lock = await pluginData.locks.acquire(counterIdLock(counterId));