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.61k stars 232 forks source link

send miniprogram message error #151

Closed YangTe1 closed 3 years ago

YangTe1 commented 3 years ago

code

from xxxx import bot

async def on_message(message: Message):
    msg_type = msg.message_type()
    msg_text = msg.text()
    if msg_text == '小程序':
        miniprogram = bot.MiniProgram.create_from_json({
            'appid': 'gh_0aa444a25adc',
            'title': '我正在使用Authing认证身份,你也来试试吧',
            'pagePath': 'routes/explore.html',
            'description': '身份管家',
            'thumbUrl': '30590201000452305002010002041092541302033d0af802040b30feb602045df0c2c5042b777875706c6f61645f31373533353339353230344063686174726f6f6d3131355f313537363035393538390204010400030201000400',
            'thumbKey': '42f8609e62817ae45cf7d8fefb532e83',
        })
        await msg.say(miniprogram)

and when I send '小程序' to the bot

Traceback (most recent call last):
  File "/home/manbug/.pyenv/versions/3.8.5/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/pyee/_asyncio.py", line 62, in _callback
    self.emit('error', exc)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/wechaty/wechaty.py", line 284, in emit
    super().emit(event, *args, **kwargs)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/pyee/_base.py", line 116, in emit
    self._emit_handle_potential_error(event, args[0] if args else None)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/pyee/_base.py", line 86, in _emit_handle_potential_error
    raise error
  File "/home/manbug/projects/wechaty_demo/listeners/message.py", line 138, in on_message
    await msg.say(miniprogram)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/wechaty/user/message.py", line 172, in say
    await message.ready()
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/wechaty/user/message.py", line 462, in ready
    self.payload = await self.puppet.message_payload(self.message_id)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/wechaty_puppet_hostie/puppet.py", line 403, in message_payload
    response = await self.puppet_stub.message_payload(id=message_id)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/chatie_grpc/wechaty/__init__.py", line 1015, in message_payload
    return await self._unary_unary(
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/betterproto/__init__.py", line 1124, in _unary_unary
    response = await stream.recv_message()
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/grpclib/client.py", line 408, in recv_message
    await self.recv_initial_metadata()
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/grpclib/client.py", line 376, in recv_initial_metadata
    self._raise_for_grpc_status(headers_map)
  File "/home/manbug/.pyenv/versions/wechaty/lib/python3.8/site-packages/grpclib/client.py", line 337, in _raise_for_grpc_status
    raise GRPCError(status, message, details)
grpclib.exceptions.GRPCError: (<Status.INTERNAL: 13>, 'no message rawPayload for message id 1298848380366628342', None)

in wechaty/wechaty log:

08:54:54 VERB PuppetServiceImpl contactPayload()
08:54:54 VERB PuppetServiceImpl contactAvatar()
08:54:54 VERB PuppetServiceImpl messageSendMiniProgram()
08:54:54 VERB Puppet selfId()
08:54:54 VERB PadplusMessage sendMessage()
08:54:54 VERB PuppetServiceImpl messagePayload()
08:54:54 VERB Puppet messagePayload(1298848380366628342)
08:54:54 ERR PuppetPadplus messageRawPayload(1298848380366628342) manager.cacheManager.getMessage(1298848380366628342) return nothing.
08:54:54 ERR PuppetServiceImpl grpcError() messagePayload() rejection: no message rawPayload for message id 1298848380366628342
{
  code: 13,
  details: 'no message rawPayload for message id 1298848380366628342'
}
YangTe1 commented 3 years ago

wechaty/wechaty: 0.48

wechaty 0.6.13 wechaty-puppet 0.2.0 wechaty-puppet-hostie 0.2.16