本文介绍了服务器问候的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试发送服务器问候消息,但对我来说甚至不起作用,我看到您可以尝试使用 ch.name ==='name'来执行此操作,但是我想要我的机器人将消息发送到具有特定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}!`);
});

推荐答案

我相信您需要在开发人员门户上打开Privileged Gateway Intent( 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

这篇关于服务器问候的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:34