automod: use proper locks in removeRoles action
This commit is contained in:
parent
0c27795fd9
commit
6bb6dfadb9
1 changed files with 4 additions and 0 deletions
|
@ -66,11 +66,15 @@ export const RemoveRolesAction = automodAction({
|
|||
return;
|
||||
}
|
||||
|
||||
const memberRolesLock = await pluginData.locks.acquire(`member-roles-${member.id}`);
|
||||
|
||||
const rolesArr = Array.from(memberRoles.values());
|
||||
await member.edit({
|
||||
roles: rolesArr,
|
||||
});
|
||||
member.roles = rolesArr; // Make sure we know of the new roles internally as well
|
||||
|
||||
memberRolesLock.unlock();
|
||||
}),
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue