Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: reborn 重构wechatbot-webhook #223

Closed
wants to merge 13 commits into from
Closed

v3: reborn 重构wechatbot-webhook #223

wants to merge 13 commits into from

Conversation

danni-cool
Copy link
Owner

@danni-cool danni-cool commented May 16, 2024

breaking change

  • 支持 windows协议
  • 重新调整monorepo 架构
    • 使用ts重写
    • 使用esmodule代替common.js
    • 重新整理docker 构建ci流

feature

  • 删除 fileUrl 支持多个逗号分隔的功能
  • 删除通过query查询支持文件别名的临时方案
  • v2推消息api支持base64
  • 推消息api支持文件别名,增加额外字段fileAlias
  • 增加对webp图片的支持 webp格式图片不支持 #229

bugfix

doc

  • api和部署文档迁移wiki
  • 优化npm文档
  • 优化docker文档

Daydaylw3 and others added 13 commits May 15, 2024 19:04
原本收到合并消息转发的消息,会直接抛出错误,现在捕获这个错误并处理
原本收到合并消息转发的消息,会直接抛出错误,现在捕获这个错误并处理

```
[2024-05-15T17:46:41.442] [WARN] - 17:46:41 WARN message-parser Error occurred while parse message attachment: {"MsgId":"9077318394394722874","FromUserName":"@@XXXXXXXXXXX","ToUserName":"@xxxxxxxxxx","MsgType":49,"Content":"@xxxxxxxxxxxx:\n该类型暂不支持,请在手机上查看","Status":3,"ImgStatus":2,"CreateTime":1715766398,"VoiceLength":0,"PlayLength":0,"FileName":"","FileSize":"","MediaId":"","Url":"","AppMsgType":0,"StatusNotifyCode":0,"StatusNotifyUserName":"","RecommendInfo":{"UserName":"","NickName":"","QQNum":0,"Province":"","City":"","Content":"","Signature":"","Alias":"","Scene":0,"VerifyFlag":0,"AttrStatus":0,"Sex":0,"Ticket":"","OpCode":0},"ForwardFlag":0,"AppInfo":{"AppID":"","Type":0},"HasProductId":0,"Ticket":"","ImgHeight":0,"ImgWidth":0,"SubMsgType":0,"NewMsgId":9077318394394723000,"OriContent":"","EncryFileName":"","isSendBySelf":false,"OriginalContent":"@xxxxxxxxxxxx:<br/>该类型暂不支持,请在手机上查看"} , TypeError: Cannot read properties of undefined (reading 'msg')
    at parseAppmsgMessagePayload (/app/node_modules/.pnpm/[email protected]_patch_hash=nq4vns7vah46g6vxziyzqg5jey_@[email protected][email protected]/node_modules/wechaty-puppet-wechat4u/dist/cjs/src/wechat4u/messages/message-appmsg.js:34:76)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async appMsgParser (/app/node_modules/.pnpm/[email protected]_patch_hash=nq4vns7vah46g6vxziyzqg5jey_@[email protected][email protected]/node_modules/wechaty-puppet-wechat4u/dist/cjs/src/wechat4u/schema-mapper/message/message-parser-appmsg.js:36:28)
    at async executeMessageParsers (/app/node_modules/.pnpm/[email protected]_patch_hash=nq4vns7vah46g6vxziyzqg5jey_@[email protected][email protected]/node_modules/wechaty-puppet-wechat4u/dist/cjs/src/wechat4u/schema-mapper/message/message-parser.js:15:15)
    at async webMessageToWechaty (/app/node_modules/.pnpm/[email protected]_patch_hash=nq4vns7vah46g6vxziyzqg5jey_@[email protected][email protected]/node_modules/wechaty-puppet-wechat4u/dist/cjs/src/wechat4u/schema-mapper/message.js:70:5)
    at async PuppetWechat4u.messagePayload (/app/node_modules/.pnpm/[email protected][email protected]/node_modules/wechaty-puppet/dist/cjs/src/mixins/message-mixin.js:50:29)
    at async PuppetWechat4u.messageSearch (/app/node_modules/.pnpm/[email protected][email protected]/node_modules/wechaty-puppet/dist/cjs/src/mixins/message-mixin.js:67:21)
    at async WechatifiedMessageImpl.findAll (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/wechaty/dist/cjs/src/user-modules/message.js:98:35)
    at async WechatifiedMessageImpl.find (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/wechaty/dist/cjs/src/user-modules/message.js:81:29)
    at async PuppetWechat4u.<anonymous> (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/wechaty/dist/cjs/src/wechaty-mixins/puppet-mixin.js:240:45) 
[2024-05-15T17:46:41.443] [INFO] - Message: Message#Attachment[🗣Contact<ʚDayday🥱ɞ>@👥Room<🤖测试>] 
[2024-05-15T17:46:41.444] [ERROR] - 向 RECVD_MSG_API 上报 message 事件出错: Error: unsupported message. id: 9077318394394722874
    at PuppetWechat4u.messageFile (/app/node_modules/.pnpm/[email protected]_patch_hash=nq4vns7vah46g6vxziyzqg5jey_@[email protected][email protected]/node_modules/wechaty-puppet-wechat4u/dist/cjs/src/puppet-wechat4u.js:592:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async WechatifiedUserClass.toFileBox (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/wechaty/dist/cjs/src/user-modules/message.js:832:25)
    at async sendMsg2RecvdApi (/app/src/service/msgUploader.js:133:41)
    at async Object.onRecvdMessage (/app/src/service/msgSender.js:694:10)
```

如果 `const steamFile = msg.toFileBox ? await msg.toFileBox() :
msg.content()` 这里没有抛出错误,则流程和以前一样
## 调整

- 调整和优化了重复代码
- 转发确实是附件类型,但是简单归为 combineforward
欠妥,假如是真实附件,因为特殊原因报错了,也可能进入这个逻辑,这个时候这里就不是combineforward了
- 暂时将这个分支归到unknown类型里,好像就算展示了文本,也没啥用,但是解决了报错问题 👏 @Daydaylw3 
- web协议能力还是有限(日常吐槽)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants