-
Notifications
You must be signed in to change notification settings - Fork 4
/
demo.js
29 lines (25 loc) · 830 Bytes
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { Wechaty } = require('wechaty');
const { PuppetPadplus } = require ('wechaty-puppet-padplus');
let iniParser = require('iniparser');
let config = iniParser.parseSync('resource/config.ini');
const token = config['SECRET']['token'];
const puppet = new PuppetPadplus({
token,
});
const name = 'bot-data-for-hash';
const bot = new Wechaty({
puppet,
name, // generate xxxx.memory-card.json and save login data for the next login
});
// process.env.BROLOG_LEVEL = 'silly';
bot
.on('login', `./listener/on-login`)
.on('scan', `./listener/on-scan`)
.on('message', `./listener/on-message`)
.on('logout', `./listener/on-logout`)
.start()
.then(v => {
// console.log(v);
})
.catch(e => console.error('捕捉error\r\n' + e));
module.exports = bot;