{"id":39039089,"url":"https://github.com/fantasyzhjk/onebot-ruby","last_synced_at":"2026-01-17T17:46:23.889Z","repository":{"id":39970528,"uuid":"310042148","full_name":"fantasyzhjk/onebot-ruby","owner":"fantasyzhjk","description":"用 Ruby 写 QQ 机器人！","archived":false,"fork":false,"pushed_at":"2022-08-22T07:43:21.000Z","size":333,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-04T20:34:01.505Z","etag":null,"topics":["cqhttp","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fantasyzhjk.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}},"created_at":"2020-11-04T15:26:50.000Z","updated_at":"2024-10-03T13:25:01.000Z","dependencies_parsed_at":"2022-08-21T01:50:16.016Z","dependency_job_id":null,"html_url":"https://github.com/fantasyzhjk/onebot-ruby","commit_stats":null,"previous_names":["fantasyzhjk/ruby-cqhttp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fantasyzhjk/onebot-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyzhjk%2Fonebot-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyzhjk%2Fonebot-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyzhjk%2Fonebot-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyzhjk%2Fonebot-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fantasyzhjk","download_url":"https://codeload.github.com/fantasyzhjk/onebot-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyzhjk%2Fonebot-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28513975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cqhttp","ruby"],"created_at":"2026-01-17T17:46:23.175Z","updated_at":"2026-01-17T17:46:23.859Z","avatar_url":"https://github.com/fantasyzhjk.png","language":"Ruby","readme":"# OneBot x Ruby!\n\n[![Badge](https://img.shields.io/badge/OneBot-12-black)](https://onebot.dev/)\n[![Gem Version](https://badge.fury.io/rb/ruby-cqhttp.svg)](https://badge.fury.io/rb/ruby-cqhttp)\n[![yard docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/github/fantasyzhjk/ruby-cqhttp)\n\n![图标](https://raw.githubusercontent.com/fantasyzhjk/ruby-cqhttp/main/icon.png)\n\n一个基于 OneBot 标准的 QQ 机器人框架\n\n用 Ruby 写 QQ 机器人！\n\n本库还在快速迭代更新中。。(咕了\n\n## 使用\n\n安装\n\n    $ gem install ruby-cqhttp\n\n或者\n\n在 `Gemfile` 中添加\n\n```ruby\ngem 'ruby-cqhttp'\n```\n\n然后运行\n\n    $ bundle\n\n## 示例\n\n```ruby\nrequire 'onebot-ruby'\n\nlogger = Onebot::Logging::Logger.new().setLoggerLevel(Logger::INFO) # 如果需要 logger 可以直接建立\napi = Onebot::Http::API.new().setLogger(logger)\n\nOnebot::Core.connect url: \"ws://127.0.0.1:6700\", logger: logger do |bot|\n  bot.on :logged do |botQQ|\n    logger.log('我开了欸')\n  end\n\n  bot.on :message do |data|\n    logger.log('我收到消息了欸')\n    # 复读\n    bot.sendMessage(data.message, data)\n  end\n\n  # 获取并发出好友撤回的消息\n  bot.on :notice do |notice_type, data|\n    if notice_type == 'friend_recall'\n      req = bot.get_msg(data.message_id)\n      bot.sendPrivateMessage req.message, req.sender.user_id\n    end\n  end\n  \n  # 自动同意群邀请和好友请求\n  bot.on :request do |request_type, data|\n    if request_type == 'group'\n      api.acceptGroupRequest(data.flag, data.sub_type) if data.sub_type == 'invite'\n    elsif request_type == 'friend'\n      api.acceptFriendRequest(data.flag)\n    end\n  end\nend\n```\n\n**具体使用方法请查看 examples*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffantasyzhjk%2Fonebot-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffantasyzhjk%2Fonebot-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffantasyzhjk%2Fonebot-ruby/lists"}