服务器问候语

2022-01-10 00:00:00 javascript discord.js

我尝试制作服务器问候消息,但它甚至对我不起作用,我看到您可以尝试使用 ch.name === 'name' 但我想要我的bot 将消息发送到具有特定 ID 的频道

I tried to make server greetings message but it doesn't even work for me, I saw that you can try to do this using ch.name === 'name' but I want my bot to send message to channel with specific id

client.on("guildMemberAdd", (member) => {
  const channel = member.guild.channels.cache.find((ch) => ch.id === `channel-id`);
  if (!channel) return;
  channel.send(`Welcome to the server, ${member}!`);
});

推荐答案

我认为你需要在 Dev Portal 上开启 Privileged Gateway Intents (https://discord.com/developers/applications)网关意图

I believe you need to turn on Privileged Gateway Intents on the Dev Portal (https://discord.com/developers/applications) gateway intents on

相关文章