【发布时间】:2023-04-09 22:52:01
【问题描述】:
我正在制作一个机器人来检测用户何时加入。当我的测试帐户加入时,下面的代码不起作用。它仅在用户第一次加入时才有效。如果是这样,我怎样才能让它每次都工作。
client.on('guildMemberAdd', member => {
// Send the message to a designated channel on a server:
const channel = member.guild.channels.cache.find(ch => ch.name === 'general-chat');
// Do nothing if the channel wasn't found on this server
if (!channel) return;
// Send the message, mentioning the member
channel.send(`Welcome to the server, ${member}`);
});
【问题讨论】:
-
您是否启用了所需的意图? discordjs.guide/popular-topics/…
-
我启用了这些。
-
你调试了吗?尝试在事件中记录以确保它正在发出
-
是的。我已经检查过了,我什么也没得到。
标签: discord.js