如何解决持续性错误:未知消息?

时间:2019-07-16 17:14:38

标签: javascript node.js discord.js

我想为我的机器人不和谐开发一条命令,该命令可以推迟播放器。该报告直接进入名为“报告”的房间。问题是,每次执行命令时,我都会在下面的代码中收到错误:

const Discord = require("discord.js")
const botconfig = require("../botconfig.json");
const colours = require("../colours.json");
const prefix = botconfig.prefix

module.exports.run = async (bot, message, args) => {

    message.delete()

    let messageID = args[0];
    if (isNaN(messageID)) {
        message.author.send("❌ L'ID du message est introuvable.")
        return;
    }

    let sChannel = message.guild.channels.find(x => x.name === "reports")

    let messagea = message.channel.fetchMessage(messageID).then(messagea => {
        let reportEmbed = new Discord.RichEmbed()
            .setTitle("Signalement")
            .setColor(colours.yellow)
            .addField("Message signalé", messagea.content)
            .addField("Utilisateur signalé", `${messagea.author} - ID : ${messagea.author.id} `)
            .addField("Signalé par", `${message.author} - ID : ${message.author.id}`)
            .addField("Signalé à", message.createdAt.toLocaleString());

    message.channel.send("Votre signalement a été envoyé à l'équipe du staff. Merci !").then(m => m.delete(15000))
    sChannel.send(reportEmbed).then(async msg => {
        await msg.react("✅")
        await msg.react("❌")
    })

})

}

module.exports.config = {
    name: "report",
    description: `Signaler un utilisateur du serveur au staff. \n Pour plus d'informations conçernant le __message ID__, faites **${prefix}ID** `,
    usage: "!report <Message ID>",
    accessableby: "Membres",
    aliases: []
}

这是错误消息:

(node:5892) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
    at C:\Users\Thomas\Desktop\Nolosha Bot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
    at C:\Users\Thomas\Desktop\Nolosha Bot\node_modules\snekfetch\src\index.js:215:21
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:5892) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by
rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:5892) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-z`enter code here`

0 个答案:

没有答案