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 Report: Message Truncated after ":\n" #362

Open profthecopyright opened 2 years ago

profthecopyright commented 2 years ago

requirements

Describe your problem

The message received by wechaty is truncated after ":\n"

Reproduce your problem

async def on_message(self, msg: Message) -> None:
    await msg.say(msg.text())

# User input: "Hello:\nWorld" from WeChat client
# Bot reply: "Hello"

Error info (from puppet gateway)

01:08:44 VERB Message static load(3014709858899896317)
01:08:44 VERB Message constructor(3014709858899896317) for class WechatifiedMessage
01:08:44 VERB Message ready()
01:08:44 VERB Puppet messagePayload(3014709858899896317)
01:08:44 VERB EventStreamManager grpcEmit(EVENT_TYPE_MESSAGE[2], {"messageId":"3014709858899896317"})
01:08:44 VERB Room ready()
01:08:44 VERB Puppet selfId()
01:08:44 VERB IoClient onMessage(Message#Text[🗣Contact<username>@👥Room<groupname>]      Hello)
01:08:44 VERB PuppetServiceImpl messagePayload()
01:08:44 VERB Puppet messagePayload(3014709858899896317)

Your experiments

please tell us your experiments and ideas about this issue. It's valuable for us to help you find the solution.

duanghuang commented 2 years ago

朋友,你的Friendship.search功能可以正常使用吗

YanCore commented 1 year ago

我也出现了这样的情况。在 : 后面换行消息会被截断。问题主要出现在群聊消息中,个人消息没出现。

YanCore commented 1 year ago

很高兴我解决了这个问题!是 puppet-padlocal v0.4.2 的 Bug ,但似乎最新版本依旧存在部分问题。

我 fork 了原项目,并简单修复了这个问题,可以重新编译并替换原模块 YanCore/puppet-padlocal at fixbug-v0.4.2

原谅我不懂 TypeScript ,推荐自行修改源代码并重新编译!如果需要,可以使用我在 docker 容器中编译好的文件。

docker run -ti --name wechaty_puppet_service_token_gateway --rm -e WECHATY_LOG="verbose" -e WECHATY_PUPPET="wechaty-puppet-padlocal" -e WECHATY_PUPPET_PADLOCAL_TOKEN="puppet_padlocal_XXXXXX" -e WECHATY_PUPPET_SERVER_PORT="9001" -e WECHATY_TOKEN="1fe5f846-3cfb-401d-b20c-XXXXX" -p "9001:9001" -v "${pwd}/dist-fixbug-v0.4.2-docker-v0.65:/wechaty/node_modules/wechaty-puppet-padlocal/dist" wechaty/wechaty:0.65