Coder Social home page Coder Social logo

wechat-bot's Introduction

__    __       _        _           ___         _
/ / /\ \ \ ___ (_)__  __(_) _ __    / __\  ___  | |_
\ \/  \/ // _ \| |\ \/ /| || '_ \  /__\// / _ \ | __|
 \  /\  /|  __/| | >  < | || | | |/ \/  \| (_) || |_
  \/  \/  \___||_|/_/\_\|_||_| |_|\_____/ \___/  \__|

Deprecated

NPM version

Install

npm install weixinbot --save

Usage

// Require Nodejs v8+

// 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()

Run

# We recommend show debug message under development
DEBUG=weixinbot node index.js

Feature

Remember previous login secret, when secret is valid, we can direct login without scan qrcode

API Doc

License

The MIT license.

wechat-bot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wechat-bot's Issues

不能正确读取.cookie.json 的数据

登录之后的cookie,能够正确解释并保存到cookie.json,但重新从文件读取就只能读到一对key value,我定位到是node-axios-cookiejar 里面,调用的request-interceptor-wrapper 有问题,request-interceptor-wrapper 里面的一句 const cookieString = local.jar.getCookieStringSync(config.url);
cookieString 根据url 返回的cookie 就只剩下一对key value

添加API吧

API还是建设中,添加一个呗,哈哈

webwxnewloginpage返回webwxnewloginpage

1203 check ticket failed

今天凌晨,机器人突然掉线,一直尝试重新登录,然后扫码登陆的时候在fetchTickets()函数里面,一直返回check ticket failed,要么就是请求的时候404。 但是我用微信自己的客户端,是可以登录的

每次都在这里溢出

c0206dd9-cb17-4eb7-a713-239cf7618d59

为什么每次在获取通讯录列表成功后,进入消息同步的时候程序就溢出?提示是NEDB里面的executor.js第40行报错

README 里面的 `Usage` 会导致循给自己发消息

代码写的很好,很有启发性。我有两个建议。

  • Usage 会有重复一直给自己发消息的逻辑。 你是不是应该加上一个登陆成功的事件,然后在登入成功之后给自己发一条消息。
  • 代码当中包含了你邮箱的 auth 是不是应该为了安全考虑去掉去。

如果互相没有加好友,就收不到内容

我的账号开了不需要验证就能加我好友功能。

然后对方给我发消息,在weixinbot.js的第1377行, 打印出来的_context17的内容是:

Context {
  tryEntries: [ { tryLoc: 'root', completion: [Object] } ],
  prev: 0,
  next: 0,
  _sent: undefined,
  sent: undefined,
  done: false,
  delegate: null }
Context {
  tryEntries: [ { tryLoc: 'root', completion: [Object] } ],
  prev: 0,
  next: 12,
  _sent: undefined,
  sent: undefined,
  done: false,
  delegate: null }
Context {
  tryEntries: [ { tryLoc: 'root', completion: [Object] } ],
  prev: 12,
  next: 14,
  _sent: null,
  sent: null,
  done: false,
  delegate: null }
Context {
  tryEntries: [ { tryLoc: 'root', completion: [Object] } ],
  prev: 14,
  next: 'end',
  _sent: null,
  sent: null,
  done: false,
  delegate: null }

登录失败,Get skey failed, restart login,网页版没问题

不知道项目是否还在维护,今天有个问题导致无法登陆了,应该是微信屏蔽了

Thu, 22 Jun 2017 03:21:22 GMT weixinbot 二维码已被扫描,请确认登录!
Thu, 22 Jun 2017 03:21:22 GMT weixinbot 二维码已被扫描,请确认登录!
Thu, 22 Jun 2017 03:21:22 GMT weixinbot 二维码已被扫描,请确认登录!
Thu, 22 Jun 2017 03:21:23 GMT weixinbot 已点击确认登录!
Thu, 22 Jun 2017 03:21:23 GMT weixinbot 正在获取凭据...
Thu, 22 Jun 2017 03:21:23 GMT weixinbot 鉴权失败,正在重新登录... Error: Get skey failed, restart login
at WeixinBot._callee6$ (/opt/MessageBot/node_modules/._weixinbot@0.6.1@weixinbot/lib/weixinbot.js:675:23)
at tryCatch (/opt/MessageBot/node_modules/._regenerator-runtime@0.10.5@regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/opt/MessageBot/node_modules/._regenerator-runtime@0.10.5@regenerator-runtime/runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/opt/MessageBot/node_modules/._regenerator-runtime@0.10.5@regenerator-runtime/runtime.js:117:21)
at step (/opt/MessageBot/node_modules/._babel-runtime@6.23.0@babel-runtime/helpers/asyncToGenerator.js:17:30)
at /opt/MessageBot/node_modules/._babel-runtime@6.23.0@babel-runtime/helpers/asyncToGenerator.js:28:13
at process._tickCallback (internal/process/next_tick.js:109:7)
Thu, 22 Jun 2017 03:21:23 GMT weixinbot 开始登录...
Thu, 22 Jun 2017 03:21:23 GMT weixinbot 获得 uuid -> Qa0dRIxuRg==
https://login.weixin.qq.com/qrcode/Qa0dRIxuRg==
Thu, 22 Jun 2017 03:21:23 GMT weixinbot 发送二维码图片到邮箱 xxx
Thu, 22 Jun 2017 03:21:48 GMT weixinbot 检查登录超时,正在重试...

日志二

weixinbot 二维码已被扫描,请确认登录! +50ms
weixinbot 二维码已被扫描,请确认登录! +55ms
weixinbot 二维码已被扫描,请确认登录! +40ms
weixinbot 二维码已被扫描,请确认登录! +50ms
weixinbot 已点击确认登录! +60ms
weixinbot 正在获取凭据... +0ms
weixinbot
weixinbot 获得 skey -> @crypt_80d6c3a6_a2fcf8ccf3f7e96760cd0a00f6764aef2
weixinbot 获得 sid -> HFMFnhGrfAYhRfKQe
weixinbot 获得 uid -> 583576777
weixinbot 获得 pass_ticket -> WWy1rGORbOAbvazmJR0DuGIQ6FCoiHEHGg2N1raFu77
cZIaXIawodZbSJtiqnHk0d
weixinbot +313ms
weixinbot 获取凭据成功! +10ms
weixinbot 开始循环拉取新消息 +0ms
weixinbot 正在初始化参数... +0ms
weixinbot 登录信息已失效,正在重新获取二维码...yyyyy +50ms
weixinbot 开始登录... +0ms
weixinbot 获得 uuid -> QaAtXo7CTA== +70ms
https://login.weixin.qq.com/qrcode/QaAtXo7CTA==

运行node index.js,报错

Error: Cannot find module 'babel-runtime/core-js/get-iterator'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (D:\wx-bot\node_modules\weixinbot\lib\weixinbot.js:3:21)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.