用户加入服务器时在特定频道中的欢迎消息。 (guildMemberAdd, discord.js)

Welcome message in a specific channel when a user joins the server. (guildMemberAdd, discord.js)

如何让我的机器人在用户加入时在特定频道中发送消息?

当我这样做时,它什么都不记录:(Also here are my bot settings)

const Discord = require("discord.js");
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });
const { MessageEmbed } = require('discord.js');

client.on("ready", () => {
    console.log("Cloud Shield has been activated.")
});

client.on("guildMemberAdd", async (member) => {
    console.log(member);
});

client.login(process.env.token)

这是因为您没有请求 GUILD_MEMBERS 意图。

const Discord = require("discord.js");
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS"] });
const { MessageEmbed } = require('discord.js');

client.on("ready", () => {
    console.log("Cloud Shield has been activated.")
});

client.on("guildMemberAdd", async (member) => {
    console.log(member);
});

client.login(process.env.token)