Bots 涉及嵌入图像的Discord.js bot错误

Bots 涉及嵌入图像的Discord.js bot错误,bots,discord,discord.js,deprecation-warning,Bots,Discord,Discord.js,Deprecation Warning,因此,我编程了一个discord机器人,根据命令,从嵌入消息的文件夹中发送随机选择的gif。在我开始尝试从Heroku托管bot之前,它工作得很好。现在,该命令什么也不做,只是在日志中显示一个错误,如“找不到文件扩展名”、“弃用错误”或刚才的“未处理的承诺拒绝”。我的主要问题是,我对一般编程非常陌生,所以我不知道我的问题到底是什么,更不用说如何解决了 这是我对这一特定部分的当前代码: case '//command': const Embed = new MessageEm

因此,我编程了一个discord机器人,根据命令,从嵌入消息的文件夹中发送随机选择的gif。在我开始尝试从Heroku托管bot之前,它工作得很好。现在,该命令什么也不做,只是在日志中显示一个错误,如“找不到文件扩展名”、“弃用错误”或刚才的“未处理的承诺拒绝”。我的主要问题是,我对一般编程非常陌生,所以我不知道我的问题到底是什么,更不用说如何解决了

这是我对这一特定部分的当前代码:

   case '//command':
        const Embed = new MessageEmbed()
        var number = 43;
        var imageNumber = Math.floor (Math.random()*(number-1+1))+1

        Embed.setTitle("//message")
        Embed.setDescription("//message")
        Embed.attachFiles({files: ["./images/" + imageNumber + ".gif"]})
        Embed.setImage("attachment://" + imageNumber + ".gif")
        Embed.setColor(0x9B00C3)

        msg.channel.send(Embed)
        break;
编辑:根据请求,出现以下错误消息:

2020-07-11T17:23:22.063132+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'path' of undefined
2020-07-11T17:23:22.063143+00:00 app[web.1]:     at findName (/app/node_modules/discord.js/src/structures/APIMessage.js:273:17)
2020-07-11T17:23:22.063144+00:00 app[web.1]:     at Function.resolveFile (/app/node_modules/discord.js/src/structures/APIMessage.js:289:31)
2020-07-11T17:23:22.063145+00:00 app[web.1]:     at /app/node_modules/discord.js/src/structures/APIMessage.js:224:72
2020-07-11T17:23:22.063147+00:00 app[web.1]:     at Array.map (<anonymous>)
2020-07-11T17:23:22.063147+00:00 app[web.1]:     at APIMessage.resolveFiles (/app/node_modules/discord.js/src/structures/APIMessage.js:224:46)
2020-07-11T17:23:22.063148+00:00 app[web.1]:     at TextChannel.send (/app/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:46)
2020-07-11T17:23:22.063149+00:00 app[web.1]:     at Client.<anonymous> (/app/index.js:76:25)
2020-07-11T17:23:22.063149+00:00 app[web.1]:     at Client.emit (events.js:315:20)
2020-07-11T17:23:22.063149+00:00 app[web.1]:     at MessageCreateAction.handle (/app/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
2020-07-11T17:23:22.063150+00:00 app[web.1]:     at Object.module.exports [as MESSAGE_CREATE] (/app/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
2020-07-11T17:23:22.063226+00:00 app[web.1]: (node:23) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
2020-07-11T17:23:22.063337+00:00 app[web.1]: (node:23) [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-zero exit code.
2020-07-11T17:23:22.063132+00:00应用程序[web.1]:(节点:23)未经处理的PromisejectionWarning:TypeError:无法读取未定义的
2020-07-11T17:23:22.063143+00:00应用程序[web.1]:在findName(/app/node_modules/discord.js/src/structures/APIMessage.js:273:17)
2020-07-11T17:23:22.063144+00:00app[web.1]:位于Function.resolveFile(/app/node_modules/discord.js/src/structures/APIMessage.js:289:31)
2020-07-11T17:23:22.063145+00:00应用程序[web.1]:at/app/node_modules/discord.js/src/structures/APIMessage.js:224:72
2020-07-11T17:23:22.063147+00:00应用程序[web.1]:位于Array.map()
2020-07-11T17:23:22.063147+00:00应用程序[web.1]:位于APIMessage.resolveFiles(/app/node_modules/discord.js/src/structures/APIMessage.js:224:46)
2020-07-11T17:23:22.063148+00:00应用程序[web.1]:位于TextChannel.send(/app/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:46)
2020-07-11T17:23:22.063149+00:00应用程序[web.1]:客户端。(/app/index.js:76:25)
2020-07-11T17:23:22.063149+00:00应用程序[web.1]:位于Client.emit(events.js:315:20)
2020-07-11T17:23:22.063149+00:00应用程序[web.1]:位于MessageCreateAction.handle(/app/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
2020-07-11T17:23:22.063150+00:00应用程序[web.1]:在Object.module.exports[作为消息创建](/app/node\u modules/discord.js/src/client/websocket/handlers/MESSAGE\u CREATE.js:4:32)
2020-07-11T17:23:22.063226+00:00应用程序[web.1]:(节点:23)未处理的Promisejection警告:未处理的承诺拒绝。此错误源于在没有catch块的异步函数中抛出,或者拒绝未使用.catch()处理的承诺。要在未处理的承诺拒绝时终止节点进程,请使用CLI标志“---unhandled rejections=strict”(请参阅https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (拒绝id:2)
2020-07-11T17:23:22.063337+00:00应用程序[web.1]:(节点:23)[DEP0018]弃用警告:未处理的承诺拒绝被弃用。将来,未处理的承诺拒绝将使用非零退出代码终止Node.js进程。

您能用完整错误编辑您的帖子吗?您能用完整错误编辑您的帖子吗?