wechaty / puppet-padlocal

Puppet PadLocal is a Pad Protocol for WeChat
https://wechaty.js.org/docs/puppet-providers/padlocal
Apache License 2.0
642 stars 88 forks source link

发送mp3文件异常 #16

Closed su-chang closed 3 years ago

su-chang commented 3 years ago
15:05:19 VERB Message say(FileBox#Base64<test.mp3>)
15:05:19 ERR Config ###########################
15:05:19 ERR Config unhandledRejection: Error: voiceLength is required
    at checkRequiredField (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:9:11)
    at PadLocalClientApi.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:125:5)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:23:12)
    at PadLocalClientApi.sendVoiceMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:135:16)
    at PuppetPadlocal.messageSendFile (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:737:48)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]
15:05:19 ERR Config ###########################
15:05:19 ERR Config process.on(unhandledRejection) promise.catch(voiceLength is required)
Config Error: voiceLength is required
    at checkRequiredField (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:9:11)
    at PadLocalClientApi.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:125:5)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:23:12)
    at PadLocalClientApi.sendVoiceMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:135:16)
    at PuppetPadlocal.messageSendFile (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:737:48)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:18068) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 5)
padlocal commented 3 years ago

发送 mp3 是应该当作文件发送吧?如果是发送语音,Error: voiceLength is required 需要提供语音时长信息。

su-chang commented 3 years ago

对的,mp3 是需要当做文件发送。

padlocal commented 3 years ago

fixed in wechaty-puppet-padlocal@0.2.19

su-chang commented 3 years ago
20:41:18 VERB Message say(FileBox#Base64<test.mp3>)
20:42:18 ERR Config ###########################
20:42:19 ERR Config unhandledRejection: VError: [tid:700951a3] request has been cancelled for reason: SERVER_ERROR: 4 DEADLINE_EXCEEDED: Deadline exceeded
    at Request._failAllPendingRequest (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:309:15)
    at ClientDuplexStreamImpl.Request._grpcStream.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:72:12)
    at ClientDuplexStreamImpl.emit (events.js:198:13)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:448:20)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client.ts:666:18)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
    at process.nextTick (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call-stream.ts:243:24)
    at process._tickCallback (internal/process/next_tick.js:61:11) [object Promise]

发送多次后,只有前几次出现这个报错,之后是能正常发送

20:52:43 VERB Message say(FileBox#Base64<test.mp3>)
20:53:32 VERB Message static load(7195784062271612956)
20:53:32 VERB Message constructor(7195784062271612956) for class WechatifiedMessage
20:53:32 VERB Message ready()
20:53:32 VERB Puppet messagePayload(7195784062271612956)
20:53:32 SILL Puppet messagePayloadCache(7195784062271612956) cache MISS
20:53:32 SILL Puppet messagePayload(7195784062271612956) cache SET
20:53:32 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="wxid_q0yib0cg8b2s22"
20:53:32 SILL Contact ready() isReady() true
20:53:32 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="Soul001001"
20:53:32 SILL Contact ready() isReady() true
msg: Message#Text[🗣Contact<小助手>]    [文件]
fangmuke commented 3 years ago

如果要把mp3当做语音发送,应该怎么做呢?有哪些限制嘛?

padlocal commented 3 years ago

Fixed, wechaty-puppet-padlocal@0.2.23

padlocal commented 3 years ago

如果要把mp3当做语音发送,应该怎么做呢?有哪些限制嘛?

  1. wx采用的是 silk 格式语音,可以参考 https://github.com/kn007/silk-v3-decoder 进行格式转换
  2. 时常最长 60 秒
fangmuke commented 3 years ago

如果要把mp3当做语音发送,应该怎么做呢?有哪些限制嘛?

  1. wx采用的是 silk 格式语音,可以参考 https://github.com/kn007/silk-v3-decoder 进行格式转换
  2. 时常最长 60 秒

我尝试这样做了(使用 https://github.com/kn007/silk-v3-decoder 转换的slk/silk)但是发出来的是文件,是我使用的方式错误了吗? image

padlocal commented 3 years ago

如果要把mp3当做语音发送,应该怎么做呢?有哪些限制嘛?

  1. wx采用的是 silk 格式语音,可以参考 https://github.com/kn007/silk-v3-decoder 进行格式转换
  2. 时常最长 60 秒

我尝试这样做了(使用 https://github.com/kn007/silk-v3-decoder 转换的slk/silk)但是发出来的是文件,是我使用的方式错误了吗? image

It seems that you have sent voice successfully.

panlina commented 1 year ago

如果要把mp3当做语音发送,应该怎么做呢?有哪些限制嘛?

  1. wx采用的是 silk 格式语音,可以参考 https://github.com/kn007/silk-v3-decoder 进行格式转换
  2. 时常最长 60 秒

我尝试这样做了(使用 https://github.com/kn007/silk-v3-decoder 转换的slk/silk)但是发出来的是文件,是我使用的方式错误了吗? image

你后来有解决吗? @fangmuke