-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[New Puppet] PuppetWechat4u - enable by WECHATY_PUPPET=wechat4u
#69
Comments
Challenge start: finish a new puppet in one night! See https://github.com/nodeWechat/wechat4u/blob/master/run-core.js Now is June 1, 10pm. |
Start from scratch at 00:00 am, now is 2:16 am. |
Succeed at 1:11 pm!
Challenge Summary
ConclusionWe can build a new Puppet in 1 work day! Demo Output$ WECHATY_PUPPET=wechat4u WECHATY_LOG=info DEBUG=* npm run demo
> wechaty@0.15.95 demo /home/zixia/chatie/wechaty
> ts-node examples/ding-dong-bot.ts
| __ __ _ _
| \ \ / /__ ___| |__ __ _| |_ _ _
| \ \ /\ / / _ \/ __| '_ \ / _` | __| | | |
| \ V V / __/ (__| | | | (_| | |_| |_| |
| \_/\_/ \___|\___|_| |_|\__,_|\__|\__, |
| |___/
=============== Powered by Wechaty ===============
-------- https://github.com/chatie/wechaty --------
I'm a bot, my superpower is talk in Wechat.
If you send me a 'ding', I will reply you a 'dong'!
__________________________________________________
Hope you like it, and you are very welcome to
upgrade me to more superpowers!
Please wait... I'm trying to login in...
13:13:05 INFO Wechaty v#git[1c24bf1] starting...
13:13:05 INFO Wechaty initPuppet() using puppet: wechat4u
wechat 重启中... +0ms
follow-redirects options { maxRedirects: 21,
protocol: 'https:',
hostname: 'wx.qq.com',
port: null,
path:
'/cgi-bin/mmwebwx-bin/webwxinit?pass_ticket=HVzv4jGSpfn%252F%252BM6SHE3ZR%252BiAZZ5wma7JJQJXaOJKxKm11oNhSM2kT6%252BYKwd56Lfk&skey=@crypt_c117402d_ce0dcad71413fb0db87ccbe3f445b552&r=1091971814',
method: 'POST',
headers:
{ Accept: 'application/json, text/plain, */*',
'user-agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36',
connection: 'close',
cookie:
'pgv_pvi=11436618067571104000; pgv_si=s331744187855914500; wxuin=1211516682; wxsid=X5DHlBFELj1Pziyl; wxloadtime=1527915233; mm_lang=zh-CN; webwx_data_ticket=gSd1Qet8FHrlIzQl8uQCfF87; webwxuvid=747895d9dac5a25dd3a78175a5e931d820622c2c2e100257730e529062f992fe7b8677a8b2980f54e6ad283848618766; webwx_auth_ticket=CIsBEMqOnqAMGoABbV0bKSiVjFh4uH1OaLDKlkBrdj0sUYPfjR26FICA+K6SUNLBZE/Xrk3r6M6mpYIFnD6Vwuq7L/tAAovTAZxAwNMGZfEXhaGDFKBX1DL+ck8eDHmtwVax5ZEv7MdtJGy8i76oetciEhh2n++z+ps+/wRvYBZ8iobG/CagXHlSLck=',
'Content-Type': 'application/json;charset=utf-8',
'Content-Length': 147 },
agent: false,
auth: undefined } +1ms
wechat 心跳 +2s
follow-redirects options { maxRedirects: 21,
protocol: 'https:',
hostname: 'wx.qq.com',
port: null,
path:
'/cgi-bin/mmwebwx-bin/webwxstatusnotify?pass_ticket=HVzv4jGSpfn%252F%252BM6SHE3ZR%252BiAZZ5wma7JJQJXaOJKxKm11oNhSM2kT6%252BYKwd56Lfk&lang=zh_CN',
method: 'POST',
headers:
{ Accept: 'application/json, text/plain, */*',
'user-agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36',
connection: 'close',
cookie:
'pgv_pvi=11436618067571104000; pgv_si=s331744187855914500; wxuin=1211516682; wxsid=X5DHlBFELj1Pziyl; wxloadtime=1527915233; mm_lang=zh-CN; webwx_data_ticket=gSd1Qet8FHrlIzQl8uQCfF87; webwxuvid=747895d9dac5a25dd3a78175a5e931d820622c2c2e100257730e529062f992fe7b8677a8b2980f54e6ad283848618766; webwx_auth_ticket=CIsBEMqOnqAMGoABbV0bKSiVjFh4uH1OaLDKlkBrdj0sUYPfjR26FICA+K6SUNLBZE/Xrk3r6M6mpYIFnD6Vwuq7L/tAAovTAZxAwNMGZfEXhaGDFKBX1DL+ck8eDHmtwVax5ZEv7MdtJGy8i76oetciEhh2n++z+ps+/wRvYBZ8iobG/CagXHlSLck=',
'Content-Type': 'application/json;charset=utf-8',
'Content-Length': 354 },
agent: false,
auth: undefined } +6ms
{ MsgId: '3971822301789638769',
FromUserName:
'@@619a6af1d26cc8cb4f27efba3756da634a79d8565fd44dadb22ef5b728c10752',
ToUserName:
'@548e31e461de6823e86c4261fcd5bd5c3b5f99d911dd3b92853893c83be9171b',
MsgType: 43,
Content:
'@5b7fad094cb2b09b91bbf544d02b57b4:\n@859e5247d4ffaed0372f8aa900924b01d11a3f27c2bbb3513c5ef6f37eb76d841f51c97463429b11976df154d8bbe302ee5e939915846ff4b1d40fc94ea747335af430abc2e92a5a96a7fdd957f33334bb4eaac644f1c9a6f7fd4f75b77cccf55dc949b32fc06f6eb218c13f1ad283f4a85414359937d96d80699ad425068ef2448f74c3720ae0414f4b6afaf1d5a0428bb71444fb145a43ac100c9ae05b86006e9bf6454ca13e6f933ee2bfd49876a66570ef155212e889de0cbf299d29f8cdee722495a597fa13d39f3960a481b71fb9f706b3240c8abff5ce3bd3fbbc1863f0de7fba6c04c2e79ed3fc5b4e578280aa4a75f3c96b7f0830545baa8ed9410e1bc7a98b2629e44938099f0c8eebd7b0c9b22dcd1a7857f494bed8f3ca982f3d5098e79fc0adecc0b625a530937e6a03847d3378b5ba27312d062eb5b325cebb580c736b55225e1aaef2b91c779cfdbd094e8cd0cb8ecf0d5157213f001f5e58293b1b37f57fe57f936bae31e65e78789b0e524ea88db429ced06febcb50c5de499eb01d6ada58032316110b5a68390b0d333ab1190ebb4195399bb581a3a8deda3414cc683e4be6caccbfcc7507801a5233d28e8dbcd5adc3e6f2252c402310d2230602815b07ed8692e521b007d18216e99d4096b30fbb43752a2f0bf8a582e06b99ee50dc36648aaa8c864ede4c930dab809f3de34f7ead33c430df3e204099bf2110bd0dc1d548d39a12f43106864cdf4b01ea5b5494a81f3bf83f496465e0c931ec43aa983b2ca3ab3e0c37c6bc4593fb6df958f524e7804ee9a5c377749ce08fb36974be2524c3758294773759ce95e39eb5bf54b5db8ea4c15bfb6b07676371e7dc82ba22c77859efe37753a409c4d7cdad04b8530f2ae4e9af63c4775351ff46bd0d3758dc2054bf6290d7e216eb6e089944724fab71ece7338393b183b0fe1e3d97b5190b36b4bc0daba3c2ba61edac7ae60f7c319845d1cfa91f42e115cf443adaa0d80b45a685c9565ebdeb0d4554fa4b8e9fd3d62b935b82a2f407a8a2aea5c41b60491b18ac07fd44ce1f91d8a2b1385797c27579c4450a2d0bdf38602dd0e2a8376ebb877ba7355a7934ae8dfbafa3ab4883c257e41a4f84bcc1984c0a5b4f94d1e77cc44443ccb70ecaca58dc29fd7f7338344a5e9cb88fa1c63b87630c5c64e3cfcaf27723c05166',
Status: 3,
ImgStatus: 1,
CreateTime: 1527916387,
VoiceLength: 0,
PlayLength: 15,
FileName: '',
FileSize: '',
MediaId: '',
Url: '',
AppMsgType: 0,
StatusNotifyCode: 0,
StatusNotifyUserName: '',
RecommendInfo:
{ UserName: '',
NickName: '',
QQNum: 0,
Province: '',
City: '',
Content: '',
Signature: '',
Alias: '',
Scene: 0,
VerifyFlag: 0,
AttrStatus: 0,
Sex: 0,
Ticket: '',
OpCode: 0 },
ForwardFlag: 0,
AppInfo: { AppID: '', Type: 0 },
HasProductId: 0,
Ticket: '',
ImgHeight: 512,
ImgWidth: 288,
SubMsgType: 0,
NewMsgId: 3971822301789638700,
OriContent: '',
EncryFileName: '',
isSendBySelf: false,
OriginalContent:
'@5b7fad094cb2b09b91bbf544d02b57b4:<br/>@859e5247d4ffaed0372f8aa900924b01d11a3f27c2bbb3513c5ef6f37eb76d841f51c97463429b11976df154d8bbe302ee5e939915846ff4b1d40fc94ea747335af430abc2e92a5a96a7fdd957f33334bb4eaac644f1c9a6f7fd4f75b77cccf55dc949b32fc06f6eb218c13f1ad283f4a85414359937d96d80699ad425068ef2448f74c3720ae0414f4b6afaf1d5a0428bb71444fb145a43ac100c9ae05b86006e9bf6454ca13e6f933ee2bfd49876a66570ef155212e889de0cbf299d29f8cdee722495a597fa13d39f3960a481b71fb9f706b3240c8abff5ce3bd3fbbc1863f0de7fba6c04c2e79ed3fc5b4e578280aa4a75f3c96b7f0830545baa8ed9410e1bc7a98b2629e44938099f0c8eebd7b0c9b22dcd1a7857f494bed8f3ca982f3d5098e79fc0adecc0b625a530937e6a03847d3378b5ba27312d062eb5b325cebb580c736b55225e1aaef2b91c779cfdbd094e8cd0cb8ecf0d5157213f001f5e58293b1b37f57fe57f936bae31e65e78789b0e524ea88db429ced06febcb50c5de499eb01d6ada58032316110b5a68390b0d333ab1190ebb4195399bb581a3a8deda3414cc683e4be6caccbfcc7507801a5233d28e8dbcd5adc3e6f2252c402310d2230602815b07ed8692e521b007d18216e99d4096b30fbb43752a2f0bf8a582e06b99ee50dc36648aaa8c864ede4c930dab809f3de34f7ead33c430df3e204099bf2110bd0dc1d548d39a12f43106864cdf4b01ea5b5494a81f3bf83f496465e0c931ec43aa983b2ca3ab3e0c37c6bc4593fb6df958f524e7804ee9a5c377749ce08fb36974be2524c3758294773759ce95e39eb5bf54b5db8ea4c15bfb6b07676371e7dc82ba22c77859efe37753a409c4d7cdad04b8530f2ae4e9af63c4775351ff46bd0d3758dc2054bf6290d7e216eb6e089944724fab71ece7338393b183b0fe1e3d97b5190b36b4bc0daba3c2ba61edac7ae60f7c319845d1cfa91f42e115cf443adaa0d80b45a685c9565ebdeb0d4554fa4b8e9fd3d62b935b82a2f407a8a2aea5c41b60491b18ac07fd44ce1f91d8a2b1385797c27579c4450a2d0bdf38602dd0e2a8376ebb877ba7355a7934ae8dfbafa3ab4883c257e41a4f84bcc1984c0a5b4f94d1e77cc44443ccb70ecaca58dc29fd7f7338344a5e9cb88fa1c63b87630c5c64e3cfcaf27723c05166' }
follow-redirects options { maxRedirects: 21,
protocol: 'https:',
hostname: 'webpush.wx.qq.com',
port: null,
path:
'/cgi-bin/mmwebwx-bin/synccheck?r=1527916396794&sid=X5DHlBFELj1Pziyl&uin=1211516682&skey=@crypt_c117402d_ce0dcad71413fb0db87ccbe3f445b552&deviceid=e726504311449325&synckey=1_679446148%7C2_679450454%7C3_679448912%7C11_679449713%7C201_1527916387%7C203_1527910120%7C1000_1527916093%7C1001_1527894314%7C2001_1527672305',
method: 'GET',
headers:
{ Accept: 'application/json, text/plain, */*',
'user-agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36',
connection: 'close',
cookie:
'pgv_pvi=11436618067571104000; pgv_si=s331744187855914500; wxuin=1211516682; wxsid=X5DHlBFELj1Pziyl; wxloadtime=1527915233_expired; mm_lang=zh-CN; webwx_data_ticket=gSd1Qet8FHrlIzQl8uQCfF87; webwxuvid=747895d9dac5a25dd3a78175a5e931d820622c2c2e100257730e529062f992fe7b8677a8b2980f54e6ad283848618766; webwx_auth_ticket=CIsBEMqOnqAMGoABbV0bKSiVjFh4uH1OaLDKlkBrdj0sUYPfjR26FICA+K6SUNLBZE/Xrk3r6M6mpYIFnD6Vwuq7L/tAAovTAZxAwNMGZfEXhaGDFKBX1DL+ck8eDHmtwVax5ZEv7MdtJGy8i76oetciEhh2n++z+ps+/wRvYBZ8iobG/CagXHlSLck=; wxpluginkey=1527916093' },
agent: false,
auth: undefined } +9ms
(node:4453) UnhandledPromiseRejectionWarning: Error: from not found
at PuppetWechat4u.<anonymous> (/home/zixia/chatie/wechaty/src/puppet-wechat4u/puppet-wechat4u.ts:535:17)
at Generator.next (<anonymous>)
at fulfilled (/home/zixia/chatie/wechaty/src/puppet-wechat4u/puppet-wechat4u.ts:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:4453) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4453) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
13:13:18 INFO Bot 李卓桓 login |
WECHATY_HEAD=WECHAT4U
WECHATY_PUPPET=wechat4u
I have a plan that Wechaty switches to use PuppetWechat4u as default puppet in the future version, but this requires the PuppetWechat4u is stable enough for basic operations, at least the same as PuppetPuppeteer. If anyone is interested in testing PuppetWechat4u with Wechaty v0.17, please check out the latest source code and run the following command to enable wechat4u puppet: DEBUG=* WECHATY_LOG=silly WECHATY_PUPPET=wechaty-puppet-wechat4u npm start Please feel free to file issues if you meet any problem, thanks! |
Awesome work! |
Thank you @seanxlliu . Did you use wechat4u before? |
Never used yet, so I meant the efficiency of this work is very impressive. I would like to contribute to this project too, testing or coding. Just switch to this puppet due to the default puppet's limitation, room contact is incorrect. However, I just hit some assert failures when using after switching to this one. Maybe it out of date. I am filing a bug now. |
Where can I access the source code? Actually what I would like to know is how to use this module together with webchaty? Is there any example code? |
You can run wechaty demo with wechaty-puppet-wechat4u by running the following command in this repository: $ WECHATY_PUPPET=wechaty-puppet-wechat4u WECHATY_LOG=info DEBUG=* npm run demo |
Today, wechaty has only one puppet support:
PuppetWeb
, which is powered by Selenium WebDriver with Chrome Browser.PuppetWeb
has the following pros and cons:Advantages
Disadvantages
About Wechat4U
Wechat4U is an excellent wechat bot framework that supports both Node.js & Browser, with rich features and an active community of experienced contributors.
So I believe it's a bright decision to made a new Puppet like
PuppetWechat4U
, to let wechaty users have the second way to use wechaty: not only by Browser Hook but also by Server API Call.The Plan
This practice will be a good chance to check the wechaty abstract/base classes(the codes under
/src
directory), to start decoupling with the WebDriver and become more robust, more reusable for the future possiblePuppetAndroid
,PuppetAndroidPad
,PuppetIos
,PuppetIosPad
.TBD
Reference
The text was updated successfully, but these errors were encountered: