diff --git a/examples/third-party/puppet-macpro/README.md b/examples/third-party/puppet-macpro/README.md new file mode 100644 index 0000000..83bb0c7 --- /dev/null +++ b/examples/third-party/puppet-macpro/README.md @@ -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 diff --git a/examples/third-party/puppet-macpro/index.js b/examples/third-party/puppet-macpro/index.js new file mode 100644 index 0000000..73c7351 --- /dev/null +++ b/examples/third-party/puppet-macpro/index.js @@ -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() diff --git a/examples/third-party/puppet-macpro/package.json b/examples/third-party/puppet-macpro/package.json new file mode 100644 index 0000000..a68a304 --- /dev/null +++ b/examples/third-party/puppet-macpro/package.json @@ -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" + } +}