Open source: github.com/isnl/wechat…

Note: Since late June 2017, there is a high probability of restricted login using the web-based wechat access scheme. The main manifestation is that the login of wechat on the Web is not possible, but mobile phones and other platforms are not affected. Check if login is blocked: scan the code at wx.qq.com to see if you can log in. For more information, see:

Can not login with error message: The current login environment is abnormal. For the security of your account, we cannot log in to wechat.

If you can’t log in to the web version, don’t look further. This library uses the web version protocol.

Cloning code

git clone [email protected]:isnl/wechat-robot.git
Copy the code

The directory structure

  • configStore common configurations as wellsuperagentRequest configuration
  • imgsStore related pictures
  • listenersHolds a series of callbacks after robot initialization
    • on-friendship.jsHandling friend Requests
    • on-login.jsHandle the login
    • on-message.jsProcess user messages and group messages
    • on-scan.jsProcessing login QR code
  • schedulenode-scheduleEncapsulated
  • superagentAll data requests and interface encapsulation are stored here
  • utilsEncapsulation of common methods
  • app.jsEntrance to the file

Mainly depends on

  • Wechaty personal wechat account wechat robot SDK
  • Superagent Data request
  • Cheerio NodeJS jQuery for fetching page content
  • Node-schedule A library that sets scheduled tasks in nodejs
  • Qrcode-terminal Prints the TWO-DIMENSIONAL code on the console

Install dependencies

Dependencies need to install Chromium, using NPM will download failure or slow, domestic you know

Using CNPM to install dependencies is highly recommended

cnpm install  //npm install
Copy the code

If you really do not want to use CNPM, you can switch the NPM source to Taobao source

npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
npm config set puppeteer_download_host https://npm.taobao.org/mirrors
Copy the code

Modify theconfigconfiguration

Open the config/index.js file and change the configuration to your own.

Example Modify the configuration of a skyline interface

Tianapi.com/ after successful registration, apply for the following interfaces:

  • A: What’s wrong with you?
  • God replies

After registration, please open superagent/index.js and change the top APIKEY to the key of your own skyline API

Other free interface can be applied for, self-expansion ~

Run the test

cnpm start //npm start
Copy the code

This project is based on github.com/gengchen528… Derived from.

This project has the following functions:

  • Hot update, code modification without restart, easy online debugging.
  • If new pneumonia data of China and provinces are added, you can reply by keyword.
  • Adding a friend automatically agrees the request
  • Add small tools such as capitalization, color RGB and Base64 interchange.
  • Daily toxic chicken soup, god reply, English word, real-time toxic chicken soup.
  • Send a group command to invite friends to join a group.
  • Collect high-commission goods from JINGdong Alliance and send them to the designated group after chain transfer.
  • Obtain baidu cloud files as instructed and share them with users to download links and extract codes.

The underlying apis are all based on wechaty

For more apis related to wechat messages, group messages, friends, and chats, see wechaty official documents

Have problems to raise issues or add robot wechat, send communication group can pull you into the group