Skip to content
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

Questions from the getting startted project #1427

Closed
realtebo opened this issue Jul 1, 2018 · 13 comments
Closed

Questions from the getting startted project #1427

realtebo opened this issue Jul 1, 2018 · 13 comments

Comments

@realtebo
Copy link

realtebo commented Jul 1, 2018

About this page: https://chatie.io/wechaty/

I sugggest to remove this link: Wechaty Starter Project -> https://github.com/lijiarui/wechaty-getting-started

@huan huan added the bug label Jul 1, 2018
@huan
Copy link
Member

huan commented Jul 1, 2018

@realtebo Thank you for pointing this old and outdated project out!

Instead of removing the link to it, we would like to improve(rewrite) it and get it to work with the latest Wechaty code.

Sorry for the misleading by it to you today, hope you could understand that we had moved very fast with this opensource project recently, and leave many jobs behind us.

BTW: I had just rewrite this repository and make sure it works with the last version of Wechaty now. Please have a look again at https://github.com/lijiarui/wechaty-getting-started, and feel free to let me know if you still have any issues about Wechaty.

Have a good day!

@realtebo
Copy link
Author

realtebo commented Jul 1, 2018

Prologue: i thinks you're a very good professional programmer, because you're using ALL the tools available for CI/CD and all best practice. I want you know I admire you, I respect you. From programmer to programmer.

The new versions seems more linear.

I dislike the fake video link that point to the blog post, because when I am here the video is not telling me how to install, so it should be directly linked and should be placed AFTER the 'RUN' section.

Also this initial text is not so usefull because is without context

Functions as follows:
Show a QR Code for scan
Login with your user information
Log all the messages to console

You probably here should present what is the framework and what can it do.

Any way, trying to READ and FOLLOW....

I got this when npm installing

D:\wechaty-getting-started\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
D:\wechaty-getting-started\node_modules\node-expat\build\deps\libexpat\..\..\..\deps\libexpat\version.c

my environment:

  • windows 10 professional
  • git bash
$ git --version
git version 2.8.1.windows.1
$ node --version
v10.3.0
$ npm --version
6.1.0

@realtebo
Copy link
Author

realtebo commented Jul 1, 2018

Also:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN wechaty-puppet-wechat4u@0.2.7 requires a peer of wechaty-puppet@0.2.3 but none is installed. You must install peer dependencies yourself.

Why must install a peer dependency manually?

Suggestions: it's a good practice to commit the lock file so we have exactly the same packages tree that you're using

@realtebo
Copy link
Author

realtebo commented Jul 1, 2018

And this after login:

(node:12948) UnhandledPromiseRejectionWarning: Error: AssertionError [ERR_ASSERTION]: 1 == 0
    at PuppetWechat4u.puppet.on.error (D:\wechaty-getting-started\node_modules\wechaty\src\wechaty.ts:575:32)
    at PuppetWechat4u.emit (events.js:182:13)
    at PuppetWechat4u.EventEmitter.emit (domain.js:442:20)
    at PuppetWechat4u.emit (D:\wechaty-getting-started\node_modules\wechaty-puppet\src\puppet.ts:212:18)
    at Wechat.wechat4u.on (D:\wechaty-getting-started\node_modules\wechaty-puppet-wechat4u\src\puppet-wechat4u.ts:247:12)
    at Wechat.emit (events.js:182:13)
    at Wechat.EventEmitter.emit (domain.js:442:20)
    at D:\wechaty-getting-started\node_modules\wechat4u\src\wechat.js:200:14
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:12948) 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:12948) [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.

@realtebo
Copy link
Author

realtebo commented Jul 1, 2018

I installed docker, which temporary disallows me to run vmware workstation, just to try it in a controlled environment.

I got same error:

https://api.qrserver.com/v1/create-qr-code/?data=https%3A%2F%2Flogin.weixin.qq.com%2Fl%2FIfXEuTejXw%3D%3D&size=220x220&margin=20
(node:19) UnhandledPromiseRejectionWarning: Error: AssertionError [ERR_ASSERTION]: 1 == 0
    at PuppetWechat4u.puppet.on.error (/wechaty/src/wechaty.ts:575:32)
    at PuppetWechat4u.emit (events.js:182:13)
    at PuppetWechat4u.EventEmitter.emit (domain.js:442:20)
    at PuppetWechat4u.emit (/wechaty/node_modules/wechaty-puppet/src/puppet.ts:212:18)
    at Wechat.wechat4u.on (/wechaty/node_modules/wechaty-puppet-wechat4u/src/puppet-wechat4u.ts:243:12)
    at Wechat.emit (events.js:182:13)
    at Wechat.EventEmitter.emit (domain.js:442:20)
    at /wechaty/node_modules/wechat4u/src/wechat.js:200:14
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:19) 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:19) [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.

@huan
Copy link
Member

huan commented Jul 1, 2018

Hello @realtebo,

Thank you for your Prologue, I really appreciate your words on our project and ourselves.

I understand that you had many troubles when getting started with Wechaty, really sorry about that.

There are many reasons related to those issues, I'll list some of them at here:

  1. npm install: That should work under windows, because we are using Appveyor(Win32) CI at here with a green status. However, I had not run Wechaty under windows for a long time, so I'm not sure about that. for now, at least you can check the CI setting to help you install under win32 successfully.
  2. peer dependencies: We are splitting part of our code base to solo NPM module this week, and it's in heavy refactoring/debuging right now(with v0.17). See Promote PuppetPuppeteer to SOLO NPM Module wechaty-puppet-puppeteer #1371 Promote PuppetPadchat to SOLO NPM Module wechaty-puppet-padchat #1372 Split PuppetWechat4u as a NPM module #1419
  3. error after login: it seems that your account can not use Web Wechat. If you can not login via https://wx.qq.com, then you can not use Web API in Wechaty.

Summary

You need use Wechaty with Padchat Puppet. I saw you had already applied the padchat alpha testing, hope @lijiarui could be able to process your application soon.

BTW: my wechat is 918999, please feel free to add me and I might be able to support you via wechat if possible.

@realtebo
Copy link
Author

realtebo commented Jul 1, 2018

Thanks for your reply, and patience.

I confirm that I cannot use Web wechat. I got
<error><ret>1203</ret><message>Per salvaguardare la sicurezza del tuo account, l'accesso a WeChat via Web è stato sospeso. Puoi accedere a WeChat per Windows o a WeChat per Mac su un computer. Scarica WeChat per Windows o Mac all'indirizzo http://wechat.com.</message></error>

Which in english simply means I cannot use wechat web.

I'll wait for entering in the new alpha team.

For me is still a obscure mystery what "Padchat Puppet" means.

I know puppets system, I use in my job to keep synced about 150 windows servers configurations, updated, legacy win software deployment/update etc...

But how puppet system is related to wechat?

I was able to understand the use of headleass chrome to mimic user / browser using wechat via web. But ... ipad ? puppets ?

I'm not able to find some background info.

@realtebo
Copy link
Author

realtebo commented Jul 1, 2018

Compilation with actual master (#8e3a04a) works well.

Npm install warn about some c or c++ code not so safe because of a unsafe cast, but it's only a warning and it is related to a third party module (nosql-leveldb).

D:\wechaty-getting-started\wechaty-getting-started\node_modules\nosql-leveldb\deps\leveldb\leveldb-1.20\db/skiplist.h(360): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size (compiling source file leveldb-1.20\db\memtable.cc) [D:\wechaty-getting-started\wechaty-getting-started\node_modules\nosql-leveldb\deps\leveldb\leveldb.vcxproj]
  D:\wechaty-getting-started\wechaty-getting-started\node_modules\nosql-leveldb\deps\leveldb\leveldb-1.20\db/skiplist.h(337): note: while compiling class template member function 'void leveldb::SkipList<const char *,leveldb::MemTable::KeyComparator>::Insert(const Key &)'
          with
          [
              Key=const char *
          ] (compiling source file leveldb-1.20\db\memtable.cc)
  leveldb-1.20\db\memtable.cc(105): note: see reference to function template instantiation 'void leveldb::SkipList<const char *,leveldb::MemTable::KeyComparator>::Insert(const Key &)' being compiled
          with
          [
              Key=const char *
          ]

Dependencies check now tell me this; it's to fix, but it's not a stopping problem.

Chromium downloaded to D:\wechaty-getting-started\wechaty-getting-started\node_modules\puppeteer\.local-chromium\win64-564778
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN wechaty-puppet-puppeteer@0.2.10 requires a peer of wechaty-puppet@0.2.10 but none is installed. You must install peer dependencies yourself.
npm WARN wechaty-puppet-wechat4u@0.2.14 requires a peer of wechaty-puppet@0.2.3 but none is installed. You must install peer dependencies yourself.

Running, we discover anothere missing dep. I report just for your convenience:

$ node examples/simplest-bot/bot.js
Error: Cannot find module 'wechaty-puppet-mock'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (D:\wechaty-getting-started\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-config.js:3:31)

@realtebo
Copy link
Author

realtebo commented Jul 1, 2018

Tried to fill the dependency gap

$ npm install wechaty-puppet-mock@latest wechaty-puppet@latest --save

I see now the 'cannot login' case is handled in a better way, Great !
But it's still creating some PromiseRejectionWarning

23:53:44 WARN PuppetPuppeteerBridge testBlockedMessage() error.ret=1203
23:53:44 INFO PuppetPuppeteerBridge

        Please see: Account Login Issue <https://github.com/Chatie/wechaty/issues/872>


23:53:44 ERR PuppetPuppeteerBridge init() initPage() onLoad() exception: Error: Per salvaguardare la sicurezza del tuo account, l'accesso a WeChat via Web è stato sospeso. Puoi accedere a We
Chat per Windows o a WeChat per Mac su un computer. Scarica WeChat per Windows o Mac all'indirizzo http://wechat.com.
23:54:11 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:[object Object], timeout:60000
(node:8108) UnhandledPromiseRejectionWarning: Error: Error: Per salvaguardare la sicurezza del tuo account, l'accesso a WeChat via Web è stato sospeso. Puoi accedere a WeChat per Windows o a
 WeChat per Mac su un computer. Scarica WeChat per Windows o Mac all'indirizzo http://wechat.com.
    at PuppetPuppeteer.puppet.on.error (D:\wechaty-getting-started\wechaty-getting-started\node_modules\wechaty\dist\src\wechaty.js:402:44)

@huan
Copy link
Member

huan commented Jul 2, 2018

Thank you for your patience too. Please understand that Wechaty is an opensource project with an insufficient resource, so your feedback and help will be very important for us.

  1. what "Padchat Puppet" means.
    1. "puppet system is related to wechat?" NO. Puppet system is neither related to wechat nor associated with Wechaty. In wechaty, the Puppet we talk about is different to the puppet that you used before.
    2. the term Puppet in Wechaty is a name that we had picked up to describe part of our system: Puppet is an Abstract Class for implementing plugins, the plugins are the component that helps Wechaty to control the Wechat, that's the reason we call it puppet.
    3. the plugins are named XXXPuppet, like PuppetPuppeteer is using the chrome puppeteer to control the WeChat Web API via a chrome browser, PuppetPadchat is using the WebSocket protocol to connect with a Protocol Server for controlling an iPad program.
    4. For a deeper understanding of the Puppet in Wechaty, you can read its source code if you like at https://github.com/Chatie/wechaty-puppet/blob/master/src/puppet.ts
  2. the dependency gap - Sorry about that. As I mentioned before, we are splitting the source code of Wechaty into many single npm modules those days, bugs were produced every day, including this one: I had forgotten to add them to the dependencies. It had been fixed in the latest code from the master branch.
  3. creating some PromiseRejectionWarning - You need to register an error handler for Wechaty to prevent that, like: bot.on('error', errorHandler). Like a stream, Wechaty will throw an unhandled error when you have no error handler(fair enough right?). However, there do have many cases that Wechaty has many inner PromiseRejection, if you meet them and know how to reproduce, please file an issue.

@huan huan self-assigned this Jul 2, 2018
@huan huan added the question label Jul 2, 2018
@huan huan changed the title Remove from doc old starter project Questions from the getting startted project Jul 2, 2018
@huan
Copy link
Member

huan commented Jul 11, 2018

@realtebo Hello, do you have more questions about this issue, or could we close this issue for now?

@realtebo
Copy link
Author

No more questions, thanks.

@huan
Copy link
Member

huan commented Jul 11, 2018

You are welcome and thank you very much for all your feedback and suggestions!

@huan huan closed this as completed Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants