-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
添加微信支持 #448
添加微信支持 #448
Conversation
嗷目前有两个小bug
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢你的 PR!请不要忘记了在 README.md 中补充你所加入的功能的介绍。
platforms/itchat-bot.py
Outdated
import asyncio | ||
import os | ||
|
||
# 如果加到bot.py里面,就不需要这两行了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你可以参考 bot.py,在那边统一启动。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
config.wechat.example.cfg
Outdated
@@ -0,0 +1,2 @@ | |||
[itchat] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉得不需要分成多个配置文件,要不然不好管理,改动很大。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
platforms/itchat-bot.py
Outdated
return False | ||
|
||
hotReload = True # 一段时间内不用再扫码 | ||
loginCallback = init_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我们对变量使用 snake_case 命名风格。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
platforms/itchat-bot.py
Outdated
""" 监听用户消息,用于自动回复 """ | ||
# logger.info(msg) | ||
name = 'group-' + msg.fromUserName | ||
is_manager = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: 兼容触发词系统
platforms/itchat-bot.py
Outdated
@itchat.msg_register([TEXT], isFriendChat=True) | ||
def friend_reply(msg): | ||
""" 监听用户消息,用于自动回复 """ | ||
logger.info(msg.fromUserName+':'+msg.text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: 兼容触发词系统
platforms/itchat-bot.py
Outdated
|
||
logger.info('登录成功') | ||
while True: | ||
if len(request_list)>0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要用一个队列来管理所有的聊天消息? 这样会导致程序一次只能回复一个人。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那个itchat接收消息的function是sync的,但是我们的handle_message是async的,我不知道怎么办。。。
说起来这个容易封号吗 |
有道理,我找了一下,好像确实有这样的案例:https://github.com/AutumnWhj/ChatGPT-wechat-bot/issues/158( 我前一个星期用的是 https://github.com/fuergaosi233/wechat-chatgpt ,暂时还没有被封的迹象。。。 但这些是wechaty,基于javascript的,itchat我正在试。。。 |
根据我的了解,itchat 已经停止维护了…… |
确实,大佬有什么建议吗。。。 |
这方面我也不是很懂。Wechaty 似乎是收费的,免费的方案也是使用 Web 协议登录,和 itchat 基本上一样。 |
感谢大佬,我觉得我可以放弃了,哈哈 微信太坏了。。。 |
可以试下这个,https://github.com/billyplus/ntchat.git 目前还不错 |
ntchat没有 mac版本 |
利用的是itchat,运行后扫二维码登录,可短暂记住账号密码,保存在itchat.pkl中
暂无config.cfg功能实现
依赖在requirement_wechat里面
目前可以用这个运行
cd chatgpt && python3.11\python.exe itchat-bot.py