简体   繁体   中英

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);

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM