#Problem with add and remove roles

1 messages · Page 1 of 1 (latest)

rigid mason
#

when Running my code It will add roles and it will remove roles but when it comes to adding and removing roles it seams to fail with no error. I say fail because there will be no change in role assignment for target member.

#
try {
  if (rolesToAdd.length >= 1 && rolesToRemove.length >= 1) {
    await interaction.member.roles.remove(rolesToRemove);
    await interaction.member.roles.add(rolesToAdd);
  }
  if (rolesToAdd.length >= 1) {
    console.log('add roles');
    await interaction.member.roles.add(rolesToAdd).catch(console.error);
  }
  if (rolesToRemove.length >= 1) {
    console.log('remove roles');
    await interaction.member.roles.remove(rolesToRemove).catch(console.error);
  }
}
catch (err) {return console.log(err);}
#

full code

sterile zodiac
rigid mason
#

but this is help for discord.js v14 is it not? and this is a v14 help request

sterile zodiac
rigid mason
#

You can use ⁠djs-help-v13 or ⁠djs-help-v14 for questions you expect can be quickly solved.