Skip to content
Huan (李卓桓) edited this page Feb 25, 2020 · 2 revisions

中文版

1. Cannot login

1.1 I can not login with my Wechat account

Wechat account that registered after 2017 will not be able to login via Web API. Learn more at https://github.com/Chatie/wechaty/issues/872

Solution: Wechaty support protocols other than Web API, such as pad. Learn more at https://github.com/Chatie/wechaty/issues/1296

2. What wechaty cannot do on wechat

2.1 Does wechaty support Red envelope, transfer money, moment?

Short answer: NO

Long answer:

  • Payment: we won't support this because this related to property security
  • @ someone in the room: we will support this in the future in solutions other than Web API.
  • Send Contact Card: we support this in ipad solution.
  • Send Share Card: we will support this in the future in solutions other than Web API.
  • Send Voice: we will support this in the future in solutions other than Web API.
  • Moment: we haven't decide yet whether to support this function

2.2 Can wechaty send url rich media message?

Not yet at this moment, will support later

Related Issue:

2.3 I don't know wechaty support for personal account of wechat official account

At this moment, wechaty only support personal account

Related Issue:

3. Technique

3.1 What is a Puppet in Wechaty

The term Puppet in Wechaty is an Abstract Class for implementing protocol plugins. The plugins are the component that helps Wechaty to control the Wechat(that's the reason we call it puppet).

The plugins are named XXXPuppet, like PuppetPuppeteer is using the chrome puppeteer to control the WeChat Web API via a chrome browser, PuppetPadchat is using the WebSocket protocol to connect with a Protocol Server for controlling the iPad Wechat program.

3.2 Wechaty & Queue

In order not blocked by wechat, we add queue in wechaty, see more: rx-queue

3.3 What's the difference between wechaty and wechat4u?

Wechaty can implement many wechat protocol plughins. The plugins are the component that helps Wechaty to control the Wechat. Wechaty provide same API in web, ipad, ios solutions. wechat4u is SPACELAN write as a web solution on github. Wechaty can use wechaty API call wechat 4u API

Is this right: wechaty has All api in wechat4u, but wechat 4u don't have all api wechaty has.

No, wechaty use wechaty itself API for wechat4u. They are totally 2 different project and no one contains another.

3.4 I found there is a default.memory-card.json in the root directory, what does this do?

The default.memory-card.json stores the bot's login information, which can be used to save bot's personal information, so the bot can auto login to Wechat after the first time.

3.5 If the default.memory-card.json stores my bot's personal information, what if I want to start multiple bots? Are they gonna share the same file?

If you want to fire up multiple bots on one machine, you can setup the name for the memory-card, so you will have multiple memory-card.json files, To setup the name, you need to setup the profile for your bot, you have two options to do this:

1. Set the profile with option of the constructor, like this
const bot = Wechaty.instance({ profile: 'your-cute-bot-name' })
2. Set the environment variable for WECHATY_PROFILE during the start
WECHATY_PROFILE="your-cute-bot-name" node bot.js

Then you will see a file called your-cute-bot-name.memory-card.json file in the root folder.

3.6 Why wechaty.on(event, listener) return Wechaty

This is for chaining.

Method chaining, also known as named parameter idiom, is a common syntax for invoking multiple method calls in object-oriented programming languages. Each method returns an object, allowing the calls to be chained together in a single statement without requiring variables to store the intermediate results. More info in wiki

Wechaty class support method chaining, you could write code like this:

const { Wechaty } = require('wechaty')
const bot = new Wechaty()
.on('scan', (qrcode, status) =>  {})
.on('login', user => {})
.on('message', message => {})
.start()