服务器问候语

Server greetings(服务器问候语)

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

问题描述

我尝试制作服务器问候消息,但它甚至对我不起作用,我看到您可以尝试使用 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

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

本文标题为:服务器问候语

基础教程推荐