wechaty / getting-started Goto Github PK
View Code? Open in Web Editor NEWA Starter Project Template for Wechaty works out-of-the-box
Home Page: https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
License: Apache License 2.0
A Starter Project Template for Wechaty works out-of-the-box
Home Page: https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
License: Apache License 2.0
Currently, the dependence of this example is still "wechaty": "^0.13.0"
, which is outdated.
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
To let someone not used node before could easy to get started.
I'm trying to hot-import config:
const { hotImport } = require('hot-import')
async function onMessage (message) {
const cfg = await hotImport('./config')
console.log(`Received message: ${message} from ${cfg.db.host}`)
}
It works for the first received message. However on receiving the 2nd message, the program errored out with:
(node:80803) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'db' of undefined
at Wechaty.onMessage (/path/to/wx/hot-import-bot/on-message.js:25:56)
(node:80803) 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)
How can I make it works please?
When tried to “node examples\professional\api-ai-bot.ts”, got below error. Is it possible wechaty provide js file for api.ai or dialogflow please? Thanks.
wechaty-getting-started-master\examples\professional\api-ai-bot.ts:31
import { Brolog as log } from 'brolog'
^
SyntaxError: Unexpected token {
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
after we have a package.json, then we can run npm install
to install npm wechaty, which will be required by node mybot.js
Can we install with an mirror url?
MacBook-Pro:wechaty-getting-started wang$ npm install
(node:57492) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
> [email protected] install /Users/wang/IdeaProjects/wechaty-getting-started/node_modules/chromedriver
> node install.js
Downloading https://chromedriver.storage.googleapis.com/2.29/chromedriver_mac64.zip
Saving to /var/folders/_l/b4wgtxhd7f95181gp7ks91100000gn/T/chromedriver/chromedriver_mac64.zip
npm ERR! Darwin 17.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the chromedriver package,
npm ERR! not with npm itself.
运行刚开始正常收发信息,一会后就报这条信息,之后就不能正常使用。
MacOS node js
should descript:
node mybot.js
by npm install
docker
add mybot.js
which can be run by node mybot.js
你好,官方给出的文档翻了好几遍也没找到更加详细的api介绍,很多方法都没有放在文档上的样子。
不知是否有更加详细的文档?
Following from wechaty/wechaty#1440,
I ran and saw the qrcode in terminal previously, then stopped and thought AOK. But,
Today, when I try it out with qrcode scan and login,
I found so many error logged onto the terminal, is that normal?
Moreover, less than 1 minute after logging in, I see a warning:
WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:[object Object], timeout:60000
And after that, no more messages were able to be processed. I.e., it was able to print the following,
Message#Text(👥Room<rm1>🗣Contact<me>)<hello>
but after the above warning, such Message#Text
printing will no longer be there, no matter how many test messages I sent afterwards.
I'm still unable to make the new v0.17 wechaty fully working for me. See above.
$ node -v
v10.5.0
$ npm -v
6.1.0
$ node examples/starter-bot.js
. . . See "Show Logs" for details . . .
$ apt-cache policy nodejs
nodejs:
Installed: 10.5.0-1nodesource1
Candidate: 10.5.0-1nodesource1
Version table:
*** 10.5.0-1nodesource1 500
500 https://deb.nodesource.com/node_10.x bionic/main amd64 Packages
100 /var/lib/dpkg/status
8.10.0~dfsg-2 500
500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
# PASTE FULL LOG OUTPUT AT HERE:
$ $ node examples/starter-bot.js
22:41:23 INFO Wechaty start() v0.17.75 is starting...
22:41:23 INFO Wechaty initPuppet() using puppet: puppeteer
... qrcode scan ...
https://api.qrserver.com/v1/create-qr-code/?data=https%3A%2F%2Flogin.weixin.qq.com%2Fl%2FQedfpTkz_g%3D%3D&size=220x220&margin=20
Contact<me> login
22:41:57 ERR PuppetPuppeteerEvent onLogin() exception: Error: must logout first before login again!
(node:29598) UnhandledPromiseRejectionWarning: Error: must logout first before login again!
at PuppetPuppeteer.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:183:23)
at Generator.next (<anonymous>)
at /path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:25:71
at new Promise (<anonymous>)
at __awaiter (/path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:21:12)
at PuppetPuppeteer.login (/path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:180:16)
at PuppetPuppeteer.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:396:36)
at Generator.next (<anonymous>)
at /path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:25:71
at new Promise (<anonymous>)
at __awaiter (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:21:12)
at PuppetPuppeteer.login (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:395:16)
at PuppetPuppeteer.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/event.js:111:24)
at Generator.next (<anonymous>)
at fulfilled (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/event.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:29598) 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: 2)
(node:29598) [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.
Message#Text(👥Room<rm1>🗣Contact<me>)<hello>
Message#Text(👥Room<rm1>🗣Contact<me>)<hello>
22:42:49 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:[object Object], timeout:60000
22:44:56 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:47:04 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:49:11 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:51:19 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:53:26 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
^C
As the document recommended, I purchased a server on Digital Ocean to run this demo. I chose an Ubuntu 16.04.4 LTS image and updated the Node.js version on it; However, something wrong still occurred. I attach the output from my command line here in case someone needs to look it up.
Terminal Saved Output.txt
Since install the package seems difficult for newcomers, even for some developers who had developed for a long time. So we decide to add some image for wechaty.
Include folloiwng puppet:
Server:
node version - 10.6.0
platform - win10
I follow the instructions to get start.
when I "npm config set registry https://github.com/Chatie/wechaty/wiki/NPM#use-npm-in-china" and run 'npm install' . I got a lot of errors.I put those errors at the end of this issues.
so I do 'npm config set registry https://registry.npm.taobao.org' and run 'npm install' ,everything gose right
I do not know why, someone help me ?
Below is the error detail
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 63d543a1f2b947a9
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall [email protected]
7 info lifecycle [email protected]~preinstall: [email protected]
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 16ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 4ms
16 silly install loadAllDepsIntoIdealTree
17 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/qrcode-terminal 3791ms
18 silly fetchPackageMetaData error for qrcode-terminal@^0.12.0 Unexpected token < in JSON at position 6 while parsing near '
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData <htm...'
19 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/wechaty 3943ms
20 silly fetchPackageMetaData error for wechaty@^0.19.1 Unexpected token < in JSON at position 6 while parsing near '
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData <htm...'
21 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/qrcode-terminal 2023ms
22 silly fetchPackageMetaData error for qrcode-terminal@^0.12.0 Unexpected token < in JSON at position 6 while parsing near '
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData <htm...'
23 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/wechaty 2728ms
24 silly fetchPackageMetaData error for wechaty@^0.19.1 Unexpected token < in JSON at position 6 while parsing near '
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData <htm...'
25 timing stage:rollbackFailedOptional Completed in 0ms
26 timing stage:runTopLevelLifecycles Completed in 7238ms
27 silly saveTree [email protected]
28 verbose stack SyntaxError: Unexpected token < in JSON at position 6 while parsing near '
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack <htm...'
28 verbose stack at JSON.parse ()
28 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
28 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
28 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
29 verbose cwd C:\work\develop\node\wechaty-getting-started
30 verbose Windows_NT 10.0.17134
31 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
32 verbose node v10.6.0
33 verbose npm v6.1.0
34 error Unexpected token < in JSON at position 6 while parsing near '
34 error
34 error
34 error
34 error
34 error
34 error
34 error <htm...'
35 verbose exit [ 1, true ]
Branch | Build failing 🚨 |
---|---|
Dependency | wechaty |
Current Version | 0.22.1 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
wechaty is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hello,
I'm setting up this bot to extract content (image and video) from wechat. This content is only sent by myself (no other contact).
I have set up wechaty with my own wechat account, so basically I'm talking to myself.
So far it's working: I can send media to myself (on my phone) and wechaty bot will capture and save them on my server.
However, when I want the bot to reply a message, it does not appear on the phone, but I can see the reply in the console.
see the console extract below:
RECV: Message#Image(🗣Contact<Cyril>👤Contact<Cyril>)
Save file to: /media/3139708290439575100.jpg
RECV: Message#Text(🗣Contact<Cyril>👤Contact<Cyril>)<Thank you>
I cannot see the reply "Thank you" on my phone
How should i proceed ?
Thank you
I was able to resume login without scanning the qrcode again during my previous testings, even without specifying a profile, which "will generate a file called wechatyName.memory-card.json. This file stores the bot’s login information. If the file is valid, the bot can auto login so you don’t need to scan the qrcode to login again. " according to the API Doc.
but now it seems not working anymore -- I always have to scan the qrcode to login again.
Tried with the default starter-bot.js
and the hot-import-bot.js
(https://github.com/wechaty/wechaty-getting-started/tree/master/examples/professional/hot-import-bot), and both are the same.
Hope the two files can be corrected to show how the automatic re-login can be done.
Thx.
这个文件流是恐的,保存下来的都是0KB的文件,我是mac 安卓oppo手机,问题出在哪呢?
And update the Blog with the new Youtube link.
I run the starter-bot.js, and onMessage as below. However, when I receive a message, "hello" can be send successfully everytime, but the image can not send. I do not understand why
async function onMessage (msg) {
console.log(msg.toString())
if (!msg.self()){
await msg.say('hello')
const fileBox = FileBox.fromFile('./img/tuzi.png')
await msg.say(fileBox)
}
}
Because there are many Win32 users start using this starter.
See: #33
I encountered issue on sending url link to user, here are my code and error log:
/local wechaty version: [email protected]/
async function onMessage(msg) {
......
const LinkPayload = {
description: '评级:'+body.a.others[0].distance.toString()+',来源:'+body.a.others[0].source,
thumbnailUrl: 'http://www.haola.com/images/haola.png',
title : body.a.others[0].title,
url : body.a.others[0].url
}
msg.say(LinkPayload)
----------------------------------------------------------
report error:
(node:32318) UnhandledPromiseRejectionWarning: Error: unknown msg: [object Object]
at AnotherOriginalClass.<anonymous> (/root/node_modules/wechaty/dist/src/user/message.js:392:23)
at Generator.next (<anonymous>)
at /root/node_modules/wechaty/dist/src/user/message.js:7:71
at new Promise (<anonymous>)
at __awaiter (/root/node_modules/wechaty/dist/src/user/message.js:3:12)
at AnotherOriginalClass.say (/root/node_modules/wechaty/dist/src/user/message.js:348:16)
at Request._callback (/root/tuling.js:117:11)
at Request.self.callback (/root/node_modules/request/request.js:185:22)
at Request.emit (events.js:182:13)
at Request.EventEmitter.emit (domain.js:442:20)
at Request.<anonymous> (/root/node_modules/request/request.js:1161:10)
at Request.emit (events.js:182:13)
at Request.EventEmitter.emit (domain.js:442:20)
at IncomingMessage.<anonymous> (/root/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:273:13)
at IncomingMessage.emit (events.js:187:15)
at IncomingMessage.EventEmitter.emit (domain.js:442:20)
at endReadableNT (_stream_readable.js:1085:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:32318) 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:32318) [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.
Could you help me to check and give some guidance on how to fix this issue? Thanks in advance.
Thanks in advance,
Jackie
I'm trying for the first time this project. Great idea and great work !
I cloned, installed npm packages, and simply run it
I got
$ node mybot.js
14:44:07 WARN Wechaty init() DEPRECATED and will be removed after Jun 2018. Use start() instead.
14:44:07 INFO Wechaty v0.13.93 starting...
(node:8072) UnhandledPromiseRejectionWarning: TypeError: rxjs.interval is not a function
at ThrottleSubscriber.durationSelector (D:\wechaty-getting-started\node_modules\rx-queue\bundles\rx-queue.umd.js:181:99)
at ThrottleSubscriber.tryDurationSelector (D:\wechaty-getting-started\node_modules\rxjs\operators\throttle.js:107:25)
at ThrottleSubscriber._next (D:\wechaty-getting-started\node_modules\rxjs\operators\throttle.js:92:33)
at ThrottleSubscriber.Subscriber.next (D:\wechaty-getting-started\node_modules\rxjs\Subscriber.js:93:18)
at Subject.next (D:\wechaty-getting-started\node_modules\rxjs\Subject.js:55:25)
at ThrottleQueue.next (D:\wechaty-getting-started\node_modules\rx-queue\bundles\rx-queue.umd.js:185:26)
at PuppetWeb.on.data (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\puppet-web.js:74:60)
at PuppetWeb.emit (events.js:187:15)
at PuppetWeb.EventEmitter.emit (domain.js:442:20)
at PuppetWeb.emit (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet.js:34:22)
at Watchdog.dog.on.food (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\puppet-web.js:102:20)
at Watchdog.emit (events.js:182:13)
at Watchdog.EventEmitter.emit (domain.js:442:20)
at Watchdog.feed (D:\wechaty-getting-started\node_modules\watchdog\bundles\watchdog.umd.js:188:18)
at PuppetWeb.puppet.on.food (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\puppet-web.js:98:43)
at PuppetWeb.emit (events.js:182:13)
at PuppetWeb.EventEmitter.emit (domain.js:442:20)
at PuppetWeb.emit (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet.js:34:22)
at PuppetWeb.<anonymous> (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\event.js:53:14)
at Generator.next (<anonymous>)
at fulfilled (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\event.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:8072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside o
f an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections tha
t are not handled will terminate the Node.js process with a non-zero exit code.
Hi,
I clone Chatie/wechaty-getting-started
and Chatie/wechaty
, run the media-file-bot example with two projects, but when I send a pdf file to the robot,file save not be trigger msg.type() !== bot.Message.Type.Text
will be return false, only return something like this RECV: Message#Text(🗣Contact<张硕>👤Contact<WonderCV小助手>)<<msg><appmsg appid="" sdkver="0"><title>xxx.pdf</>
.
I also clone lijiarui/wechaty-puppet-padchat
add the code to examples/wechaty-padchat-bot
onMessage function
if (msg.type() !== Message.Type.Text) {
const file = await msg.toFileBox()
const name = file.name
console.log('Save file to: ' + name)
file.toFile(name)
}
I try again that console throw unsupport type: StatusNotify(51) because it is not fully implemented yet
Does this mean that the feature is not yet supported? , or is there a problem with the version I am running? Three projects are cloned master branch.
I look forward to your answer. thank you .
PS F:\ayzb\we\wechaty-getting-started> npm start
[email protected] start F:\ayzb\we\wechaty-getting-started
node examples/starter-bot.js
14:30:19 INFO Wechaty <wechaty_puppet> start() v0.22.6 is starting...
14:30:19 INFO PuppetManager install(wechaty_puppet@latest) please wait ...
npm: npm
npm: ERR! code E404
npm ERR! 404
npm: Not Found: wechaty_puppet@latest
npm:
npm: npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log
{ Error: Command failed: npm install wechaty_puppet@latest
npm ERR! code E404
npm ERR! 404 Not Found: wechaty_puppet@latest
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log
at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:441:20)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty_puppet@latest ' }
14:30:24 ERR Wechaty start() exception: Command failed: npm install wechaty_puppet@latest
npm ERR! code E404
npm ERR! 404 Not Found: wechaty_puppet@latest
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log
{ Error: Command failed: npm install wechaty_puppet@latest
npm ERR! code E404
npm ERR! 404 Not Found: wechaty_puppet@latest
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log
at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:441:20)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty_puppet@latest ' }
PS F:\ayzb\we\wechaty-getting-started>
const ip = require('child_process')
.spawnSync('curl', ['ifconfig.io'])
.stdout
.toString()
.trim()
console.log(ip)
I clone the "wechaty-getting-started", and modify the init code of Wechaty in "examples/starter-bot.js". Then in the console, I run "npm install" and "npm start". However, after I scan the qrcode, I got nothing in the console. After a while, I got status -106. And I found issue #176, and it mentions "puppet-padchat-patch" can solve the -106 issue. "puppet-padchat-patch" can show me a new qrcode, but I cannot login after I scan the new qrcode.
My codes as below.
const { Wechaty } = require('wechaty')
const { PadchatPatch } = require('puppet-padchat-patch')
const TOKEN = 'myToken'; // the token I applied
const initialName = 'test';
const puppet = 'wechaty-puppet-padchat'
const puppetOptions = {
token: TOKEN
}
const bot = new Wechaty({
initialName,
puppet,
puppetOptions,
});
bot.on('scan', onScan)
bot.on('login', onLogin)
bot.on('logout', onLogout)
bot.on('message', onMessage)
bot.start()
.then(() => console.log('Starter Bot Started.'))
.catch(e => console.error(e))
function onScan (qrcode, status) {
const qrcodeImageUrl = [
'https://api.qrserver.com/v1/create-qr-code/?data=',
encodeURIComponent(qrcode),
].join('')
console.log(qrcodeImageUrl)
}
function onLogin (user) {
console.log(`${user} login`)
}
function onLogout(user) {
console.log(`${user} logout`)
}
async function onMessage (msg) {
console.log(msg.toString())
}
/**
* Hook the -106 failure status here, try to get auth data from separate server
*/
process.on('unhandledRejection', (error) => {
const { message } = error
if (message && message.indexOf('unknown status: -106') !== -1) {
const wxid = message.split(' ').slice(-1)[0]
const padchatPatch = new PadchatPatch(TOKEN, initialName, wxid)
padchatPatch
.on('scan', (qrcode, status) => {
// You need to let the user scan the qrcode again here
// generate(qrcode, { small: true })
const qrcodeImageUrl = [
'https://api.qrserver.com/v1/create-qr-code/?data=',
encodeURIComponent(qrcode),
].join('')
console.log(`[${status}] ${qrcodeImageUrl}\nScan QR Code above to log in: `)
})
.on('finish', async () => {
// restart your application here
bot.start()
})
.start()
return
}
})
now it's https://github.com/lijiarui/Getting-Started-with-Wechaty---Live-Coding-Tutorial
should be renamed to https://github.com/lijiarui/wechaty-getting-started
later we can move this repository to /wechaty/wechaty-getting-started
$ npm start
[email protected] start D:\Node\wechaty-getting-started
node examples/starter-bot.js
14:52:48 INFO Wechaty start() v0.18.5 is starting...
14:52:48 INFO Wechaty initPuppet() using puppet: default
14:52:48 WARN MemoryCard sub() DEPRECATED, use multiplex() instead
14:52:48 INFO PuppetConfig installPuppet(wechaty-puppet-puppeteer@^0.4.2) please wait ...
npm:
[email protected] install D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
node-gyp rebuild
npm:
D:\Node\wechaty-getting-started\node_modules\wechaty\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
npm: )
npm: gyp
npm: ERR! configure error
npm: gyp ERR! stack
npm: Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
npm: gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack
npm: at FSReqWrap.oncomplete (fs.js:158:21)
npm: gyp ERR! System Windows_NT 10.0.17134
npm: gyp
npm: ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR!
npm: cwd D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR!
npm: node -v v10.7.0
gyp ERR!
npm: node-gyp -v v3.6.2
gyp ERR!
npm: not ok
npm: npm WARN
npm: [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm: npm
npm: WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm
npm: WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm: npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.
npm:
npm: npm ERR! code
npm: ELIFECYCLE
npm: npm ERR! errno 1
npm: npm ERR!
npm: [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm: npm ERR!
npm ERR!
npm: Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm:
npm: npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log
14:52:53 ERR PupptConfig puppetResolver(default) install fail: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log
{ Error: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log
at ChildProcess.exithandler (child_process.js:291:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:442:20)
at maybeClose (internal/child_process.js:961:16)
at Socket.stream.socket.on (internal/child_process.js:380:11)
at Socket.emit (events.js:182:13)
at Socket.EventEmitter.emit (domain.js:442:20)
at Pipe._handle.close (net.js:599:12)
killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty-puppet-puppeteer@^0.4.2 ' }
14:52:53 ERR Wechaty start() exception: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log
{ Error: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log
at ChildProcess.exithandler (child_process.js:291:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:442:20)
at maybeClose (internal/child_process.js:961:16)
at Socket.stream.socket.on (internal/child_process.js:380:11)
at Socket.emit (events.js:182:13)
at Socket.EventEmitter.emit (domain.js:442:20)
at Pipe._handle.close (net.js:599:12)
killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty-puppet-puppeteer@^0.4.2 ' }
@xinbenlv This repository act as the start for the Wechaty for a long time, see: https://blog.chatie.io/getting-started-wechaty/
I suggest that we could refine this repository to make the experiences of new developers smoother by just clone this repo, run npm install
, and npm start
.
使用自己申请的turning API始终报 “请按规定的要求进行加密”,请问下是否要怎么处理他们官网出来的APIkey?
看过turning123的文档,但是没有得到一点信息,他们写的太简单了
Is it a good idea to move the Official Wechaty Examples from https://github.com/Chatie/wechaty/tree/master/examples to here?
Those example, cannot be used out of the box, due to the relative-path importing.
Moving them over here will eliminate one more unnecessary step for new developers/users to try out Wechaty.
At the very least, please move the ding-dong-bot over, and give example in README how to start the ding-dong typescript bot.
And please move hot-import-bot example over as well, as I wasn't even able to make it run -- wechaty/wechaty#1222
Thx
Wechaty changes a lot these days and maybe we should make a clear tutorial, one-page introduction and API doc these days, both support Chinese and English.
Thanks to #19 (comment) pointing that the docs and tutorial make developer feel confusing and all his experience.
I write related todo list on scratch:
This Two part should move to wechaty repo instead of in wechaty-getting started.
I encountered a issue when using the example file of tuling123-bot.js to process onMessage event
No matter what messages had been sent to robot, it reported same error:
02:42:17 ERR Wechaty onFunction(message) listener exception: TypeError: _asyncToGenerator is not a function
TypeError: _asyncToGenerator is not a function
at Wechaty._onMessage (/bot/tuling.js:53:16)
at Wechaty.onMessage (/bot/tuling.js:49:21)
at Wechaty.on.args (/wechaty/src/wechaty.ts:538:18)
at Wechaty.emit (events.js:182:13)
at Wechaty.EventEmitter.emit (domain.js:442:20)
at Wechaty.emit (/wechaty/src/wechaty.ts:304:18)
at Wechaty. (/wechaty/src/wechaty.ts:646:18)
at Generator.next ()
at fulfilled (/wechaty/dist/src/wechaty.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
Who can help me to take a look? Is it related to Babel? Thanks in advance.
The Journal of Open Source Software (JOSS) is an academic journal with a formal peer review process that is designed to improve the quality of the software submitted. Upon acceptance into JOSS, a CrossRef DOI is minted and we list your paper on the JOSS website.
Learn more at http://joss.theoj.org/about
Room.find({topic: "swim"}).then(function(keyroom){
console.log("聯係人:"+who)
console.log(keyroom)
if (keyroom) {
// keyroom.say("welcome!", who)
keyroom.add(who).then(function () {
keyroom.say("welcome!", who)
})
}
})
Actually, I used the code directly here, so it is similar to this code. but it doesn't work on my computer.
it always throw the error: can't find contactId or roomId. But the console shows that the room has been found.
Additionally, I think I didn't use these two parameters at all.
Hope for solution. Thank you.
instead of a raw link, use an HTML img tag to show video player with the link, like https://github.com/wechaty/wechaty
您好,请问一下这个机器人会被锁号吗?
⠹ [43/44] Installing node-expat@^2.3.15
WARN node unsupported "[email protected]" is incompatible with [email protected] › joi@^13.1.2, expected node@>=8.9.0
⠸ [43/44] Installing [email protected]
WARN node unsupported "[email protected]" is incompatible with [email protected] › [email protected] › [email protected], expected node@>=8.9.0
⠼ [43/44] Installing nan@^2.3.5
WARN node unsupported "[email protected]" is incompatible with [email protected] › [email protected] › [email protected], expected node@>=8.0.0
⠸ [43/44] Installing [email protected]: Entering directory `/home/node/node_modules/[email protected]@node-expat/build'
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
⠼ [43/44] Installing [email protected]../deps/libexpat/lib/xmlparse.c: In function ‘gather_time_entropy’:
../deps/libexpat/lib/xmlparse.c:780:7: warning: variable ‘gettimeofday_res’ set but not used [-Wunused-but-set-variable]
int gettimeofday_res;
^
⠦ [43/44] Installing [email protected] CC(target) Release/obj.target/expat/deps/libexpat/lib/xmltok.o
⠧ [43/44] Installing [email protected] CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlrole.o
⠙ [43/44] Installing [email protected] AR(target) Release/obj.target/deps/libexpat/libexpat.a
COPY Release/libexpat.a
CXX(target) Release/obj.target/node_expat/node-expat.o
make: g++: Command not found
make: *** [Release/obj.target/node_expat/node-expat.o] Error 127
make: Leaving directory `/home/node/node_modules/[email protected]@node-expat/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/cnpm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Linux 3.10.0-862.3.3.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/cnpm/node_modules/npminstall/node-gyp-bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/node/node_modules/[email protected]@node-expat
gyp ERR! node -v v6.14.2
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
✖ Install fail! Error: Run "sh -c node-gyp rebuild" error, exit code 1
Error: Run "sh -c node-gyp rebuild" error, exit code 1
at ChildProcess.proc.on.code (/usr/lib/node_modules/cnpm/node_modules/runscript/index.js:74:21)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
I updated my wechaty environment to the latest today but found that WECHATY_PUPPET=mock
is now broken:
Using the latest wechaty-getting-started/examples/starter-bot.js
as the example:
$ node starter-bot.js
18:45:33 INFO Wechaty <default> start() v0.22.4 is starting...
Starter Bot Started.
I.e., AOK. Now run with WECHATY_PUPPET=mock
:
$ WECHATY_PUPPET=mock node starter-bot.js
18:45:53 INFO Wechaty <mock> start() v0.22.4 is starting...
18:45:53 INFO PuppetManager install(mock@latest) please wait ...
npm: + [email protected]
added 1 package from 2 contributors and audited 1 package in 1.153s
npm: found 0 vulnerabilities
18:45:55 INFO PuppetManager install(mock@latest) done
TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received type undefined
at Function.resolve (internal/modules/cjs/helpers.js:28:13)
at new mock (/path/to/node_modules/mock/index.js:15:29)
at Function.<anonymous> (/path/to/node_modules/wechaty/dist/src/puppet-manager.js:58:34)
at Generator.next (<anonymous>)
at fulfilled (/path/to/node_modules/wechaty/dist/src/puppet-manager.js:4:58)
$ npm list --depth=0
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
What's puppet
, list all puppet and give the related linkstarter-bot.ts
, add the basic receive and send message functions in the code.Wechaty installation is not so easy that it tooks me 4 hours to complete this simple task in Windows 10 Home Edition.
First, there're 2 ways to install wechaty, one is npm, the other is docker. Because docker needs at least Windows Proffesional to run in, we only have the first choice if we bought a home-use Windows and are not going to get the Windows Pro at $99.
Secondly, if we choose install it via npm way, some requirements and descriptions missed in the installation docs:
If we complete the 4 steps, wechaty runs!
Then, the QRCode in Windows Cmd Prompt is in a mess, I have to copy it from console to notepad and change the font setting to "Lucida Console", font-size 5, CTRL+A to reverse the color of the QRCode.
Finally, after I scaned it, the ding-dong-bot run, I sent a ding, it replied a dong. That was the story yestorday.
const { Wechaty } = require('wechaty')
function setupBot(id) {
const bot = new Wechaty({ profile: `memory-cards/${id}` })
bot
.on('scan', './on-scan')
.start()
return bot
}
setInterval(async () => {
setupBot(Math.random())
}, 10000)
We are working on launching bot dynamically. However, whenever we are using hot-reload, any bot launched after the first one will fail. This example will work if we are not using hot-reload.
Error:
ERR Wechaty onModulePath(scan, ./on-scan) listener exception: TypeError: Cannot read property 'apply' of undefined
https://blog.wechaty.io/guide/2017/01/01/getting-started-wechaty.html
is broken. Video File no longer Available.
For example, like this one: https://asciinema.org/a/177857
We need a getting started screencast for beginners in README.md.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.