wechaty / puppet-padlocal

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

mentionSelf空id报错 #217

Open mumup opened 1 year ago

mumup commented 1 year ago

"wechaty": "^1.19.10" "wechaty-puppet-padlocal": "^1.20.1"

在windows 微信客户端中@ bot会产生空id,导致mentionSelf错误

21:53:10 SILL [PuppetPadlocal] on push original message: {"id":"4481793967138661851","type":1,"createtime":1675432383,"fromusername":"17781048866@chatroom","tousername":"wxid_ggx43f4ff8z312","content":"panlin527981670:\n@机器猫 ","pushcontent":"在群聊中@了你","binarypayload":"","atList":["","wxid_ggx43f4ff8z312"]}
21:53:10 SILL [PuppetPadlocal] 0a1334343831373933393637313338363631383531100118bfa3f49e06221431373738313034383836364063686174726f6f6d2a13777869645f676778736734346666387a333132321e70616e6c696e3532373938313637303a0a40e69cbae599a8e78cabe280853a26e5b9bfe5b79ee59cb0e9938133e58fb7e7babfe59ca8e7bea4e8818ae4b8ad40e4ba86e4bda04a004a13777869645f676778736734346666387a333132
21:53:10 VERB Message find({"id":"4481793967138661851"})
21:53:10 VERB Message findAll({"id":"4481793967138661851"})
21:53:10 VERB PuppetMessageMixin messageSearch({"id":"4481793967138661851"})
21:53:10 VERB PuppetMessageMixin messagePayload(4481793967138661851)
21:53:10 SILL PuppetMessageMixin messagePayloadCache(4481793967138661851) cache MISS
21:53:10 SILL PuppetMessageMixin messagePayload(4481793967138661851) cache SET
21:53:10 VERB Message static load(4481793967138661851)
21:53:10 VERB Message constructor(4481793967138661851) for class WechatifiedMessageImpl
21:53:10 VERB Message ready()
21:53:10 VERB PuppetMessageMixin messagePayload(4481793967138661851)
21:53:10 SILL Room find({"id":"17781048866@chatroom"})
21:53:10 SILL Room ready()
21:53:10 SILL Contact find({"id":"panlin527981670"})
21:53:10 SILL PuppetLoginMixin get currentUserId()
21:53:10 SILL Contact ready() @ Puppet<PuppetPadlocal>(机器猫) with id="fakeid"
21:53:10 SILL Contact ready() isReady() true
21:53:10 SILL PuppetLoginMixin get currentUserId()
21:53:10 SILL PuppetLoginMixin get currentUserId()
21:53:10 SILL PuppetLoginMixin get currentUserId()
21:53:10 VERB Message mentionList()
21:53:10 SILL Contact find({"id":""})
21:53:10 VERB Contact findAll({"id":""})
21:53:10 VERB PuppetContactMixin contactSearch(query={"id":""}, )
21:53:10 SILL Contact find({"id":"wxid_ggx43f4ff8z312"})
21:53:10 SILL PuppetLoginMixin get currentUserId()
21:53:10 SILL Contact ready() @ Puppet<PuppetPadlocal>(机器猫) with id="wxid_ggx43f4ff8z312"
21:53:10 SILL Contact ready() isReady() true
21:53:10 SILL PuppetContactMixin contactSearch() searchIdList.length = 259
21:53:10 VERB PuppetContactMixin contactQueryFilterFactory({"id":""})
Error: filterValue not found for filterKey: id
    at PuppetPadlocal.contactQueryFilterFactory (D:\dev\bot\w-bot\node_modules\wechaty-puppet\dist\cjs\src\mixins\contact-mixin.js:139:23)
    at PuppetPadlocal.contactSearch (D:\dev\bot\w-bot\node_modules\wechaty-puppet\dist\cjs\src\mixins\contact-mixin.js:67:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async WechatifiedContactImpl.findAll (D:\dev\bot\w-bot\node_modules\wechaty\dist\cjs\src\user-modules\contact.js:155:35)
    at async WechatifiedContactImpl.find (D:\dev\bot\w-bot\node_modules\wechaty\dist\cjs\src\user-modules\contact.js:110:29)
    at async Promise.all (index 0)
    at async WechatifiedUserClass.mentionList (D:\dev\bot\w-bot\node_modules\wechaty\dist\cjs\src\user-modules\message.js:584:32)
    at async WechatifiedUserClass.mentionSelf (D:\dev\bot\w-bot\node_modules\wechaty\dist\cjs\src\user-modules\message.js:672:29)
    at async WechatyImpl.default_1 (D:\dev\bot\w-bot\dist\handles\message.js:19:25)
userAmani commented 1 year ago

一样,不单单mentionSelf会空id报错message.say也会

mumup commented 1 year ago

可以先用我fork构建的包

FavorMylikes commented 1 year ago

@mumup What did you do, maybe you can make a pull request.

FavorMylikes commented 1 year ago

@huan Does this lead to other problems? https://github.com/wechaty/puppet-padlocal/blob/343b7f49c9f9e09d7c10d3e863e888b0bf241d2f/src/padlocal/schema-mapper/message/message-parser-room.ts#L63-L64

FavorMylikes commented 1 year ago

Still exists.

bestK commented 1 year ago
yarn remove wechaty-puppet-padlocal
yarn add @666666/wechaty-puppet-padlocal
import { PuppetPadlocal } from "@666666/wechaty-puppet-padlocal";
HuFakai commented 9 months ago

try { [机器人被@] await message.mentionSelf() await addRoom() } catch (error) { 机器人被win weixin@ addRoom() }

huan commented 8 months ago

@FavorMylikes LGTM