some kid playing js
some kid playing js

Reputation: 71

Add Roles Upon Joining Server Discord js v13

Is there a way that I could make my bot add a role to a member upon joining the server? I want it to add "Member" role

What I have so far

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

Upvotes: 0

Views: 906

Answers (1)

Lofn
Lofn

Reputation: 940

There are many ways to give roles to your members. One of the easiest ways is to just give the list of role IDs (in your case just one).

message.member.roles.add(['role-id']);

Not sure if the bot's role matter anymore, but at one point bot's role on the server must be higher than the role given out. So make sure to do so.

Upvotes: 1

Related Questions