javascript - 欢迎消息未通过 Discord.js 发送
问题描述
所以我正在用 discord.js 编写一个不和谐的机器人,其中一个功能是当新用户加入服务器时,机器人会发送一条消息。我现在不把它嵌入,我以后可以自己做。
这是我welcome.js
专门为此功能制作的主要文件:
module.exports = (client) => {
const channelId = '868192573011931185' //welcome channel
client.on('guildMemberAdd', (member) => {
console.log(member.name)
const message = `Hello <@${member.id}> and welcome to ${guild.name}!
Please verify through the Server Captcha Bot in your DMs,
then read the rules in <#868192573263605884>
and lastly pick your roles in <#868192573263605880>!`
const channel = member.guild.channels.cache.get(channelId)
channel.send(message)
})
}
在我index.js
的文件中,我刚刚导入了文件,并添加了welcome(client)
.
但由于某种原因,我的代码没有出现在欢迎频道中......任何帮助将不胜感激。
解决方案
检查您的意图是否打开并查看此帖子以获取更多信息:
推荐阅读
- python - 比较两个坐标数组并根据它们的距离合并数组
- go - 是否可以使用默认缩进级别来增加 fmt.print?
- composer-php - 如何在同一个项目中处理不同的作曲家配置?
- docker - Transformers Lib - 使用 Docker 加载预训练模型
- apache-kafka - 使用 KeyedCoProcessFunction 的 Flink 超时和 FlinkKafkaConsumer 的读取顺序
- javascript - 运行突变后重新获取查询
- python - 模块“six.moves”没有属性“collections_abc”
- docker - ubuntu:docker run 正在给 docker:来自守护进程的错误响应:驱动程序在端点上编程外部连接失败
- devops - JFrog Artifactory 启动
- javascript - 如何从 React 应用程序登录到您的不和谐机器人