wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.62k stars 234 forks source link

[Bug]: 无法捕获被撤回的消息 #416

Open smartzry opened 1 year ago

smartzry commented 1 year ago

Environment

- wechaty:
- wechaty-puppet: padlocal
- wechaty-puppet-service: 
- wechaty-plugin-contrib: 
- token type: padlocal|wxwork|xp
- the version of wechaty docker container: [0.65]

Description

想做一个防止撤回的功能,但是shell报错如下

2023-09-02 20:06:38,718 - Message - ERROR - can"t load or ready message payload ()
2023-09-02 20:06:38,718 - Wechaty - ERROR - internal error <WechatyOperationError('can"t load or ready message payload ()', None, None)>

Minimum reproducible code

class MyBot(Wechaty):
    async def on_message(self, msg: Message) -> None:
        if msg.type() == MessageType.MESSAGE_TYPE_RECALLED:
            recalled_message = await msg.to_recalled()
            print(f"{recalled_message}被撤回")
asyncio.run(MyBot().start())