wechaty / wechaty-puppet-padchat

Padchat Puppet for Wechaty
https://www.npmjs.com/package/wechaty-puppet-padchat
Apache License 2.0
282 stars 46 forks source link

Mini program type identify error #187

Open kis87988 opened 6 years ago

kis87988 commented 6 years ago

0. Report Issue Guide

Please search in the issue first, and make sure your problem had not been reported before.

1. Expected behavior

Question: What behavior do you expect? const TYPE = await msg.type() console.log(TYPE == Message.Type.MiniProgram) Answer: Ture

2. Actual behavior

Question: What actual behavior did you experience?

Answer: False

3. Steps to reproduce your problem (and fixes, if any)

console.log(msg.content)

<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"wxc4c0253df149f02d\" sdkver=\"0\">\n\t\t<title>组队吃鸡,一起刺激!好友开黑,缺你一个!</title>\n\t\t<des>组队吃鸡!今晚一起大吉大利,就等你</des>\n\t\t<action />\n\t\t<type>36</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>https://game.weixin.qq.com/cgi-bin/h5/static/gamecenter/gamelauncher.html?appid=wxc4c0253df149f02d&amp;join=1&amp;message=%7B%22team%5Froleid%22%3A%221145034233%22%2C%22team%5Fteamid%22%3A172092262262559%7D#wechat_redirect</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5 />\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>30580201000451304f0201000204945187ec020310d95f020422c1cdcb02045ba9b1da042a777875706c6f61645f393432353034313638354063686174726f6f6d3230355f313533373834373737300204010c00030201000400</cdnthumburl>\n\t\t\t<cdnthumbmd5>e5b1a01bcb5a6a3c3ce892d1f453c9a1</cdnthumbmd5>\n\t\t\t<cdnthumblength>27950</cdnthumblength>\n\t\t\t<cdnthumbwidth>420</cdnthumbwidth>\n\t\t\t<cdnthumbheight>335</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>cc2f6cef55b44ec08f8f4f6f41fb2ede</cdnthumbaeskey>\n\t\t\t<aeskey>cc2f6cef55b44ec08f8f4f6f41fb2ede</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t\t<filekey>wxid_b19nbi9oqkpg126642_1537911816</filekey>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername />\n\t\t<sourcedisplayname />\n\t\t<thumburl />\n\t\t<md5 />\n\t\t<statextstr>GhQKEnd4YzRjMDI1M2RmMTQ5ZjAyZA==</statextstr>\n\t\t<weappinfo>\n\t\t\t<username><![CDATA[gh_38a40ad4305c@app]]></username>\n\t\t\t<pagepath><![CDATA[pages/index/index.html?teamid=172092262262559&platid=0&battleid=1&message=%7B%22team%5Froleid%22%3A%221145034233%22%2C%22team%5Fteamid%22%3A172092262262559%7D]]></pagepath>\n\t\t\t<version>19</version>\n\t\t\t<weappiconurl><![CDATA[http://mmbiz.qpic.cn/mmbiz_png/jVranEoLPrWSzuAILwYEcdMOicQ0ic0Ihwg7yp1qjIpZEzlzhyOEZTdb6px66onQG0au1QXtWT68zFMib9TWuBicGg/0?wx_fmt=png]]></weappiconurl>\n\t\t\t<pkginfo>\n\t\t\t\t<type>0</type>\n\t\t\t\t<md5><![CDATA[]]></md5>\n\t\t\t</pkginfo>\n\t\t</weappinfo>\n\t</appmsg>\n\t<fromusername>a38372624</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>108</version>\n\t\t<appname>绝地求生:刺激战场</appname>\n\t</appinfo>\n\t<commenturl></commenturl>\n</msg>\n

This part is very important: if you can not provide any reproduce steps, then the problem will be very hard to be recognized.

Question: What're the reproducible steps for us to see your problem?

Answer: I can forward the mini program over.

temporary solution:

const IS_MINI_PROGRAM = (TYPE == Message.Type.MiniProgram || 
(/<appmsg appid=/gmi.test(CONTENT) && /@app/gmi.test(CONTENT)))       

4. Full Output Logs

N/A for now

Other note: This may be wechaty issue?

kis87988 commented 6 years ago

may also Refer to https://github.com/lijiarui/wechaty-puppet-padchat/issues/184

lijiarui commented 6 years ago

Thanks for the report, should fix in the future :)