Hi, i just want to assign and remove a role to the same user. Sometimes the bot assigns Role1 but does not remove the Role2 or remove the Role2 but does not assign Role1. No error in the console logs.
My code
//ASSIGN ROLE
role = message.server.roles.get("name", 'Role1');
mybot.addMemberToRole(user, role, function (err) {
if (err) {
console.log(err);
}
})
//REMOVE ROLE
role = message.server.roles.get("name", 'Role2');
mybot.removeMemberFromRole(user, role, function (err) {
if (err) {
console.log(err);
}
});
Nest it in the callback
On Mon, Jul 25, 2016, 20:46 Julio Cesar Peña Velasquez <
[email protected]> wrote:
Hi, i just want to assign and remove a role to the same user. Sometimes
the bot assigns Role1 but does not remove the Role2 or remove the Role2 but
does not assign Role1. No error in the console logs.My code
//ASSIGN ROLE
role = message.server.roles.get("name", 'Role1');
mybot.addMemberToRole(user, role, function (err) {
if (err) {
console.log(err);
}
})//REMOVE ROLE
role = message.server.roles.get("name", 'Role2');
mybot.removeMemberFromRole(user, role, function (err) {
if (err) {
console.log(err);
}
});—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/hydrabolt/discord.js/issues/476, or mute the thread
https://github.com/notifications/unsubscribe-auth/AMoLtigdsdXaAhr8ANR6R9WAAZxkg7BHks5qZQSagaJpZM4JUbPv
.
Essentially a duplicate of #472
Most helpful comment
Essentially a duplicate of #472