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:
parent
0da204ed5a
commit
f5d6c895aa
2 changed files with 4 additions and 1 deletions
|
@ -15,7 +15,7 @@ export const SetCounterAction = automodAction({
|
||||||
const countersPlugin = pluginData.getPlugin(CountersPlugin);
|
const countersPlugin = pluginData.getPlugin(CountersPlugin);
|
||||||
if (!countersPlugin.counterExists(actionConfig.counter)) {
|
if (!countersPlugin.counterExists(actionConfig.counter)) {
|
||||||
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,9 @@ export async function setCounterValue(
|
||||||
throw new Error(`Counter is per user but no user ID was supplied`);
|
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 counterId = pluginData.state.counterIds[counterName];
|
||||||
const lock = await pluginData.locks.acquire(counterIdLock(counterId));
|
const lock = await pluginData.locks.acquire(counterIdLock(counterId));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue