所以基本上我一直在为我的服务器开发这个机器人,我希望它向加入服务器的用户发送消息,就像每当用户加入我的服务器时,他们会收到我的机器人发送的消息?我现在已经使用了这个代码,但它似乎不起作用,有人可以帮忙吗?
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Bot is ready!');
bot.on("guildMemberAdd", member => {
member.send("Welcome to the server!")
.catch(console.error);
});});
client.login('<token>');