[Bug]: 从windows微信客户端@机器人,msg.mention_text() 会报错,手机端不会
gpww opened this issue · 4 comments
gpww commented
Environment
- wechaty:
- wechaty-puppet:
- wechaty-puppet-service:
- wechaty-plugin-contrib:
- token type: padlocal|wxwork|xp
- the version of wechaty docker container: [0.65]
Description
从windows微信客户端@机器人,msg.mention_text() 会报错
Wechaty - ERROR - internal error <>
Minimum reproducible code
text = await msg.mention_text()
aardwolf109 commented
这里contact_id会拿到一个空"",可以先判空过滤一下绕过
python-wechaty/src/wechaty/user/message.py
Line 462 in 6c9d54f
wj-Mcat commented
It's not a bug in python-wechaty: you should check whether the text is mentional message with the following:
if await msg.mention_self():
pass
if await msg.mention_list():
mention_text = await msg.mention_text()
So please help yourself to upgrade the code. Good luck to you.
biofer commented
wj-Mcat commented
According to the diffs
between #390 and https://github.com/wechaty/python-wechaty/tree/main, it seems that cached contacts is dirty not been updated. Fetching all of contacts works but violence.
I will try to merge this pr to fix this bug and refactor it later.