{"id":21467684,"url":"https://github.com/flpflan/bakabot","last_synced_at":"2025-07-23T17:02:13.236Z","repository":{"id":154632056,"uuid":"623994260","full_name":"flpflan/bakabot","owner":"flpflan","description":"QQ机器人“BAKA”的开源版本","archived":false,"fork":false,"pushed_at":"2023-08-28T19:10:02.000Z","size":421,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T15:39:30.756Z","etag":null,"topics":["go-cqhttp","qqbot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flpflan.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-05T14:18:45.000Z","updated_at":"2024-06-16T06:14:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"07e47850-0748-4e2b-8393-57af77ee8985","html_url":"https://github.com/flpflan/bakabot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flpflan%2Fbakabot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flpflan%2Fbakabot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flpflan%2Fbakabot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flpflan%2Fbakabot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flpflan","download_url":"https://codeload.github.com/flpflan/bakabot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243982296,"owners_count":20378606,"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":["go-cqhttp","qqbot"],"created_at":"2024-11-23T08:19:08.819Z","updated_at":"2025-03-17T06:13:14.124Z","avatar_url":"https://github.com/flpflan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"BakaBot\n==========\n前置需求\n----------\n- python \u003e=3.11\n- poetry\n- [go-cqhttp](https://github.com/Mrs4s/go-cqhttp)\n\n命令行里运行\n```\npoetry install\n```\n\n配置\n-----------\n在[config.ini](config.ini)里修改参数\n\n```ini\n[Bot]\n# bot昵称(与qq昵称无关，仅作代号使用)\nname = BAKA\n# QQ号\nqq = 123456789\n# bot所有者，最好填你自己的QQ\nsuperuser = 987654321\n# bot管理员，可以填多位，但必须填上你自己\nadministrators = [987654321]\n\n[Bot.Adapter]\n# 与go-cqhttp配置相同, 注意使用正向websocket通信\nendpoint = localhost:2333 \n```\n\n运行\n-----------\n1. 首先运行 [go-cqhttp](https://github.com/Mrs4s/go-cqhttp)\n\n2. 在命令行运行\n\n```shell\npoetry run python ./start_bot.py\n```\n\nGo-CQHTTP\n==========\nconfig.yml\n----------\n配置参考:\n\n```\n# go-cqhttp 默认配置文件\n\naccount: # 账号相关\n  uin: 0 # QQ账号\n  password: '' # 密码为空时使用扫码登录\n  encrypt: false  # 是否开启密码加密\n  status: 0      # 在线状态 请参考 https://docs.go-cqhttp.org/guide/config.html#在线状态\n  relogin: # 重连设置\n    delay: 3   # 首次重连延迟, 单位秒\n    interval: 3   # 重连间隔\n    max-times: 0  # 最大重连次数, 0为无限制\n\n  # 是否使用服务器下发的新地址进行重连\n  # 注意, 此设置可能导致在海外服务器上连接情况更差\n  use-sso-address: true\n  # 是否允许发送临时会话消息\n  allow-temp-session: false\n\nheartbeat:\n  # 心跳频率, 单位秒\n  # -1 为关闭心跳\n  interval: 5\n\nmessage:\n  # 上报数据类型\n  # 可选: string,array\n  post-format: string\n  # 是否忽略无效的CQ码, 如果为假将原样发送\n  ignore-invalid-cqcode: false\n  # 是否强制分片发送消息\n  # 分片发送将会带来更快的速度\n  # 但是兼容性会有些问题\n  force-fragment: false\n  # 是否将url分片发送\n  fix-url: false\n  # 下载图片等请求网络代理\n  proxy-rewrite: ''\n  # 是否上报自身消息\n  report-self-message: false\n  # 移除服务端的Reply附带的At\n  remove-reply-at: false\n  # 为Reply附加更多信息\n  extra-reply-data: false\n  # 跳过 Mime 扫描, 忽略错误数据\n  skip-mime-scan: false\n  # 是否自动转换 WebP 图片\n  convert-webp-image: false\n\noutput:\n  # 日志等级 trace,debug,info,warn,error\n  log-level: warn\n  # 日志时效 单位天. 超过这个时间之前的日志将会被自动删除. 设置为 0 表示永久保留.\n  log-aging: 15\n  # 是否在每次启动时强制创建全新的文件储存日志. 为 false 的情况下将会在上次启动时创建的日志文件续写\n  log-force-new: true\n  # 是否启用日志颜色\n  log-colorful: true\n  # 是否启用 DEBUG\n  debug: false # 开启调试模式\n\n# 默认中间件锚点\ndefault-middlewares: \u0026default\n  # 访问密钥, 强烈推荐在公网的服务器设置\n  access-token: ''\n  # 事件过滤器文件目录\n  filter: ''\n  # API限速设置\n  # 该设置为全局生效\n  # 原 cqhttp 虽然启用了 rate_limit 后缀, 但是基本没插件适配\n  # 目前该限速设置为令牌桶算法, 请参考:\n  # https://baike.baidu.com/item/%E4%BB%A4%E7%89%8C%E6%A1%B6%E7%AE%97%E6%B3%95/6597000?fr=aladdin\n  rate-limit:\n    enabled: false # 是否启用限速\n    frequency: 1  # 令牌回复频率, 单位秒\n    bucket: 1     # 令牌桶大小\n\ndatabase: # 数据库相关设置\n  leveldb:\n    # 是否启用内置leveldb数据库\n    # 启用将会增加10-20MB的内存占用和一定的磁盘空间\n    # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能\n    enable: true\n  sqlite3:\n    # 是否启用内置sqlite3数据库\n    # 启用将会增加一定的内存占用和一定的磁盘空间\n    # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能\n    enable: false\n    cachettl: 3600000000000 # 1h\n\n# 连接服务列表\nservers:\n  # 添加方式，同一连接方式可添加多个，具体配置说明请查看文档\n  #- http: # http 通信\n  #- ws:   # 正向 Websocket\n  #- ws-reverse: # 反向 Websocket\n  #- pprof: #性能分析服务器\n  # 正向WS设置\n  - ws:\n      # 正向WS服务器监听地址\n      address: 0.0.0.0:2333\n      middlewares:\n        \u003c\u003c: *default # 引用默认中间件\n```\n\n主要功能\n========\n\nServices\n--------\n\n- [x] 点歌\n- [x] 油库里\n- [x] B站封面获取\n- [x] 随机东方\n- [x] 随机图片\n- [x] 搜图\n- [x] 读懂世界\n- [x] 青年大学习截图生成\n- [x] pid\n- [x] emoji合成\n- [x] bv号转换\n- [x] av号转换\n- [x] 每日运势\n- [x] 每日CP\n- [ ] 查成分\n- [ ] 翻译\n- [x] [发电](https://github.com/xipesoy/zhenxun_plugin_meiriyiju)\n- [ ] 查询thb\n- [x] 选择...还是...\n- [ ] 迷你英文\n- [x] [疯狂星期四文案生成](https://github.com/whitescent/KFC-Crazy-Thursday)\n- [x] 掷骰\n- [ ] 聊天\n- [x] 入群欢迎\n- [x] 复读\n\nGames\n--------\n\u003e 用例\n\n/game + 关键词:\n\n```\n/game Akinator\n```\n\n- [x] 俄罗斯轮盘\n- [ ] 五子棋\n- [ ] 扫雷\n- [x] Akinator\n\n扩展\n--------\n\u003e 用例\n\n1. 在services目录下新建文件`foo.py`\n\n2. 编码\n\n```python\nfrom services.base import Service, ServiceBehavior, OnEvent\nfrom cqhttp.events.message import GroupMessage\nfrom cqhttp.api.message.SendGroupMsg import SendGroupMsg\n\nclass Foo(Service):\n  pass\n\nclass Bar(ServiceBehavior[Foo]):\n\n  @OnEvent[GroupMessage].add_listener\n  async def bar(self, evt: GroupMessage):\n    if evt.message == \"Hello\":\n      await SendGroupMsg(evt.group_id, \"World!\").do()\n      # 可选的非阻塞形式:\n      # SendGroupMsg(evt.group_id, \"World!\").forget()\n```\n3. 在[\\_\\_init\\_\\_.py](services/__init__.py)中添加引用\n\n```python\nfrom .foo import Foo\n```\n\n具体可参考services目录下任一service","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflpflan%2Fbakabot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflpflan%2Fbakabot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflpflan%2Fbakabot/lists"}