M
M
Mikle1234567892020-06-17 17:39:15
Node.js
Mikle123456789, 2020-06-17 17:39:15

How to write a role to a variable?

How to write a role to a variable?
Tried:

let role = member.guild.roles.find(r => r.name = "Имя роли");
member.addRole(role)


But it gave an error. How to do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MyAngelRem, 2020-06-17
@MyAngelRem

member.addRole(role.id); - discord.js v11 
member.roles.add(role.id); - discord.js v12

A
Alexander, 2020-06-17
@Alexandre888

you write the variable incorrectly, you simply didn’t transfer member.addRole(role)
read this , then try to run the code again. You can also try using a function
instead of a variable . if nothing from this list helped you, please write a comment under my answer with the error code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question