首页 > 解决方案 > 使用带有电子 gui 的不和谐 js,图像发送不起作用

问题描述

我有一个电子应用程序,它链接到一个不和谐机器人,它为服务器中的用户显示不同的统计信息,这些统计信息以 png 图像的形式出现,所以我尝试在嵌入消息中发送它们。如果我单独使用机器人,它可以完美运行,但是一旦我尝试通过电子使用它,发送消息时就会出现错误:

TypeError [REQ_RESOURCE_TYPE]: The resource must be a string, Buffer or a valid file stream.
    at Function.resolveFile (...\node_modules\discord.js\src\util\DataResolver.js:135)
    at Function.resolveFile (...\node_modules\discord.js\src\structures\APIMessage.js:309)
    at ...\node_modules\discord.js\src\structures\APIMessage.js:241
    at Array.map (<anonymous>)
    at APIMessage.resolveFiles ...\node_modules\discord.js\src\structures\APIMessage.js:241)
    at TextChannel.send (...\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:172)
    at ...\bot2.js:274

我在这里看到过这样的问题无法通过电子应用程序在 discordjs 上发送附加到消息的图像 但是解决方案是将机器人和电子应用程序分成 2 个程序并使用 cmd 启动第二个程序。我想在电子应用程序中记录机器人的命令,所以这个解决方案对我来说不是那么好。这就是为什么我想问是否有另一种方式。

提前致谢

标签: node.jsimageelectrondiscord.js

解决方案


推荐阅读