前言:继开始使用efb项目,微信从端就一直处于不稳定状态,主要原因是微信网页端的登录限制,之前靠着UOS的登录漏洞苟活一段时间,但是在今年的UOS端推出独立客户端之后这一方案也就失效了,之后可以使用微信从端的就是部分拥有网页权限的老用户了。在这个时候就需要新的微信从端,已有的比较稳定的可使用的微信接口只有wechaty,但是ipad协议高昂的价格使得只能放弃这一方案,最后只能转向pc hook方案,通过对比,最终选择了可爱猫这一比较稳定的pc hook方案。
变更日志
1. 2022/07/09 升级1.1.6.1 -> 1.1.9.12
(1)微信安装路径不需再与可爱猫同路径
(2)插件更新,文件传输可能更稳定?
(3)插件更新,可以自定义鉴权密钥
1. 配置可爱猫客户端
运行该项目需要可爱猫与efb从端在 同一局域网 或 两者均有公网IP
1.1 下载可爱猫及对应微信版本
下载链接 点击后跳转到tg消息进行下载
ihttp1.1.9.12 下载之后手动升级插件到 1.1.9.12
1.3启动可爱猫登录微信
1.4 在账号栏获取 wxid 作为 robot_wxid
1.5 在插件列表启用 iHttp 插件,双击点开设置界面,如图所示
远程处理接口格式为 http:// ip:18888/event
ip为运行efb从端所在的内网或者外网ip
1.6 新版本建议启用通信鉴权
2. 配置efb-wechat-cutecat-slave 从端
2.1 安装依赖
sudo apt-get install libopus0 ffmpeg libmagic1 python3-pip git libssl-dev
pip3 install -U git+https://github.com/0honus0/python-CuteCat-iHttp.git
pip3 install -U git+https://github.com/0honus0/efb-wechat-cutecat-slave.git
pip3 install efb-telegram-master
为启用telegram 动态Animation转gif功能,需要额外安装一下两个依赖,并安装efb-telegram-master开发版
pip3 install lottie
pip3 install cairosvg
pip3 install -U git+https://github.com/ehForwarderBot/efb-telegram-master.git
2.2 创建配置文件
mkdir -p ~/.ehforwarderbot/profiles/WeChat
mkdir -p ~/.ehforwarderbot/profiles/WeChat/blueset.telegram
mkdir -p ~/.ehforwarderbot/profiles/WeChat/honus.CuteCatiHttp
touch ~/.ehforwarderbot/profiles/WeChat/config.yaml
touch ~/.ehforwarderbot/profiles/WeChat/blueset.telegram/config.yaml
touch ~/.ehforwarderbot/profiles/WeChat/honus.CuteCatiHttp/config.yaml
建好之后的文件结构如图所示
WeChat/
├── blueset.telegram
│ └── config.yaml
├── config.yaml
└── honus.CuteCatiHttp
└── config.yaml
2.3 配置主从端
2.3.1 通过配置文件设置主端
编辑/.ehforwarderbot/profiles/WeChat/config.yaml
(设置主端为telegram,从端为微信)
master_channel: blueset.telegram
slave_channels:
- honus.CuteCatiHttp
2.3.2进行主端配置
(1) 创建机器人及配置机器人
创建一个新的 Bot,从tg向 @BotFather 发起会话。发送指令 /newbot
以启动向导。指定Bot 的名称与用户名(用户名必须以 bot 结尾)。设置完成之后可以获取token
(2) 进一步配置机器人
发送 /setprivacy
到 @BotFather,选择刚刚创建好的 Bot 用户名,然后选择 “Disable”.
发送 /setjoingroups
到 @BotFather,选择刚刚创建好的 Bot 用户名,然后选择 “Enable”.
发送 /setcommands
到 @BotFather,选择刚刚创建好的 Bot 用户名,然后发送如下内容:
link - 将会话绑定到 Telegram 群组
chat - 生成会话头
recog - 回复语音消息以进行识别
update_info - 更新群组名与头像
extra - 获取更多功能
(3) 获取Telegram ID
建议从已有bot获取
@get_id_bot 发送 /start
@GroupButler_Bot 发送 /id
@userinfobot 发送任意文字
@orzdigbot 发送 /user
编辑/.ehforwarderbot/profiles/WeChat/blueset.telegram/config.yaml
token: "12345678:QWFPGJLUYarstdheioZXCVBKM" #从tg @BotFather处获得的token
admins:
- 123456789 #设置管理员
2.3.3 进行从端配置
编辑/.ehforwarderbot/profiles/WeChat/honus.CuteCatiHttp/config.yaml
api_url: "http://127.0.0.1:8090" #可爱猫运行所在ip + port
self_url: "http://127.0.0.1:18888" #efb从端运行所在ip + port
receive_self_msg: True #接收自己发送的消息,只通知消息类型,默认为False
robot_wxid: "" #配置可爱猫时获取的 robot_wxid
access_token: "" #配置可爱猫时获取的 Authorization
label_style: True #tg端 姓名前添加#标签便于查找消息,默认为False
根据情况填写ip地址,不要无脑写127.0.0.1这样的地址,这里只是示例,填写的ip地址需要另一个程序可以访问
api_url 若是正确的,则在浏览器访问之后如图所示
self_url 若是正确的,则在浏览器访问之后如图所示
3. 启动efb
python3 -m ehforwarderbot -p WeChat
or
ehforwarderbot -p WeChat
15 条评论
网络环境有点复杂,不过最近这一个不维护了,后继出一个新版本的
root@next:/home/sora# ehforwarderbot -p WeChat
Initializing slave honus.CuteCatiHttp.../usr/local/lib/python3.9/dist-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
2022-09-13 12:26:47,962 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:129)
Traceback (most recent call last):
sys.exit(main())File "/usr/local/bin/ehforwarderbot", line 8, in
File "/usr/local/lib/python3.9/dist-packages/ehforwarderbot/__main__.py", line 335, in main
init(conf)File "/usr/local/lib/python3.9/dist-packages/ehforwarderbot/__main__.py", line 135, in init
coordinator.add_channel(cls(instance_id=instance_id))File "/usr/local/lib/python3.9/dist-packages/efb_wechat_cutecat_slave/__init__.py", line 75, in init
raise EFBException("api_url not found in config")ehforwarderbot.exceptions.EFBException: api_url not found in config
root@next:/home/sora#
大佬帮忙看看
/.ehforwarderbot/profiles/WeChat/honus.CuteCatiHttp/config.yaml
这个文件里面没有配置api_url?
哦哦大佬OK了,我把可爱猫主端和从端配置写反了
你好,能帮忙看看吗,谢谢
Initializing slave honus.CuteCatiHttp...root@DESKTOP-4G3286R:~# ehforwarderbot -p WeChat
2022-05-19 22:35:03,264 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:129)
2022-05-19 22:35:03,269 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:137)
Slave channel Wechat Pc Slave (honus.CuteCatiHttp) # Default profile is initialized.2022-05-19 22:35:03,269 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:142)
Initializing master blueset.telegram...2022-05-19 22:35:03,306 __init__.py : DEBUG Fetching friend list...
chats = module.get_chats()--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/efb_telegram_master/chat_object_cache.py", line 38, in init
File "/usr/local/lib/python3.8/dist-packages/efb_wechat_slave/__init__.py", line 349, in get_chats
return self.update_friend_info()File "/usr/local/lib/python3.8/dist-packages/efb_wechat_slave/__init__.py", line 443, in update_friend_info
return self.process_friend_info() + self.process_group_info()File "/usr/local/lib/python3.8/dist-packages/efb_wechat_slave/__init__.py", line 484, in process_friend_info
remark = friend['remark']KeyError: 'remark'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
msg = self.format(record)File "/usr/lib/python3.8/logging/__init__.py", line 1085, in emit
File "/usr/lib/python3.8/logging/__init__.py", line 929, in format
return fmt.format(record)File "/usr/lib/python3.8/logging/__init__.py", line 668, in format
record.message = record.getMessage()File "/usr/lib/python3.8/logging/__init__.py", line 373, in getMessage
msg = msg % self.argsValueError: unsupported format character ' ' (0x20) at index 42
sys.exit(main())Call stack:
File "/usr/local/bin/ehforwarderbot", line 8, in
File "/usr/local/lib/python3.8/dist-packages/ehforwarderbot/__main__.py", line 335, in main
init(conf)File "/usr/local/lib/python3.8/dist-packages/ehforwarderbot/__main__.py", line 147, in init
coordinator.add_channel(module(instance_id=instance_id))File "/usr/local/lib/python3.8/dist-packages/efb_telegram_master/__init__.py", line 125, in init
self.chat_manager: ChatObjectCacheManager = ChatObjectCacheManager(self)File "/usr/local/lib/python3.8/dist-packages/efb_telegram_master/chat_object_cache.py", line 40, in init
self.logger.exception("Error occurred while getting chats from %. "Message: 'Error occurred while getting chats from %. ETM will report no chat from this channel until further noticed.'
Master channel Telegram Master (blueset.telegram) # Default profile is initialized.Arguments: ('honus.CuteCatiHttp',)
2022-05-19 22:35:05,334 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:149)
2022-05-19 22:35:05,334 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:155)
All channels initialized.2022-05-19 22:35:05,335 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:169)
All middlewares are initialized.2022-05-19 22:35:05,338 __init__.py : DEBUG Start checking status...
Serving Flask app 'CuteCat' (lazy loading)Environment: productionWARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.Debug mode: off
Address already in use
Port 18888 is in use by another program. Either identify and stop that program, or start the server with a different port.
机器上有别的项目运行在18888端口?
返回:
ModuleNotFoundError: No module named 'efb_wechat_slave'
当使用:
pip3 install efb-wechat-slave
安装后,依然显示 ModuleNotFoundError: No module named 'efb_wechat_slave'
俺来网盘偷偷资源
在哪儿下载 可爱猫呀,上面那个地址打不开
那是一个tg链接,需要安装telegram+代理才能打开
可爱猫用wine跑在linux上吗,或者能做成docker吗?
应该是不行的
可以尝试一下,但不确认