M
M
matveyyyyyyyy2020-11-08 18:37:55
Node.js
matveyyyyyyyy, 2020-11-08 18:37:55

New user notification on discord.js server?

Either I google so badly, or something else. I did not find any sensible information on this issue .. 5fa810a1b033d111405259.png

How can I do this so that a notification pops up in a certain channel, etc.?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Weishaypt, 2020-11-08
@matveyyyyyyyy

There is a lot of information on the net about this. However, here is the implementation on discord.js V12.
Also, in order for this event to work, you need to enable the Server Members Intent option in the bot's settings on the developer portal .

bot.on('guildMemberAdd', function (member) {
    let embed = new MessageEmbed();
    embed.setTitle('Новый пользователь!')
        .setColor('#ffffff') //Цвет полоски
        .setDescription(member.user.tag + ' присоединился к серверу!')
        .setThumbnail(member.user.avatarURL())
        .setFooter('Всего пользователей: ' +  member.guild.memberCount)

    const channel = guild.channels.cache.get('ID канала куда отправляется сообщение');
    channel.send(`<@${member.user.id}>${content}`, { embed });
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question