Rat's

使用EH Forwarder Bot实现Telegram同时收发多个微信/QQ消息
说明:EH Forwarder Bot是一个可扩展的聊天隧道框架,允许用户一次发送和接收来自多个IM平台的消息,并...
扫描右侧二维码阅读全文
19
2019/04

使用EH Forwarder Bot实现Telegram同时收发多个微信/QQ消息

说明:EH Forwarder Bot是一个可扩展的聊天隧道框架,允许用户一次发送和接收来自多个IM平台的消息,并最终远程管理他们的帐户,目前可以实现的Telegram收发QQ、微信、Facebook Messenger等消息,你也可以同时一起收发N个微信、NQQ等,这里就说下Telegram收发微信/QQ消息的手动安装及Docker安装。

收发微信

提示:使用该功能前,请先确认所使用的微信能成功登录WEB端,不然后面会报错。

项目地址:https://github.com/blueset/ehForwarderBot

所使用的模块地址:

#Telegram模块
https://github.com/blueset/efb-telegram-master
#微信模块
https://github.com/blueset/efb-wechat-slave

其他模块地址→传送门,包括Facebook Messenger等模块,有兴趣的可以看下。

环境要求:Python 3.6+EH Forwarder Bot 2.0+ffmpeglibmagiclibwebp

手动教程适用于DebianCentOSUbuntu,如果你想用Ubuntu的话,最好使用18.04+版本。

1、安装依赖

#CentOS系统
yum install file-devel libwebp-tools git screen -y

#Debian/Ubuntu系统
apt install libwebp-dev libmagic-dev git screen -y

2、安装Python3.6

#CentOS系统
wget https://www.moerats.com/usr/shell/Python3/CentOS_Python3.6.sh && sh CentOS_Python3.6.sh
#Debian系统
wget https://www.moerats.com/usr/shell/Python3/Debian_Python3.6.sh && sh Debian_Python3.6.sh
#Ubuntu系统
apt update
apt install python3-pip python3-setuptools python3-dev -y

3、安装ffmpeg

#下载ffmpeg二进制
wget https://www.moerats.com/usr/down/ffmpeg/ffmpeg-git-$(getconf LONG_BIT)bit-static.tar.xz
#解压文件
tar xvf ffmpeg-git-*-static.tar.xz
#移动ffmpeg可执行文件
mv ffmpeg-git-*/ffmpeg  ffmpeg-git-*/ffprobe /usr/bin/
#删除文件
rm -rf ffmpeg-git-*

4、安装框架

#安装稳定版
pip3 install ehforwarderbot

#安装开发版,建议安装开发版,bug修复快些,功能也新
pip3 install git+https://github.com/blueset/ehforwarderbot.git

5、安装TG和微信模块

pip3 install efb-telegram-master efb-wechat-slave

6、启用模块
先新建配置文件夹和配置文件config.yaml,使用命令:

#default为配置文件默认的文件夹,你也可以命名为其它的,不会玩的就默认
mkdir -p ~/.ehforwarderbot/profiles/default
nano ~/.ehforwarderbot/profiles/default/config.yaml

参考代码为:

#请根据实际情况修改
master_channel: foo.demo_master
slave_channels:
- foo.demo_slave
- bar.dummy
middlewares:
- foo.null

以上对应的均为模块名称,模块参考→传送门,比如这里博主只用了TelegramWeChat模块,所以大致配置为:

master_channel: blueset.telegram
slave_channels:
- blueset.wechat

然后使用Ctrl+xy保存退出。

这只是登录一个微信号,如果你要同时登录多个微信号,那么配置文件就需要改为:

#比如我要同时登录并收发3个微信号
master_channel: blueset.telegram
slave_channels:
- blueset.wechat
- blueset.wechat#moe123
- blueset.wechat#rats321

只需要在后面使用#指定一个ID号,该ID号只能有字母,数字和下划线,即正则表达式[a-zA-Z0-9_]+,想登录几个账户就加几个。如果你使用QQFacebook Messenger模块的话,设置方法也一样。

7、建立TG配置文件
建立配置文件前需要先获取TelegramTokenUserid,获取方法如下:

#Telegram的Token获取
1、在Telegram关注@BotFather
2、再到对话框依次输入:/start=>/newbot,然后会要你给机器人命名(如:MoeratsBot),命名完成会给你一个Token。

#Telegram群Userid获取
1、先和你的机器人聊天,随便发一句话。
2、在浏览器输入https://api.telegram.org/botxx:xx/getUpdates(其中xx:xx为Token),然后chat后面的id即为你的userid。

再新建一个Telegram模块配置文件夹和配置文件config.yaml,使用命令:

#同样的也建在default文件夹,如果你上面更改了default文件夹,那这里也要更改
mkdir ~/.ehforwarderbot/profiles/default/blueset.telegram
nano ~/.ehforwarderbot/profiles/default/blueset.telegram/config.yaml

填入以下代码:

token: "12345:moerats" 
admins:
- 765432 

然后使用Ctrl+xy保存退出。上面所对应的参数分别为TokenUserid。关于Telegram模块的更多玩法可以参考→传送门

8、启动

#该命令会默认从default文件夹读取信息,如果你之前建的是moerats文件夹,那命令应该为ehforwarderbot -p moerats
ehforwarderbot

这时候会给一个微信二维码或者二维码链接你,放到浏览器打开扫描登录即可,如果你设置了同时登录多个账户,那设置几个就需要登录几个。

然后使用Ctrl+C断开运行,再使用命令后台运行:

screen -dmS EHF ehforwarderbot

最后你的微信消息会通过机器人发送给你,你也可以通过机器人将消息发送给指定好友。

收发QQ消息

提示:这里随便提了下,了解下就行了,建议使用下面Docker方式安装。

所使用的模块地址:

#Telegram模块
https://github.com/blueset/efb-telegram-master
#QQ模块
https://github.com/milkice233/efb-qq-slave

由于方法写的很大概,所以需要你把收发微信的方法看懂,这里EH Forwarder Bot只支持酷Q客户端,一般采用Docker的方法在Linux上安装酷Q,方法很久以前就说过了,参考→传送门,不过启动命令变了下,也就是安装wine-coolq的命令。

安装TGQQ模块:

pip3 install efb-telegram-master efb-qq-slave

安装wine-coolq

mkdir coolq  #包含CoolQ程序文件
docker run -ti --rm --name cqhttp-test --net="host" \
     -v $(pwd)/coolq:/home/user/coolq     `#mount coolq folder` \
     -p 9000:9000                         `#网页noVNC端口` \
     -p 5700:5700                         `#酷Q对外提供的API接口的端口` \
     -e VNC_PASSWD=MAX8char               `#请修改VNC密码!!!!` \
     -e COOLQ_PORT=5700                   `#酷Q对外提供的API接口的端口` \
     -e COOLQ_ACCOUNT=123456              `#在此输入要登录的QQ号,虽然可选但是建议填入` \
     -e CQHTTP_POST_URL=http://127.0.0.1:8000   `#efb-qq-slave监听的端口/地址用于接受传入的消息` \
     -e CQHTTP_SERVE_DATA_FILES=yes       `#允许以HTTP方式访问酷Q数据文件` \
     -e CQHTTP_ACCESS_TOKEN=ac0f790e1fb74ebcaf45da77a6f9de47  `#Access Token` \
     -e CQHTTP_POST_MESSAGE_FORMAT=array  `# 回传消息时使用数组(必选)` \
     richardchien/cqhttp:latest

然后使用ip:9000访问noVNC登录酷Q即可。

新建QQ模块配置文件:

mkdir ~/.ehforwarderbot/profiles/default/milkice.qq
nano ~/.ehforwarderbot/profiles/default/milkice.qq/config.yaml

填入的代码大致如下:

Client: CoolQ                         #指定要使用的QQ客户端(此处为CoolQ)
CoolQ:
    type: HTTP                        #指定efb-qq-slave与酷Q通信的方式 现阶段仅支持HTTP
    access_token: ac0f790e1fb74ebcaf45da77a6f9de47
    api_root: http://127.0.0.1:5700/  # 酷Q API接口地址/端口
    host: 127.0.0.1                   # efb-qq-slave所监听的地址用于接收消息
    port: 8000                        # 同上
    is_pro: false                      # 若为酷Q Pro则为true,反之为false
    air_option:                       # 包含于air_option的配置选项仅当is_pro为false时才有效
        upload_to_smms: true          # 将来自EFB主端(通常是Telegram) 的图片上传到sm.ms服务器并以链接的形式发送到QQ端

最后使用ehforwarderbot命令启动即可。

Docker安装

这里选择2个最新的Docker镜像,也是官方推荐的,项目地址:

#Telegram收发QQ消息
https://github.com/Earth-Online/efb-qq-coolq-docker
#Telegram收发微信消息
https://www.github.com/Mikubill/efb-wechat-docker

1、安装Docker

#CentOS 6
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update -y
yum -y install docker-io
service docker start
chkconfig docker on

#CentOS 7、Debian、Ubuntu
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker

2、Telegram收发QQ消息
安装docker-compose

curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
#验证是否安装成功
docker-compose --version
#返回以下信息即安装成功
docker-compose version 1.25.0, build 1110ad01

拉取Docker源码:

git clone https://github.com/Earth-Online/efb-qq-coolq-docker.git
cd efb-qq-coolq-docker
#编辑config.yaml配置文件
nano ehforward_config/profiles/default/blueset.telegram/config.yaml

修改如下:

#token和userid参数获取方法查看上面的手动安装教程
token: "你的TG机器人Token"
admins:
- 你的Userid

然后再编辑docker-compose.yml文件:

nano docker-compose.yml

修改如下:

- VNC_PASSWD=你的密码
- COOLQ_ACCOUNT=你的qq账号

后台启动:

#第一次启动会构建镜像,所以会慢点
docker-compose up -d

然后打开ip:9801登陆novnc后完成coolq登陆操作。如果该地址打不开,请检查下防火墙。

3、Telegram收发微信消息

#拉取源码
git clone https://github.com/mikubill/efb-wechat-docker.git
#构建镜像
cd efb-wechat-docker && docker build -t mikubill/efbwechat .
#启动镜像,TOKEN为TG机器人Token、ADMIN为你的Userid,获取方法查看上面的手动安装教程
docker run -d -t --name "efbwechat" -e TOKEN=xxxx -e ADMIN=xxxx mikubill/efbwechat

最后获取微信登录验证码,使用命令:

docker logs -f efbwechat 

扫描登录即可。

最后这里都没有给微信添加额外的配置文件,直接使用默认的微信配置,如果想扩展微信功能的可以参考→传送门,不过由于模块使用的微信网页版,所以支持的功能是有限的,比如:没有朋友圈、不能发语音、位置等等,一般来说也够用了,至于QQ的话,功能肯定受酷Q限制,暂时不能处理好友请求处理,加群请求处理,语音发送/接收等,对于Facebook Messenger模块的话,有需求的可以自己试试安装配置。

搬瓦工CN2/GIA CN2套餐,1G带宽,速度快,建站稳定,支持支付宝,【点击查看】。
最后修改:2020 年 02 月 23 日 10 : 26 AM

发表评论 取消回复

120 条评论

  1. pppppplh

    您好 我已经可以在novnc查到QQ的运行日志了,但telegram上面还是没有任何的消息 。 bot的权限我也给了 请问你知道为什么吗

  2. LonANi

    求教:最后一步执行ehforwarderbot --profile qq 之后提示:
    2020-04-14 20:06:08,428 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:85)

    Initializing slave milkice.qq...

    2020-04-14 20:06:08,855 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:96)

    Slave channel QQ Slave (milkice.qq) # Default profile is initialized.

    2020-04-14 20:06:08,859 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:99)

    Initializing master blueset.telegram...

    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 11, in <module>

    sys.exit(main())

    File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/__main__.py", line 277, in main

    init(conf)

    File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/__main__.py", line 103, in init

    coordinator.add_channel(module(instance_id=instance_id))

    File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/__init__.py", line 100, in init

    if 'WEBP' not in Image.ID or not WebPImagePlugin.SUPPORTED:

    AttributeError: module 'PIL.WebPImagePlugin' has no attribute 'SUPPORTED'

    不知道是什么情况,希望博主能帮忙看一下,先谢过大佬!

  3. 维安雨轩

    [root@instance-7 efb-qq-coolq-docker]# docker-compose up
    -bash: docker-compose: command not found
    我centos-7用的谷歌云,我尝试各种方法安装docker-compose结果还是这样。。。

    1. 维安雨轩
      @维安雨轩

      前面问题解决了,又出现这个问题:ERROR: Volume bot-db declared as external, but could not be found. Please create the volume manually using docker volume create --name=bot-db and try again.

      1. Rat's
        @维安雨轩

        试试先用这个命令docker volume create --name=bot-db

  4. carlning

    微信限制我登陆网页版,我做到最后一步才发现这个问题,建议写前面让大家先试试

    1. Rat's
      @carlning

      好的,已添加

      1. carlning
        @Rat's

        微信限制有救吗?

        1. Rat's
          @carlning

          申诉看看?

  5. lecx

    ehforwarderbot后是这样的,怎么解决欸
    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 11, in <module>

    load_entry_point('ehforwarderbot==2.0.0b23.dev3', 'console_scripts', 'ehforwarderbot')()

    File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/__main__.py", line 263, in main

    conf = config.load_config()

    File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/config.py", line 64, in load_config

    channel = utils.locate_module(i, 'slave')

    File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/utils.py", line 138, in locate_module

    return i.load()

    File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2442, in load

    self.require(*args, **kwargs)

    File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2465, in require

    items = working_set.resolve(reqs, env, installer, extras=self.extras)

    File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 791, in resolve

    raise VersionConflict(dist, req).with_context(dependent_req)

    pkg_resources.VersionConflict: (requests 2.18.4 (/usr/lib/python3/dist-packages), Requirement.parse('requests>=2.22
    .0'))

    1. Jessie
      @lecx

      sudo pip3 install --upgrade docker-compose
      我用了这个就可以了

    2. Rat's
      @lecx

      看不出来,你可以去这里搜下相关问题和解决方法:https://github.com/blueset/ehForwarderBot/issues

  6. xxx

    不知道为什么,装了被挖矿了,心态都炸了

    1. Rat's
      @xxx

      这个不会吧,怎么看出被挖矿的

      1. xxx
        @Rat's

        那天加上你的博客,我弄了三个人的,不知道是哪个的有,你的技术贴很多,应该不是你的

      2. xxx
        @Rat's

        CPU超载了1800,GCP都给我封了

        1. Rat's
          @xxx

          那不清楚了,好像你是第一个说被挖矿的

  7. 小刀

    您好 博主 在最后一步输入ehforwarderbot 时 提示ValueError: Master Channel is not specified in the profile config 我centos 7系统,这个怎么操作

    1. Rat's
      @小刀

      好像说你的配置文件不对

  8. 陈q

    扫描后出现这个样子,是什么原因

    If the QR code was not shown correctly, please visit:
    https://login.weixin.qq.com/qrcode/wZNHt4Sh6A==
    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 11, in <module>

    sys.exit(main())

    File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/__main__.py", line 271, in main

    init(conf)

    File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/__main__.py", line 91, in init

    coordinator.add_channel(cls(instance_id=instance_id))

    File "/usr/local/lib/python3.6/dist-packages/efb_wechat_slave/__init__.py", line 152, in init

    self.authenticate('console_qr_code')

    File "/usr/local/lib/python3.6/dist-packages/efb_wechat_slave/__init__.py", line 544, in authenticate

    logout_callback=self.exit_callback)

    File "/usr/local/lib/python3.6/dist-packages/efb_wechat_slave/vendor/wxpy/api/bot.py", line 97, in init

    enhance_webwx_request(self)

    File "/usr/local/lib/python3.6/dist-packages/efb_wechat_slave/vendor/wxpy/utils/misc.py", line 327, in enhance_webwx_request

    '&pass_ticket={li[pass_ticket]}'.format(li=login_info)

    KeyError: 'wxsid'

  9. 陈q

    请问这个阿里云主机可以吗,一定要国外的VPS吗

    1. Rat's
      @陈q

      对,需要访问tg

  10. tang

    博主,请问ubuntu下的微信代收和docker下的qq代收,需要两个不同的bot么,我出了一点问题,在同一个vps上。

  11. xushbo

    扫完二维码出现了
    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 11, in <module>

    load_entry_point('ehforwarderbot==2.0.0b21', 'console_scripts', 'ehforwarderbot')()

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 271, in main

    init(conf)

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 91, in init

    coordinator.add_channel(cls(instance_id=instance_id))

    File "/usr/local/lib/python3.6/site-packages/efb_wechat_slave/__init__.py", line 152, in init

    self.authenticate('console_qr_code')

    File "/usr/local/lib/python3.6/site-packages/efb_wechat_slave/__init__.py", line 544, in authenticate

    logout_callback=self.exit_callback)

    File "/usr/local/lib/python3.6/site-packages/efb_wechat_slave/vendor/wxpy/api/bot.py", line 97, in init

    enhance_webwx_request(self)

    File "/usr/local/lib/python3.6/site-packages/efb_wechat_slave/vendor/wxpy/utils/misc.py", line 327, in enhance_webwx_request

    '&pass_ticket={li[pass_ticket]}'.format(li=login_info)

    KeyError: 'wxsid'

    1. 陈q
      @xushbo

      你这个问题解决了,我也是出现同样问题

    2. xushbo
      @xushbo

      怎么整都整不好,一直出现<error><ret>1203</ret><message>为了你的帐号安全,此微信号不能登录网页微信。你可以使用Windows微信或Mac微信在电脑端登录。Windows微信下载地址:https://pc.weixin.qq.com Mac微信下载地址:https://mac.weixin.qq.com</message></error>
      2019-11-15 06:46:29,584 [Level 99]: plugins.blueset.wechat.WeChatChannel (__init__.console_qr_code; __init__.py:207)

      EWS: Please scan the QR code with your camera, screenshots will not work. (oedZSPgaFg==, 400)

  12. tang

    大佬,第二次登录的时候,微信扫码成功之后,bot说login again when you are ready,相当于扫完码后没登进去,

    Traceback (most recent call last):
    File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner

    self.run()

    File "/usr/lib/python3.6/threading.py", line 864, in run

    self._target(*self._args, **self._kwargs)

    File "/home/wiki/.local/lib/python3.6/site-packages/efb_wechat_slave/vendor/itchat/components/login.py", line 295, in maintain_loop

    exitCallback()

    File "/home/wiki/.local/lib/python3.6/site-packages/efb_wechat_slave/__init__.py", line 244, in exit_callback

    raise Exception(self._("Web WeChat logged your account out before master channel is ready."))

    Exception: Web WeChat logged your account out before master channel is ready.

    1. tang
      @tang

      ok 已在此issue中 找到问题和方法,https://github.com/blueset/efb-wechat-slave/issues/61

      rm -r ~/.ehforwarderbot/profiles/default/blueset.w*

  13. xushbo

    <error><ret>1203</ret><message>为了你的帐号安全,此微信号不能登录网页微信。你可以使用Windows微信或Mac微信在电脑端登录。Windows微信下载地址:https://pc.weixin.qq.com Mac微信下载地址:https://mac.weixin.qq.com</message></error>
    2019-11-15 06:46:29,584 [Level 99]: plugins.blueset.wechat.WeChatChannel (__init__.console_qr_code; __init__.py:207)

    EWS: Please scan the QR code with your camera, screenshots will not work. (oedZSPgaFg==, 400)

    好不容易弄好了 出现这个情况

    1. Rat's
      @xushbo

      这个要你直接扫描二维码,不要扫描截图的翻译

  14. xushbo

    大佬最后一步了,出现这个问题
    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 11, in <module>

    sys.exit(main())

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 262, in main

    conf = config.load_config()

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/config.py", line 47, in load_config

    channel = utils.locate_module(data['master_channel'], 'master')

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/utils.py", line 138, in locate_module

    return i.load()

    File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2442, in load

    self.require(*args, **kwargs)

    File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2465, in require

    items = working_set.resolve(reqs, env, installer, extras=self.extras)

    File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 786, in resolve

    raise DistributionNotFound(req, requirers)

    pkg_resources.DistributionNotFound: The 'cairocffi' distribution was not found and is required by cairosvg

    1. Rat's
      @xushbo

      看报错好像是cairocffi没安装,试试这个命令看看pip3 install cairocffi

  15. 你好,跪求帮忙啊
    conf = config.load_config()

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/config.py", line 47, in load_config

    channel = utils.locate_module(data['master_channel'], 'master')

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/utils.py", line 138, in locate_module

    return i.load()

    File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2346, in load

    return self.resolve()

    File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2352, in resolve

    module = __import__(self.module_name, fromlist=['__name__'], level=0)

    File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/__init__.py", line 28, in <module>

    from . import utils as etm_utils

    File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/utils.py", line 10, in <module>

    from tgs.parsers.tgs import parse_tgs

    File "/usr/local/lib/python3.6/site-packages/tgs/__init__.py", line 1, in <module>

    from . import objects, parsers, utils, exporters, nvector

    File "/usr/local/lib/python3.6/site-packages/tgs/parsers/__init__.py", line 1, in <module>

    from . import svg, tgs, sif

    File "/usr/local/lib/python3.6/site-packages/tgs/parsers/svg/__init__.py", line 1, in <module>

    from .importer import parse_svg_etree, parse_svg_file

    File "/usr/local/lib/python3.6/site-packages/tgs/parsers/svg/importer.py", line 8, in <module>

    from ...utils.ellipse import Ellipse

    File "/usr/local/lib/python3.6/site-packages/tgs/utils/__init__.py", line 1, in <module>

    from . import animation, ellipse, ik, linediff, restructure, script, stripper

    File "/usr/local/lib/python3.6/site-packages/tgs/utils/linediff.py", line 3, in <module>

    from ..exporters import prettyprint

    File "/usr/local/lib/python3.6/site-packages/tgs/exporters/__init__.py", line 16, in <module>

    from . import cairo, gif

    File "/usr/local/lib/python3.6/site-packages/tgs/exporters/cairo.py", line 1, in <module>

    import cairosvg

    File "/usr/local/lib/python3.6/site-packages/cairosvg/__init__.py", line 42, in <module>

    from . import surface # noqa isort:skip

    File "/usr/local/lib/python3.6/site-packages/cairosvg/surface.py", line 25, in <module>

    import cairocffi as cairo

    File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 50, in <module>

    ('libcairo.so', 'libcairo.2.dylib', 'libcairo-2.dll'))

    File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 45, in dlopen

    raise OSError(error_message) # pragma: no cover

    OSError: no library called "cairo" was found
    no library called "libcairo-2" was found
    cannot load library 'libcairo.so': Error loading shared library libcairo.so: No such file or directory
    cannot load library 'libcairo.2.dylib': Error loading shared library libcairo.2.dylib: No such file or directory
    cannot load library 'libcairo-2.dll': Error loading shared library libcairo-2.dll: No such file or directory

    1. 你好,跪求帮忙啊
      @你好,跪求帮忙啊

      请问这咋办啊?

      1. 你好,跪求帮忙啊
        @你好,跪求帮忙啊

        现在出现扫码界面了 可为什么 扫码登录后 不转发消息呢?

        1. Rat's
          @你好,跪求帮忙啊

          有日志信息吗?

          1. 你好,跪求帮忙啊
            @Rat's

            If you cannot read the QR code above, please visit the following URL:
            https://login.weixin.qq.com/qrcode/Qbz7VT31zQ==
            14-10-2019:14:06:23,434 CRITICAL [main.py:86]

            Slave channel WeChat Slave (eh_wechat_slave) initialized.

            14-10-2019:14:06:23,435 CRITICAL [main.py:87]

            Initializing master ('plugins.eh_telegram_master', 'TelegramChannel')...

            Imageio: 'ffmpeg-linux64-v3.3.1' was not found on your computer; downloading it now.
            Try 1. Download from https://github.com/imageio/imageio-binaries/raw/master/ffmpeg/ffmpeg-linux64-v3.3.1 (43.8 MB)
            Downloading: 45929032/45929032 bytes (100.0%)
            Done
            14-10-2019:14:06:32,452 CRITICAL [main.py:90]

            Master channel Telegram Master (eh_telegram_master) initialized.

            14-10-2019:14:06:32,452 CRITICAL [main.py:92]

            All channels initialized.

            File saved as /root/.imageio/ffmpeg/ffmpeg-linux64-v3.3.1.

            1. Rat's
              @你好,跪求帮忙啊

              这个提示是说你没安装ffmpeg。

              1. 你好,跪求帮忙啊
                @Rat's

                楼主 现在你的dock安装教程 还有用吗? 我用的别的教程安装的dock 最后出现二维码了 可机器人就是不转发消息

                1. Rat's
                  @你好,跪求帮忙啊

                  一般能打开就么得问题,有空我再实践一下。

  16. tabris

    VPS 不再墙外 没有关系的吧?

    1. Rat's
      @tabris

      这个需要墙外的vps

  17. Adoc

    您好,博主,可以绑定多个微信号,绑定多个机器人吗

    1. Rat's
      @Adoc

      可以绑定多个微信

  18. stardif

    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 10, in <module>

    sys.exit(main())

    File "/usr/local/lib/python3.7/site-packages/ehforwarderbot/__main__.py", line 267, in main

    init(conf)

    File "/usr/local/lib/python3.7/site-packages/ehforwarderbot/__main__.py", line 91, in init

    coordinator.add_channel(cls(instance_id=instance_id))

    File "/usr/local/lib/python3.7/site-packages/efb_wechat_slave/__init__.py", line 174, in init

    self.authenticate('console_qr_code')

    File "/usr/local/lib/python3.7/site-packages/efb_wechat_slave/__init__.py", line 553, in authenticate

    logout_callback=self.exit_callback)

    File "/usr/local/lib/python3.7/site-packages/efb_wechat_slave/wxpy/api/bot.py", line 97, in init

    enhance_webwx_request(self)

    File "/usr/local/lib/python3.7/site-packages/efb_wechat_slave/wxpy/utils/misc.py", line 327, in enhance_webwx_request

    '&pass_ticket={li[pass_ticket]}'.format(li=login_info)

    KeyError: 'wxsid'
    2019-08-03 22:19:16,671 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:85)

    Initializing slave blueset.wechat...

    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 10, in <module>

    sys.exit(main())

    File "/usr/local/lib/python3.7/site-packages/ehforwarderbot/__main__.py", line 267, in main

    init(conf)

    File "/usr/local/lib/python3.7/site-packages/ehforwarderbot/__main__.py", line 91, in init

    coordinator.add_channel(cls(instance_id=instance_id))

    File "/usr/local/lib/python3.7/site-packages/efb_wechat_slave/__init__.py", line 174, in init

    self.authenticate('console_qr_code')

    File "/usr/local/lib/python3.7/site-packages/efb_wechat_slave/__init__.py", line 553, in authenticate

    logout_callback=self.exit_callback)

    File "/usr/local/lib/python3.7/site-packages/efb_wechat_slave/wxpy/api/bot.py", line 87, in init

    loginCallback=login_callback, exitCallback=logout_callback

    File "/usr/local/lib/python3.7/site-packages/itchat/components/register.py", line 29, in auto_login

    loginCallback=loginCallback, exitCallback=exitCallback):

    File "/usr/local/lib/python3.7/site-packages/itchat/components/hotreload.py", line 54, in load_login_status

    self.loginInfo['User'] = templates.User(self.loginInfo['User'])

    KeyError: 'User'

    请问这是哪里有问题?

    1. Lison
      @stardif

      Traceback (most recent call last):
      File "/usr/local/bin/ehforwarderbot", line 11, in <module>

      sys.exit(main())

      File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 262, in main

      conf = config.load_config()

      File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/config.py", line 47, in load_config

      channel = utils.locate_module(data['master_channel'], 'master')

      File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/utils.py", line 138, in locate_module

      return i.load()

      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load

      return self.resolve()

      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve

      module = __import__(self.module_name, fromlist=['__name__'], level=0)

      File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/__init__.py", line 28, in <module>

      from . import utils as etm_utils

      File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/utils.py", line 10, in <module>

      from tgs.parsers.tgs import parse_tgs

      File "/usr/local/lib/python3.6/site-packages/tgs/__init__.py", line 1, in <module>

      from . import objects, parsers, utils, exporters, nvector

      File "/usr/local/lib/python3.6/site-packages/tgs/parsers/__init__.py", line 1, in <module>

      from . import svg, tgs, sif

      File "/usr/local/lib/python3.6/site-packages/tgs/parsers/svg/__init__.py", line 1, in <module>

      from .importer import parse_svg_etree, parse_svg_file

      File "/usr/local/lib/python3.6/site-packages/tgs/parsers/svg/importer.py", line 8, in <module>

      from ...utils.ellipse import Ellipse

      File "/usr/local/lib/python3.6/site-packages/tgs/utils/__init__.py", line 1, in <module>

      from . import animation, ellipse, ik, linediff, restructure, script, stripper

      File "/usr/local/lib/python3.6/site-packages/tgs/utils/linediff.py", line 3, in <module>

      from ..exporters import prettyprint

      File "/usr/local/lib/python3.6/site-packages/tgs/exporters/__init__.py", line 16, in <module>

      from . import cairo, gif

      File "/usr/local/lib/python3.6/site-packages/tgs/exporters/cairo.py", line 1, in <module>

      import cairosvg

      File "/usr/local/lib/python3.6/site-packages/cairosvg/__init__.py", line 42, in <module>

      from . import surface # noqa isort:skip

      File "/usr/local/lib/python3.6/site-packages/cairosvg/surface.py", line 25, in <module>

      import cairocffi as cairo

      File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 50, in <module>

      ('libcairo.so', 'libcairo.2.dylib', 'libcairo-2.dll'))

      File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 45, in dlopen

      raise OSError(error_message) # pragma: no cover

      OSError: no library called "cairo" was found
      no library called "libcairo-2" was found
      cannot load library 'libcairo.so': libcairo.so: cannot open shared object file: No such file or directory
      cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open shared object file: No such file or directory
      cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open shared object file: No such file or directory
      我也是这个问题,输入ehforwarderbot就会报错 ,我也把pip3的bin目录加入到系统PATH环境变量了,球球大佬们的帮助

      1. jiz4oh
        @Lison

        使用以下命令安装依赖库
        yum install cairo-devel
        yum install libtiff*

      2. Rat's
        @Lison

        好像加载的时候缺少共享库,你可以换个系统操作看看。

        1. Lison
          @Rat's

          我找到原因了,有些vps没有安装Cairo图形库,搭建之后就能显示二维码了

          1. pq8o3q
            @Lison

            大佬,请问下您是怎么搞好的,可以说一下命令吗,我谷歌搜了下,安装了还是不行,非常感谢

            1. Rat's
              @pq8o3q

              这是上面提供的命令:
              yum install cairo-devel
              yum install libtiff*

              1. pq8o3q
                @Rat's

                还有就是就算使用docker,最后也会出现这种错误,用完那两个命令也是依旧会

              2. pq8o3q
                @Rat's

                博主,我也试了,但还是出现上面的错误,不知到怎么回事。centos7原版系统和dd萌咖大佬的debian9,都会出现错误,很郁闷。。。

          2. Rat's
            @Lison

            解决好了就行

  19. 哥哥

    如果配置了多个微信同时接收。如果其中一个掉线了(手机微信换了设备),需要重新登录。那么如何单独重新启动这一个微信了?

    1. Rat's
      @哥哥

      这个不太清楚,没试过单独启动一个

      1. 哥哥
        @Rat's

        我经常遇到重启失败,采取的措施就删掉~/.ehforwarderbot/profiles/default/blueset.wechat
        但是这样有一个很大的问题,就是绑定好的链接会失效,请问你有更好的方法吗?

        1. Rat's
          @哥哥

          其实么有,我用的时间不长,很多情景还没遇到。

          1. 哥哥
            @Rat's

            好的,谢谢分享,有新功能,你可以继续更新的!很期待

  20. Bruce

    请问博主,在微信端已经屏蔽的群消息怎么设置不转发到tg

    1. Rat's
      @Bruce

      这个就不太清楚了,对使用方面研究不太深。

  21. eatneko

    博主,请问一下,这个运行需要多大内存。

    1. Rat's
      @eatneko

      我512内存,添加了点虚拟内存就可以了

      1. eatneko
        @Rat's

        博主,喔debain系统的Python安装错了,请问,怎么卸载,安装了Ubuntu系统的

        1. eatneko
          @eatneko

          用这命令卸载apt-get remove --auto-remove python3.*,重装python3.6.4后,显示pip3不存在

  22. 來不及

    好久不见,一切祝好,
    博主有没有 Linux 挂载硬盘方面的经验,
    可以分享一下吗?

    1. Rat's
      @來不及

      我以前发过挂载硬盘教程,地址:https://www.moerats.com/archives/514/

  23. 西瓜

    微信多开的时候出现如下错误,感觉的PYTHON的问题。请问大佬怎么解决
    Exception in thread Thread-2:
    Traceback (most recent call last):
    File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
    File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(self._args, *self._kwargs)
    File "/usr/local/lib/python3.6/dist-packages/itchat/components/login.py", line 281, in maintain_loop
    exitCallback()
    File "/usr/local/lib/python3.6/dist-packages/efb_wechat_slave/init.py", line 264, in exit_callback
    if not getattr(coordinator, 'master', default=None):
    TypeError: getattr() takes no keyword arguments

    1. Rat's
      @西瓜

      这个我也不是很清楚,没遇到过,可以去Github反馈下。

      1. 西瓜
        @Rat's

        那边没人回我,桑心

  24. asassss

    <script>

    while (true) { alert('Hello') }

    </script>

  25. Toast

    可以设置一个 BOT 加上一个 QQ 还有一个微信 这样的设置吗

    1. Rat's
      @Toast

      可以啊,你试试

  26. su

    为什么一切都安装好了,但是还是没有消息提示呢?

    1. Rat's
      @su

      因为你有步骤出了问题

  27. su

    Traceback (most recent call last):
    File "/usr/local/bin/ehforwarderbot", line 11, in <module>

    load_entry_point('ehforwarderbot==2.0.0b16.dev1', 'console_scripts', 'ehforwarderbot')()

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 260, in main

    conf = config.load_config()

    File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/config.py", line 37, in load_config

    with open(conf_path) as f:

    IsADirectoryError: [Errno 21] Is a directory: '/root/.ehforwarderbot/profiles/default/config.yaml'

    1. Rat's
      @su

      看下config.yaml配置文件对不对

  28. 树先生

    大佬,我主要过来歪个楼,比较好的博客模版您有没有(比如您网站这样的)(手动外头

    1. Rat's
      @树先生

      不知道啥叫好看,你可以百度下。

  29. 1

    想问问手机版电报,如何 “换行即发送”。。。

    每次都要点发送按钮,好麻烦的!

    1. Rat's
      @1

      不是很清楚,很少玩电报,一般水教程的时候才打开下

  30. 美国主机

    朋友 交换链接吗

    1. Rat's
      @美国主机

      暂时不换了

  31. chen

    博主,我想问一下搭建服务端的服务器必须要能越过长城才可以正常接收消息吗?

    1. Rat's
      @chen

      应该是这样的

      1. chen
        @Rat's

        好的,谢谢了

  32. 西瓜

    博主,请问多个微信账号登录的是同一个机器人吗?是不是需要两个都登录才能正常运行呢

    1. Rat's
      @西瓜

      同一个机器人收发不同微信的消息。

      1. 西瓜
        @Rat's

        2019-04-22 17:13:59,324 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:96)

        Slave channel WeChat Slave (blueset.wechat) # xigua is initialized.

        2019-04-22 17:13:59,325 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:99)

        Initializing master blueset.telegram...

        2019-04-22 17:13:59,871 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:109)

        Master channel Telegram Master (blueset.telegram) # Default profile is initialized.

        2019-04-22 17:13:59,872 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:111)

        All channels initialized.

        2019-04-22 17:13:59,872 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:125)

        All middlewares are initialized.
        1. 西瓜
          @西瓜

          Exception in thread Thread-2:
          Traceback (most recent call last):
          File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner

          self.run()

          File "/usr/lib/python3.6/threading.py", line 864, in run

          self._target(*self._args, **self._kwargs)

          File "/usr/local/lib/python3.6/dist-packages/itchat/components/login.py", line 281, in maintain_loop

          exitCallback()

          File "/usr/local/lib/python3.6/dist-packages/efb_wechat_slave/__init__.py", line 264, in exit_callback

          if not getattr(coordinator, 'master', default=None):

          TypeError: getattr() takes no keyword arguments

          2019-04-22 17:14:23,301 [ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:301)

          An uncaught error was raised while processing the update

          Traceback (most recent call last):
          File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 279, in process_update

          handler.handle_update(update, self)

          File "/usr/local/lib/python3.6/dist-packages/telegram/ext/commandhandler.py", line 173, in handle_update

          return self.callback(dispatcher.bot, update, **optional_args)

          File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/commands.py", line 132, in extra_listing

          msg += "\n\n<b>%s %s (%s)</b>" % (i.channel_emoji, i.module_name, i.module_id)

          AttributeError: 'WeChatChannel' object has no attribute 'module_name'
          ^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
          Traceback (most recent call last):
          File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown

          t.join()

          File "/usr/lib/python3.6/threading.py", line 1056, in join

          self._wait_for_tstate_lock()

          File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock

          elif lock.acquire(block, timeout):
          1. Rat's
            @西瓜

            这个问题和你说的一样吧?https://github.com/blueset/efb-telegram-master/issues/51

            1. 西瓜
              @Rat's

              不是,主要是我没办法登录两个微信。请问通过用2个机器人能不能解决这个问题呢

              1. Rat's
                @西瓜

                可以试试,不过建议一个手动,一个docker,或者2个docker,不然可能会有冲突

                1. 西瓜
                  @Rat's

                  是不是可以用两个机器人啊?不可能一个VPS只能装一个机器人吧

      2. 西瓜
        @Rat's

        我按照给的方法,其中一个加了#+ID,确实可以出现两个二维码。但是第二个二维码扫码登录虽然显示登录成功,但是实际上用不了。
        不知道哪里错了

  33. repostone

    路过,看看。

  34. 阿三

    博主你好,我在Telegram群Userid的获取那里出了点问题,我在浏览器输入好地址并回车以后显示{"ok":true,"result":[]}
    请问是哪里出了问题呢?

    1. Rat's
      @阿三

      需要你先给机器人发个消息,然后通过api查看才有数据

      1. 阿三
        @Rat's

        感谢博主,成功啦!请问二维码要保存下来吗?还有个小问题我在使用Ctrl+C断开运行后,用screen -dmS EHF ehforwarderbot这条命令不能后台运行,我用ls查看显示没在运行

        1. Rat's
          @阿三

          不需要保存,下次登录过期后会重新给二维码你登录,至于后面的,你用screen -ls就可以查看当前会话列表了,一般是没问题的。

          1. 阿三
            @Rat's

            谢谢,已经弄好了。打算晚上也把QQ的弄了。博主,我找了一下你的博客没有打赏功能吗?在你这里学习了很多想交一下学费

            1. Rat's
              @阿三

              你不说我都不知道还有这个功能,已经开了打赏功能。

  35. lexo

    博主,之前用centos7没问题,刚刚用ubuntu出现error: invalid command 'bdist_wheel',咋解决

    1. Rat's
      @lexo

      这个问题运行下pip3 install wheel命令应该就可以好了

      1. lexo
        @Rat's

        谢谢博主,解决了!

      2. 小俊
        @Rat's

        博主,我这个问题怎么解决呀?另外一篇文章,可以先加个联系方式吗?

        1. Rat's
          @小俊

          那个问题已经提示你了。

  36. lala

    用这个回复qq微信消息是真的舒服

    1. pppppplh
      @lala

      您好 您QQ的也弄好了吗 我tele一直收不到消息 但网页登录后可以看到日志

    2. Rat's
      @lala

      感觉没有自带客户端方便,除非需要同时收发多个账户,就方便很多。

      1. lala
        @Rat's

        主要是我不想打开qq微信,

  37. lala

    出来了,给力博主。两种方法很详细

  38. 小白

    之前曾经断断续续搞过,但是成功率为0,一次也没有成功过,
    各种条件不满足,感觉这种东西目前还是alfa阶段,瞎搞的东西,各种报错

    1. Rat's
      @小白

      现在已经是V2版本了,我用的时候还行,一切正常

    2. 小白
      @小白

      peewee.ImproperlyConfigured: SQLite driver not installed

      1. Rat's
        @小白

        什么系统?或者你先试试这个命令pip3 install pysqlite3

        1. 小白
          @Rat's

          换debian8 成功了,多谢博主

  39. map

    大佬什么程序或者软件可以转发QQ消息去微信?

    1. Rat's
      @map

      这个不太清楚。

  40. 半吊子的静树

    有点意思,搞个玩玩