Drincann / Mirai-js

运行在 Node.js、浏览器下,基于 mirai-api-http 的 QQ 机器人开发框架。
https://mirai-js-drincann.vercel.app
GNU Affero General Public License v3.0
252 stars 31 forks source link

关于Mirai-js v2.8.4上传语音PC端听不了的问题 #223

Open Star-Vk opened 1 year ago

Star-Vk commented 1 year ago

代码复现如下:

//下载文件 到./temp/1.mp3 可以忽略
let aimUrl = 'http://music.163.com/song/media/outer/url?id=481859794.mp3';
await downLoadFile("./temp/1.mp3",aimUrl);

//uploadVoice 上传下载好的文件
const {voiceId} = await .bot.uploadVoice({type:"group",filename:"./temp/1.mp3"});

//通过voiceId发送文件
await bot.sendMessage({
    group: 1169617978,
    message: new myBot.Message().addVoiceId(voiceId),
})


最终的在安卓手机端的效果为: QQ图片20220909105116 音频文件可以听


电脑端的效果为: image 音频文件不可听

package.json文件

{
  "dependencies": {
    "axios": "^0.27.2",
    "cheerio": "^1.0.0-rc.12",
    "crypto": "^1.0.1",
    "crypto-js": "^4.1.1",
    "fetch": "^1.1.0",
    "gm": "^1.23.1",
    "http": "^0.0.1-security",
    "mirai-js": "^2.8.4",
    "node-cron": "^3.0.2",
    "node-schedule": "^2.1.0"
  }
}

MCL上的版本显示

  09:38:19 [INFO] iTXTech Mirai Console Loader version 2.1.0-71ec418
  09:38:19 [INFO] https://github.com/iTXTech/mirai-console-loader
  09:38:19 [INFO] This program is licensed under GNU AGPL v3   
  09:38:22 [INFO] Mirai Console Loader Announcement:
Mirai Console Loader 公告栏

如果在图片上传的时候遇到问题请与我们联系 (需要提供图片文件源本)`- 如 Unsupported image type for ExternalResource *
`  considering use gif/png/bmp/jpg format.
`- Tracker: https://github.com/mamoe/mirai/issues/new/choose   

常用资源整合
`- https://mirai.mamoe.net/topic/653

MCL 已推出 2.1.0,更好的支持 Mirai 2.11 的插件系统,建议更新。 

  09:38:22 [INFO] Verifying "net.mamoe:mirai-console" v2.12.1  
  09:38:22 [INFO] Verifying "net.mamoe:mirai-console-terminal" 
v2.12.1
  09:38:22 [INFO] Verifying "net.mamoe:mirai-core-all" v2.12.1 
  09:38:22 [INFO] Verifying "org.itxtech:mcl-addon" v2.0.2
  09:38:22 [INFO] Verifying "org.bouncycastle:bcprov-jdk15on" v
Drincann commented 1 year ago

@Star-Vk 看一下 mirai-api-http 的版本。 原因有很多,不一定是上传后缀的问题。 如果可以的话,帮忙用 mirai-foxes 试一下,看看他是否真的解决了这个问题,之后我参考下他的改动。

Star-Vk commented 1 year ago

mirai-api-http的版本如下:

2022-09-09 11:42:18 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v2.6.1
2022-09-09 11:42:18 I/plugin: Successfully loaded plugin MCL Addon v2.0.2
2022-09-09 11:42:19 I/main: Prepared built-in commands: autoLogin, help, login, logout, permission, status, stop


mirai-foxes的开发文档写的似乎是Typescript的代码,我用nodejs以相同的方式写报错,可能正确写法我不太了解,所以试不了