前言
过年的时候加入了泰稳大大主持的精进学堂 读书运动群,并主动请缨进入了策划组,因为要实行积分制,所以作为coder的我提出做一个群机器人,于是便有了这个项目,我也是近一阵才开始分析网页版微信的各种参数,所以还不太健全,欢迎pr
安装
npm install weixinbot --save
实例
// Require Nodejs v4+
// index.js
const Weixinbot = require('weixinbot')
// will send qrcode to your email address
const bot = new Weixinbot({ receiver: '[email protected]' })
// will emit when bot fetch a new qrcodeUrl
bot.on('qrcode', (qrcodeUrl) => {
console.log(qrcodeUrl)
})
bot.on('friend', (msg) => {
console.log(msg.Member.NickName + ': ' + msg.Content)
bot.sendText(msg.FromUserName, 'Got it')
})
bot.run()
运行
# 建议打开DEBUG标志,以便查看详细信息
DEBUG=weixinbot node index.js