Enforce unified lock names by using functions to generate lock keys (#165)

This commit is contained in:
Nils 2021-04-02 15:43:13 +02:00 committed by GitHub
parent fcbb25b7ff
commit c5d68650a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 70 additions and 28 deletions

View file

@ -1,6 +1,7 @@
import { mutesEvt } from "../types";
import { LogType } from "../../../data/LogType";
import { stripObjectToScalars } from "../../../utils";
import { memberRolesLock } from "../../../utils/lockNameHelpers";
/**
* Reapply active mutes on join
@ -11,9 +12,9 @@ export const ReapplyActiveMuteOnJoinEvt = mutesEvt("guildMemberAdd", async ({ pl
const muteRole = pluginData.config.get().mute_role;
if (muteRole) {
const memberRolesLock = await pluginData.locks.acquire(`member-roles-${member.id}`);
const memberRoleLock = await pluginData.locks.acquire(memberRolesLock(member));
await member.addRole(muteRole);
memberRolesLock.unlock();
memberRoleLock.unlock();
}
pluginData.state.serverLogs.log(LogType.MEMBER_MUTE_REJOIN, {