diff --git a/backend/src/data/GuildCounters.ts b/backend/src/data/GuildCounters.ts index 92395e0f..2d689295 100644 --- a/backend/src/data/GuildCounters.ts +++ b/backend/src/data/GuildCounters.ts @@ -532,5 +532,9 @@ export class GuildCounters extends BaseGuildRepository { await this.counterValues.delete({ counter_id: counterId, }); + + await this.counterTriggers.delete({ + counter_id: counterId, + }); } } diff --git a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts index 25ff5ec4..c6f518b2 100644 --- a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts +++ b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts @@ -8,6 +8,7 @@ import { confirm, resolveUser, trimMultilineString, UnknownUser } from "../../.. import { changeCounterValue } from "../functions/changeCounterValue"; import { setCounterValue } from "../functions/setCounterValue"; import { resetAllCounterValues } from "../functions/resetAllCounterValues"; +import { counterIdLock } from "../../../utils/lockNameHelpers"; export const ResetAllCounterValuesCmd = guildCommand()({ trigger: ["counters reset_all"], @@ -47,7 +48,9 @@ export const ResetAllCounterValuesCmd = guildCommand()({ return; } + const lock = await pluginData.locks.acquire(counterIdLock(counterId)); await resetAllCounterValues(pluginData, args.counterName); + lock.unlock(); sendSuccessMessage(pluginData, message.channel, `All counter values for **${counterName}** have been reset`); },