Skip to content

Commit

Permalink
Merge pull request #67 from danni-cool/fix-voiceMsg-error
Browse files Browse the repository at this point in the history
Fix voice msg error
  • Loading branch information
leochen-g authored Oct 12, 2023
2 parents 9e9f5ff + 101bf06 commit 3376ead
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechaty-puppet-wechat4u",
"version": "1.14.5",
"version": "1.14.6",
"description": "Wechat4u Puppet for Wechaty",
"type": "module",
"exports": {
Expand Down
10 changes: 1 addition & 9 deletions src/puppet-wechat4u.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
import Wechat4u from 'wechat4u'
import QuickLru from '@alloc/quick-lru'
import * as XMLParser from 'fast-xml-parser'
import * as PUPPET from 'wechaty-puppet'
import { log } from 'wechaty-puppet'
import type { FileBoxInterface } from 'file-box'
Expand Down Expand Up @@ -677,14 +676,7 @@ export class PuppetWechat4u extends PUPPET.Puppet {
(await this.wechat4u.getVoice(rawPayload.MsgId)).data,
`message-${id}-audio.sil`,
)
const options = {
attrNodeName: '$',
attributeNamePrefix: '',
ignoreAttributes: false,
}

const msgXmlObj = XMLParser.parse(rawPayload.Content, options)
const voiceLength = parseInt(msgXmlObj.msg.voicemsg.$.voicelength, 10)
const voiceLength = rawPayload.VoiceLength
audioFileBox.metadata = {
voiceLength,
}
Expand Down
2 changes: 1 addition & 1 deletion src/web-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export interface WebMessageRawPayload {

SubMsgType: WebMessageType, // "msgType":"{{message.MsgType}}",
// "subType":{{message.SubMsgType||0}},"msgId":"{{message.MsgId}}"

VoiceLength: number,
/**
* Status-es
*/
Expand Down

0 comments on commit 3376ead

Please sign in to comment.