#Can i help? i would to automatic change nickname when player recieve a role
1 messages · Page 1 of 1 (latest)
I think the problem is with cache
Can you put a breakpoint inside the function and check the roles found in cache
The newly added role might not be there
I see, you should've said this from the very beginning. You need to check first if the user has a specific role. If it does, then remove the tag (e.g. [MVP]), and then add the new one
Hmm, let's see..
I would create a object where I map role to tag:
let tags = {"some_role_id": "MVP"};
for(let role of Object.keys(tags))
remove_tag(member, tags[role]);
for(let role of Object.keys(tags))
if(member_has_role(role))
add_tag(member, tags[role]);
This would allow multiple tags at once if required, and also correct badly put tags
Though maybe it can be written better
They are placeholders, you need to replace remove_tag, add_tag and member_has_role with your own ways