JSPM

  • Created
  • Published
  • Downloads 734
  • Score
    100M100P100Q98506F
  • License MIT

web wechat lib

Package Exports

  • wechat4u

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wechat4u) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#wechat4u.js

##安装使用

npm install wechat4u

##使用Example测试

npm run example

API 说明

  const wechat4u = require('wechat4u')
  
  let wechat = new wechat4u()
  
  wechat.getUUID().then(uuid => {/*处理uuid*/})
  wechat.start() // 完成登陆过程,需手机端通过网页版登陆验证
  
  wechat.sendMsg(msg, to) // 发送文字消息
  wechat.sendImage(to, fileStream, type, size) // 发送图片消息
  // 使用 fs 的 createdReadStream 的样例:
  // let imgPath = __dirname + '/../public/images/nodeWechat.png'
  // let imgStats = fs.statSync(imgPath)
  // wechat.sendImage(user['UserName'], fs.createReadStream(imgPath), imgStats.type, imgStats.size)
  
  wechat.friendList // 好友列表
  wechat.user // 登陆用户
  wechat.memberList // 所有好友
  wechat.contactList // 个人好友
  wechat.groupList // 群
  wechat.publicList // 公众账号
  wechat.specialList // 特殊账号
  
  wechat.on('uuid', () => {})
  wechat.on('scan', () => {})
  wechat.on('confirm', () => {})
  wechat.on('login', () => {})
  wechat.on('logout', () => {})
  wechat.on('error', err => debug(err))
  wechat.on('init-message', () => {})
  wechat.on('text-message', () => {})
  wechat.on('picture-message', () => {})
  wechat.on('voice-message', () => {})
  wechat.on('mobile-open', () => {})
  
  wechat.state === wechat4u.STATE.init === 'init'
  wechat.state === wechat4u.STATE.uuid === 'uuid'
  wechat.state === wechat4u.STATE.login === 'login'
  wechat.state === wechat4u.STATE.logout === 'logout'
  
  wechat.request() // 自带的 request,包含cookie

##相关项目

关于微信网页端机器人的实现,已经有大量的轮子了。感谢各位大神!(排名不分先后。。收录的肯定也不齐。。)

关于微信网页端的接口说明,也有好几篇分析的很厉害的文章。

好了,差不多就这些资料了。如果想要开发个自己的,那就开工吧!