2.5.0 • Published 3 years ago

leavexchat-bot v2.5.0

Weekly downloads
2
License
MPL-2.0
Repository
github
Last release
3 years ago

LeaveXChat

Powered by Wechaty

使用 Telegram Bot 收发 WeChat 文字、语音(仅接收)、图片、视频、Telegram 静态贴纸等消息

安装准备

  1. 安装 Node.js 10+ 官网: https://nodejs.org
  2. 访问 https://t.me/BotFather, 申请你的 bot token

快速开始

Linux 使用前需要安装如下依赖:

CentOS 7

yum install 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

自行编译

$> git clone https://github.com/UnsignedInt8/leavexchat-bot.git
$> cd leavexchat-bot
$> npm i
$> npm run build
$> node build/main/index.js # 无需配置文件
$> 输入 token, Done!

由于中国用户无法直接访问 Telegram,所以需要在配置文件 config.json 中指定 SOCKS5 代理:

config.json 请参照 config-example.json 填写。

# 使用配置文件方式
$> node build/main/index.js -c config.json

作者的用法

2.0 版本已经加入了 wechat 会话恢复功能。要发挥该特性,就需要进程守护,推荐使用 forever

$> npm i -g forever

$> git clone https://github.com/UnsignedInt8/leavexchat-bot.git
$> cd leavexchat-bot
$> npm i
$> npm run build
$> forever build/main/index.js -c config.json

这样可以大幅降低扫码登录的频次

Bot 命令

命令说明示例
/start启动会话
/login请求登录
/logout登出 WeChat
/groupon开启接收群消息
/groupoff关闭接收群消息
/officialon开启接收公众号消息
/officialoff关闭接收公众号消息
/selfon开启接收自己的消息
/selfoff关闭接收自己的消息
/find查找联系人并设置为当前联系人/find ABC
/lock锁定当前联系人
/unlock取消锁定当前联系人
/findandlock查找并锁定为当前联系人/findandlock ABC
/current显示当前联系人
/agree同意好友请求/agree reqid
/disagree忽略好友请求/disagree reqid
/forwardto转发消息给联系人/forwardto 联系人
/mute静音指定群先引用一条群消息, 再 /mute
/unmute启用指定群消息/unmute 群名可不填,则启用全部群消息
/help显示帮助

除了 /find/findandlock 必须带有要查找的联系人名字,其它命令均可无参数

使用注意

  1. 根据 Wechaty 说明,2017 年 6 月之后注册的 Wechat 账号无法登陆网页版 Wechat,因此无法使用此 bot 代收消息

  2. 为保证安全,bot 只会在自己的聊天记录保留最近 200 条消息 (默认 200)

  3. 直接在 Telegram 里回复消息的对象默认是最近收到消息的发送者(个人或群),如果担心回复错了,请手动指定回复某条消息(最近 200 条以内)。可以手动 /lock /unlock 锁定当前联系人

  4. 2.1.0 以上版本已经支持发送图片、视频、文档,但不支持发送可被 Wechat 自动识别为音频的消息

  5. 如果使用 VPS,WeChat 会检测到异地登陆,并发出提示。可以在本地运行该 bot,只需在配置文件里填写好 socks5, http 代理信息即可

Telegram Bot 快捷命令支持

命令说明在此处,粘贴到 BotFather 中即可启用 Telegram Bot 输入框提示

License

MPL-2.0

2.5.0

3 years ago

2.4.2

4 years ago

2.4.1

4 years ago

2.3.0

4 years ago

2.3.1

4 years ago

2.2.5

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.2.6

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.5

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago