如何使用较新版本的 nodejs 创建不和谐的欢迎消息?
How can I create a discord welcome message with the newer version for nodejs?
这是我所拥有的,它没有发送任何东西:
client.on("guildMemberAdd", (member) => {
const welcomeMessage = "Please welcome <@${member.id}> <a:pepesimp:881812231208181790> welcome to our ~~cult~~ club!";
member.guild.channels.cache.get((i) => i.name === "welcome").send(welcomeMessage);
});
您需要在启动客户端时请求GUILD_MEMBERS
,否则不会触发此事件。
const client = new Discord.Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS]
});
您还需要确保已在 Discord 开发者门户中启用它。
这是我所拥有的,它没有发送任何东西:
client.on("guildMemberAdd", (member) => {
const welcomeMessage = "Please welcome <@${member.id}> <a:pepesimp:881812231208181790> welcome to our ~~cult~~ club!";
member.guild.channels.cache.get((i) => i.name === "welcome").send(welcomeMessage);
});
您需要在启动客户端时请求GUILD_MEMBERS
,否则不会触发此事件。
const client = new Discord.Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS]
});
您还需要确保已在 Discord 开发者门户中启用它。