{"id":21103033,"url":"https://github.com/canxin121/oxidebot","last_synced_at":"2025-06-30T12:37:39.273Z","repository":{"id":253358755,"uuid":"843270512","full_name":"canxin121/oxidebot","owner":"canxin121","description":"Lightweight yet powerful chatbot framework","archived":false,"fork":false,"pushed_at":"2025-02-27T07:05:40.000Z","size":133,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T05:40:06.782Z","etag":null,"topics":["chatbot","onebot"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/canxin121.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-Apache-2.0.txt","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":"2024-08-16T06:31:49.000Z","updated_at":"2025-03-29T12:43:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"8c8bea99-fa6c-4c30-b363-920cafa50bc4","html_url":"https://github.com/canxin121/oxidebot","commit_stats":null,"previous_names":["canxin121/oxidebot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/canxin121/oxidebot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canxin121%2Foxidebot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canxin121%2Foxidebot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canxin121%2Foxidebot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canxin121%2Foxidebot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canxin121","download_url":"https://codeload.github.com/canxin121/oxidebot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canxin121%2Foxidebot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262775032,"owners_count":23362432,"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":["chatbot","onebot"],"created_at":"2024-11-19T23:57:30.162Z","updated_at":"2025-06-30T12:37:39.243Z","avatar_url":"https://github.com/canxin121.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oxidebot\n\n**Oxidebot** is a lightweight yet powerful chatbot framework based on Rust and the Tokio runtime. It aims to provide developers with a flexible and extensible environment for bot development through modular design.\n\n## Available Bots\n- [onebot_v11_oxidebot](https://github.com/canxin121/onebot_v11_oxidebot)\n- [telegram_bot_oxidebot](https://github.com/canxin121/telegram_bot_oxidebot)\n\n## Available Handlers\n- [china_unicom_oxidebot](https://github.com/canxin121/china_unicom_oxidebot)\n\n## Example Usage\n- [oxidebot_example](https://github.com/canxin121/oxidebot_example)\n\n## Core Concepts\n\n### Bot\n`Bot` is the core component of the framework, responsible for providing `Event`s and offering basic API methods for developers to call. It serves as the bridge between the framework and external platforms (such as QQ, Telegram, etc.).\n\n### Event\n`Event` is the object that the framework processes, representing the various events received by the bot. Event types include:\n\n- **MessageEvent**: Message events\n- **NoticeEvent**: Notification events\n- **RequestEvent**: Request events\n- **MetaEvent**: Meta events\n- **AnyEvent**: Generalized events\n\n### Matcher\n`Matcher` is an abstraction over `Bot` and `Event`, simplifying event handling and API calls. It provides convenient methods to extract key information from events (such as users, messages, groups) and easily call related APIs.\n\n### Handler\n`Handler` is the core component for event processing, divided into two types:\n\n- **EventHandler**: Handles incoming `Event`s and is triggered only when an event occurs.\n- **ActiveHandler**: Suitable for proactive processing scenarios, it can run continuously, execute scheduled tasks, or perform other background operations.\n\nA `Handler` can include either an `EventHandler` or an `ActiveHandler`, or both.\n\n### Filter\n`Filter` is a global event filter used to process and intercept events before they reach the `Handler`. The `Filter` has a higher priority than the `Handler`.\n\n### OxideBotManager\n`OxideBotManager` is the manager of the framework, the entry point for starting and running the bot. Developers should call its `run_block` method at the end of the `main` function to launch the entire framework along with all registered `Bot`s, `Filter`s, and `Handler`s.\n\n## Auxiliary Tools for Handler Writer\n\n### Wait\n\nInclude a restricted `BroadcastSender` that can only use `subscribe` fn in your handler\n```rust\npub struct WaitHandler {\n    pub broadcast_sender: BroadcastSender,\n}\n```\n\nAnd then use `wait` in you `HandlerTrait` impl.\nYou can find all the `wait` method in `utils::wait` or define a new one youself.\n```rust\n    let (number, matcher) = wait_user_text_generic::\u003cu8\u003e(\n        \u0026matcher,\n        \u0026self.broadcast_sender,\n        Duration::from_secs(30),\n        3,\n        Some(\"Please send a unsigned int8\".to_string()),\n    )\n    .await?;\n```\n\n## License\nMIT OR Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanxin121%2Foxidebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanxin121%2Foxidebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanxin121%2Foxidebot/lists"}