{"id":13815320,"url":"https://github.com/kurikomoe/QQ2TG","last_synced_at":"2025-05-15T07:32:37.898Z","repository":{"id":138117432,"uuid":"109481445","full_name":"kurikomoe/QQ2TG","owner":"kurikomoe","description":"QQ和Telegram消息的连通层（废弃，WebQQ 协议 1/1/19 被腾讯下线）","archived":true,"fork":false,"pushed_at":"2019-01-06T06:32:17.000Z","size":35,"stargazers_count":45,"open_issues_count":5,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-19T10:49:33.945Z","etag":null,"topics":["qq","telegram"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kurikomoe.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-11-04T09:11:12.000Z","updated_at":"2023-07-17T08:37:10.000Z","dependencies_parsed_at":"2024-01-18T02:43:07.440Z","dependency_job_id":null,"html_url":"https://github.com/kurikomoe/QQ2TG","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurikomoe%2FQQ2TG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurikomoe%2FQQ2TG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurikomoe%2FQQ2TG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurikomoe%2FQQ2TG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kurikomoe","download_url":"https://codeload.github.com/kurikomoe/QQ2TG/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254296222,"owners_count":22047226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["qq","telegram"],"created_at":"2024-08-04T04:03:19.395Z","updated_at":"2025-05-15T07:32:37.572Z","avatar_url":"https://github.com/kurikomoe.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## 更新\n1/6/19:\n废弃，WebQQ 协议 1/1/19 被腾讯下线，建议采用酷 Q 等的作为后端。\n\n# 一句话概述\n\nLinux下不管是Wine、Crossover还是虚拟机跑QQ都太麻烦了，因此写了个东西把TG和QQ连接到了一起。于是可以在TG上愉快的聊QQ了。\n\n# 具体描述\n\n为QQBot写了一个插件（不妨叫做「QQBOT_PLUGIN」），为Telegram写了一个Bot（不妨叫做「TGBOT」），通过（现阶段）Unix Socket通信，基本工作原理就是\n\nQQBot \u003c--\u003e QQBOT_PLUGIN \u003c--(Unix Socket)--\u003e TGBOT \u003c--\u003e Telegram\n\n这样子进行通信。把QQ消息转发到TG，把发送给TGBOT的消息转发到QQ。\n\n## 要点\n\n不同于关联QQ-TG群组的组件，此BOT为个人独享，直接作为TG和QQ的中间层，把一个BOT当作QQ信息的终端，以此来接受和发送信息。\n\n## 优点\n\n- 不用忍受wine系列qq的高cpu占用，不用忍受开虚拟机的费电。所有的东西都整合在TG里面，方便又开心。\n\n- 不怕别人召回了？？\n\n- TG可以和系统内置的Notification结合，实时提示新的信息，以及内容。\n\n## 缺点\n\n- 由于WebQQ本身协议的问题，因此只能接受发送文字信息（考虑到大部分时间图片，表情包都是卖萌的。。也就无所谓了，不过以后可以考虑利用酷Q实现）\n\n- 对QQBot的源代码理解不是很深入，因此目前是通过插件的形式导入进去，以后希望能把QQBot的代码内置到本项目里面，就不用分别启动了。\n\n- 掉线重连机制目前还没有实现\n\n- QQ消息全部整合到BOT中，容易看走眼？？（有几万个群的dalao估计会被刷爆的）\n\n- 目前没有过滤自己发送的信息，因为weibqq存在发送失败的可能性，因此读取自己的信息并显示出来有利于判断消息是否成功发送。\n\n# 安装\n\n## 需要安装的组件\n\n- **环境：python3**\n\n- [QQBot](https://github.com/pandolia/qqbot)：QQBot: A conversation robot base on Tencent's SmartQQ\n\n- [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot)：We have made you a wrapper you can't refuse [https://python-telegram-bot.org](https://python-telegram-bot.org)\n\n## config.py\n\n配置文件，可以建立config_user.py 修改相应的配置\n\n## qq.py\n\n作为QQBOT的Plugin载入，同时确保qq.py可以import到config.py\n\n建议把qq.py config.py config_user.py 直接ln -s 「软链接」到~/.qqbot-tmp/plugins目录下\n\n## tg.py\n\ntelegram bot，直接\n```\npython3 tg.py\n```\n就可以启动\n\n# 功能描述\n\n## 基础聊天功能\n\n通过/start开启和机器人的聊天（为了刷新username和chat_id）\n```\n基本发送消息命令\n/msg group|buddy|discuss username|qq message\n```\n\n\u003e 对于包含 space 的群名，使用下划线「_」代表空格\n\n## 快速回复功能\n\n因为每次打/msg balabala 实在是太麻烦了，于是利用TG的reply功能，可以快速回复消息\n\n具体做法：\n\n- 右键含有「name： type」的这种消息，选择reply\n\n- 直接输入要回复的信息，之后TGBOT会自动提取出要回复联系人的类型和名字，直接回复。\n\n## 启动 qqbot 的功能\n\n\u003e INFO: 这个功能目前是用 os.system 实现的，有注入的危险\n\u003e 另外需要在 config_user.py 里面添加相应的配置 QQBOT_USER_CONFIG_NAME 设置\n\n```\n启动 qqbot 的命令\n/qqbot start|stop|restart\n```\n\n配合自动发送二维码功能，以后就能超方便的重启 qqbot or 获取新的 qqbot 二维码了（因为栗子懒得登录服务器重启了。。）\n\n\u003e INFO: /start 命令会自动执行 /qqbot start\n\n## 未来的计划\n\n- 将QQBot换成酷Q？\n\n- QQBOT_PLUGIN 与 TelegramBot 通讯支持跨服务器（以后就VPS上24h不停的跑TGBOT,QQBOT看情况按需在本地或VPS上开启\n\n- /focus 系列命令\n\n 将与BOT的直接聊天转化为对focus状态的联系人的聊天。\n\n- 更多的兼容层，实现与IRC等的兼容\n\n- /block 系列命令，记录屏蔽群消息清单\n\n- /history 系列命令， 记录历史消息并显示\n\n# 鸣谢\n\n- [pandolia/qqbot](https://github.com/pandolia/qqbot) -- 逆向smartqq协议真不是人干的事儿，感谢作者的轮子\n\n- [python-telegram-bot/python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) -- 如果用raw http请求写tg bot，我大概会死吧。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurikomoe%2FQQ2TG","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkurikomoe%2FQQ2TG","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurikomoe%2FQQ2TG/lists"}