node.js - 使用带有电子 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 启动第二个程序。我想在电子应用程序中记录机器人的命令,所以这个解决方案对我来说不是那么好。这就是为什么我想问是否有另一种方式。
提前致谢
解决方案
推荐阅读
- java - FirebaseAuth.getInstance() 抛出异常 java.lang.NoSuchMethodError
- python - 由于某种原因没有模块名称烧瓶
- javascript - 将供应商块组合成在 Webpack 中通过动态导入创建的块
- pytorch - pytorch 模型的多个分支
- python - 在 Robot Framework 缺少元素中调用 soap 方法
- php - Netbeans 8.1 PHP 项目损坏 - 解析器中没有显示问题
- c# - ASP.NET Core 5.0 Bootstrap 5.0 - 侧边栏
- google-sheets-formula - 具有多个页面的导入html
- netty - Why does ChannelOutboundHandlerAdapter have a read method if it s means for outbound IO operations
- postgresql - 使用 PostgreSQL 查询获取当月记录