fixed roles bug

This commit is contained in:
PxlLoewe
2025-06-05 01:59:35 -07:00
parent 9bcb81fc8a
commit 59f3da5c84

View File

@@ -50,10 +50,13 @@ const handleRoleChange = (action: "add" | "remove") => async (req: Request, res:
action === "add" action === "add"
? roleIds.filter((id: string) => !currentRoleIds.includes(id)) ? roleIds.filter((id: string) => !currentRoleIds.includes(id))
: 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}` }); res.status(200).json({ message: `No roles to ${action}` });
return; return;
} } */
await member.roles[action](roleIds); await member.roles[action](roleIds);
res.status(200).json({ message: `Roles ${action}ed successfully` }); res.status(200).json({ message: `Roles ${action}ed successfully` });