fixed roles bug
This commit is contained in:
@@ -50,10 +50,13 @@ const handleRoleChange = (action: "add" | "remove") => async (req: Request, res:
|
||||
action === "add"
|
||||
? roleIds.filter((id: string) => !currentRoleIds.includes(id))
|
||||
: roleIds.filter((id: string) => currentRoleIds.includes(id));
|
||||
if (filteredRoleIds.length === 0) {
|
||||
|
||||
console.log(`Attempting to ${action} roles:`, filteredRoleIds, roleIds);
|
||||
// Option to skip if no roles to add/remove
|
||||
/* if (filteredRoleIds.length === 0) {
|
||||
res.status(200).json({ message: `No roles to ${action}` });
|
||||
return;
|
||||
}
|
||||
} */
|
||||
|
||||
await member.roles[action](roleIds);
|
||||
res.status(200).json({ message: `Roles ${action}ed successfully` });
|
||||
|
||||
Reference in New Issue
Block a user