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

[Bug]: 从windows微信客户端@机器人,msg.mention_text() 会报错,手机端不会 #389

Open
gpww opened this issue Mar 17, 2023 · 4 comments

Comments

@gpww
Copy link

gpww commented Mar 17, 2023

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
Copy link

这里contact_id会拿到一个空"",可以先判空过滤一下绕过

for contact_id in self.payload.mention_ids]

@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Mar 25, 2023

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
Copy link

biofer commented Jun 29, 2023

同样遇到这个问题,通过

if await msg.mention_self():
    if await msg.mention_self():
        pass
    if await msg.mention_list():
        keyword = await msg.mention_text()

这个代码没有解决问题。
使用 #390 ,可以解决问题,希望官方可以重视。
感谢@B1gM8c 的贡献。

@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Jul 3, 2023

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.

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

No branches or pull requests

4 participants