Discord.js 忽略消息

问题描述 投票:0回答:1

我需要帮助制作一个Discord机器人。我想让机器人忽略用户发送的消息。

    if (message.content.startsWith (name)) {
        message.react("1️⃣")
            .then(message.react("2️⃣"))
            .then(message.react("3️⃣"))
            .catch(console.log);
    }

    if (message.author.username (name)) {
        return
    }

有一行在最下面。我不知道这是否是错误的,但它说 TypeError: message.author.username is not a function

问题是,你看到那个机器人了吗,它对自己的信息做出了反应。但你看到底部的我了吗?我想让机器人不对那条信息做出反应。

javascript java discord.js
1个回答
0
投票

我只会检查是否 message.author.bot 为真,然后基于此运行条件逻辑。

© www.soinside.com 2019 - 2024. All rights reserved.