S
S
Sanya2282282021-04-18 00:39:42
Node.js
Sanya228228, 2021-04-18 00:39:42

How to issue a role on a specific server?

client.on('guildMemberAdd', async (member) => {
    var role = member.guild.roles.cache.find(role => role.id === "784364508432695296");
    member.roles.add(role);
})

made such a system, the question is how to make this role auto-provision current on a specific server, and not on all servers where there is a bot?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-04-18
@Sanya228228

client.on('guildMemberAdd', async (member) => {
    if (member.guild.id === ". . .") {
        var role = member.guild.roles.cache.find(role => role.id === "784364508432695296");
        member.roles.add(role);
    }
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question