Discord verify command

how do i make a verify command so when i do (prefix)verify it gives me the member role?

You can add a role to a user like this:

let role = message.guild.roles.find(role => role.name === "MyRole");
message.member.addRole(role);

Hope this helps!

1 Like

can you send the code with message.content

if (message.content.startsWith(prefix + "verify")) {
  let role = message.guild.roles.find(role => role.name === "MyRole");
  message.member.addRole(role);
}

it says ‘prefix’ not defined.

Replace prefix with your bot’s prefix or the prefix variable however you have defined it in your code.

can you do it?

Hi, I have provided you with most of the code and it should be pretty easy to do it. We discourage spoon-feeding on this forum. I also suggest you get more familiar with JavaScript. While we will give you even the code to do stuff, please refrain from asking people to do stuff for you. If you have any other questions, please feel free to ask.

Hope you understand! :slight_smile:

Also it looks you added it correctly.