首页 > 解决方案 > 欢迎消息未通过 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).

但由于某种原因,我的代码没有出现在欢迎频道中......任何帮助将不胜感激。

标签: javascriptdiscord.jsbots

解决方案


检查您的意图是否打开并查看此帖子以获取更多信息:


推荐阅读