Use Telegram Bot to send and receive WeChat text, voice, pictures, videos, Telegram static stickers and other messages
bot token
Before using Linux, you need to install the following dependencies. The new version of wechaty only supports Ubuntu:
CentOS 7
yum install libX11 pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
CentOS 8
dnf install -y libX11-xcb libXtst libXScrnSaver alsa-lib-devel at-spi2-atk gtk3
alsa-lib.x86_64 atk.x86_64 cups-libs.x86_64 gtk3.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXrandr.x86_64 pango.x86_64 xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-fonts-cyrillic xorg-x11-fonts-misc xorg-x11-fonts-Type1 xorg-x11-utils
// http://www.ajisaba.net/javascript/puppeteer/lib_error_centos7.html
Ubuntu
apt-get update &&
apt-get install -yq --no-install-recommends
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6
libnss3 libgbm-dev libxshmfence-dev
libgbm-dev libxshmfence-dev
is a new dependency required in version 2.5.0
$ > git clone https://github.com/UnsignedInt8/leavexchat-bot.git
$ > cd leavexchat-bot
$ > yarn
$ > yarn build
$ > node build/main/index.js # 无需配置文件
$ > 输入 token, Done !
Since Chinese users cannot access Telegram directly, the SOCKS5 proxy needs to be specified in the configuration file config.json
:
Please refer to config-example.json to fill in config.json
.
# 使用配置文件方式
$ > node build/main/index.js -c config.json
** If you encounter problems with the installation, clear node_modules and reinstall all dependencies**
Version 2.0 has added the wechat session recovery function. To take advantage of this feature, you need a process daemon. It is recommended to use forever.
$ > npm i -g forever
$ > git clone https://github.com/UnsignedInt8/leavexchat-bot.git
$ > cd leavexchat-bot
$ > yarn
$ > yarn build
$ > forever build/main/index.js -c config.json
This can greatly reduce the frequency of scanning QR codes to log in.
Order | illustrate | Example |
---|---|---|
/start | Start session | |
/login | Request login | |
/logout | Log out of WeChat | |
/groupon | Enable receiving group messages | |
/groupoff | Turn off receiving group messages | |
/officialon | Enable receiving public account messages | |
/officialoff | Turn off receiving public account messages | |
/selfon | Turn on receiving your own messages | |
/selfoff | Turn off receiving your own messages | |
/find | Find a contact and set as current contact | /findABC |
/lock | Lock current contact | |
/unlock | Unlock current contact | |
/findandlock | Find and lock as current contact | /findandlockABC |
/current | Show current contacts | |
/agree | Agree to friend request | /agree [reqid] |
/disagree | Ignore friend request | /disagree [reqid] |
/forwardto | Forward message to contact | /forwardto [contact] |
/mute | Mute designated group | First quote a group message, then /mute |
/unmute | Enable specified group messaging | /unmute group name [optional, all group messages will be enabled] |
/help | show help |
Except for /find
and /findandlock
which must contain the name of the contact to be found, other commands can have no parameters.
According to Wechaty's instructions, Wechat accounts registered after June 2017 cannot log in to the web version of Wechat, so this bot cannot be used to collect messages. Login with all wechat accounts has been supported
To ensure security, the bot will only keep the last 200 messages in its chat history (default 200)
By default, the recipient of a direct reply to a message in Telegram is the sender (individual or group) who has recently received the message. If you are worried about the wrong reply, please manually specify a message to reply to (within the last 200 messages). You can manually /lock /unlock to lock the current contact
Versions 2.1.0 and above already support sending pictures, videos, and documents, but do not support sending messages that can be automatically recognized as audio by Wechat.
If you use a VPS, WeChat will detect remote login and issue a prompt. You can run the bot locally, just fill in the socks5, http proxy information in the configuration file.
The command description is here. Paste it into BotFather to enable the Telegram Bot input box prompt.
MPL-2.0