Question

The problem of assigning a role using a reaction discord.js

I have a problem with assigning a role after clicking the appropriate response.

When the user responds to the message, no role is assigned and no message or error pops up in the console.

At this point, the role is not added, but a message pops up for the saved “Error adding role”. UPDATE:

client.on(“messageReactionAdd”, ({ message: { channel } }, user) => { if (/weryfikacja/.test(channel.name)) { channel.guild.members .fetch(user) .then(member => { member.roles .add(‘930796894026883153’) .then(() => { console.log( The ${roleName} has been removed from member ${user.tag} successfully! ); }) .catch(e => console.error(“Error adding role”)); }) .catch(error => { console.error(error); }); } });

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer