add macpro example

This commit is contained in:
lijiarui
2019-09-19 22:00:19 +08:00
parent 32f488dbac
commit c867acabfe
3 changed files with 67 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
## Simple example for `wechaty-puppet-padpro`
#### Steps to run
* Change the token inside the `index.js` file.
* Run `npm install` in this folder.
* Run `npm start`.
* Then scan the qrcode in the terminal, and then press login button in your wechat
+27
View File
@@ -0,0 +1,27 @@
const { Wechaty } = require('wechaty')
const { PuppetMacpro } = require('wechaty-puppet-macpro')
const qrTerm = require('qrcode-terminal')
// Please change the token below to the one that you are given.
const WECHATY_PUPPET_MACPRO_TOKEN = 'puppet_macpro_7a4814925237a17f'
const puppet = new PuppetMacpro({
token: WECHATY_PUPPET_MACPRO_TOKEN,
})
const bot = new Wechaty({
puppet,
})
// 运行 wechaty
bot
.on('scan', (qrcode, status) => {
qrTerm.generate(qrcode, {small: true})
})
.on('login', user => {
console.log(`User ${user} login.`)
})
.on('message', message => {
console.log(`Message: ${message}`)
})
.start()
+32
View File
@@ -0,0 +1,32 @@
{
"name": "wechaty-getting-started",
"version": "0.1.0",
"description": "Wechaty is a Wechat Bot SDK for Personal Account in Node.js",
"main": "index.js",
"engines": {
"node": ">= 10"
},
"scripts": {
"postinstall": "check-node-version --node \">= 10\"",
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Chatie/wechaty-getting-started.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Chatie/wechaty-getting-started/issues"
},
"homepage": "https://github.com/Chatie/wechaty-getting-started#readme",
"dependencies": {
"qrcode-terminal": "^0.12.0",
"wechaty": "^0.28.1",
"wechaty-puppet-macpro": "^0.1.2"
},
"devDependencies": {
"check-node-version": "^3.2.0"
}
}