{"id":33927366,"url":"https://github.com/onebot-walle/walle-core","last_synced_at":"2026-03-08T16:33:43.379Z","repository":{"id":37629837,"uuid":"418954170","full_name":"onebot-walle/walle-core","owner":"onebot-walle","description":"yes, another onebot lib","archived":false,"fork":false,"pushed_at":"2024-12-06T05:07:03.000Z","size":769,"stargazers_count":37,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-11-27T12:13:07.222Z","etag":null,"topics":["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/onebot-walle.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}},"created_at":"2021-10-19T14:13:10.000Z","updated_at":"2025-02-07T10:38:13.000Z","dependencies_parsed_at":"2023-12-30T04:25:38.804Z","dependency_job_id":"172e9186-48f2-4803-90e7-710c1293f619","html_url":"https://github.com/onebot-walle/walle-core","commit_stats":{"total_commits":274,"total_committers":2,"mean_commits":137.0,"dds":0.007299270072992692,"last_synced_commit":"7088d31b64f3ef1839adad4931bd75bfc2955cab"},"previous_names":["abrahum/walle-core"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/onebot-walle/walle-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onebot-walle%2Fwalle-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onebot-walle%2Fwalle-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onebot-walle%2Fwalle-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onebot-walle%2Fwalle-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onebot-walle","download_url":"https://codeload.github.com/onebot-walle/walle-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onebot-walle%2Fwalle-core/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27681503,"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","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["onebot"],"created_at":"2025-12-12T10:58:00.718Z","updated_at":"2025-12-12T10:58:04.485Z","avatar_url":"https://github.com/onebot-walle.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=center\u003e\n  \u003cimg src=\"https://github.com/abrahum/Walle-core/blob/master/logo.png\" height=\"300\" width=\"300\"\u003e\n\u003c/div\u003e\n\n# Walle-core\n\n![OneBot11](https://img.shields.io/badge/OneBot-11-black?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAMAAADxPgR5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAxQTFRF////29vbr6+vAAAAk1hCcwAAAAR0Uk5T////AEAqqfQAAAKcSURBVHja7NrbctswDATQXfD//zlpO7FlmwAWIOnOtNaTM5JwDMa8E+PNFz7g3waJ24fviyDPgfhz8fHP39cBcBL9KoJbQUxjA2iYqHL3FAnvzhL4GtVNUcoSZe6eSHizBcK5LL7dBr2AUZlev1ARRHCljzRALIEog6H3U6bCIyqIZdAT0eBuJYaGiJaHSjmkYIZd+qSGWAQnIaz2OArVnX6vrItQvbhZJtVGB5qX9wKqCMkb9W7aexfCO/rwQRBzsDIsYx4AOz0nhAtWu7bqkEQBO0Pr+Ftjt5fFCUEbm0Sbgdu8WSgJ5NgH2iu46R/o1UcBXJsFusWF/QUaz3RwJMEgngfaGGdSxJkE/Yg4lOBryBiMwvAhZrVMUUvwqU7F05b5WLaUIN4M4hRocQQRnEedgsn7TZB3UCpRrIJwQfqvGwsg18EnI2uSVNC8t+0QmMXogvbPg/xk+Mnw/6kW/rraUlvqgmFreAA09xW5t0AFlHrQZ3CsgvZm0FbHNKyBmheBKIF2cCA8A600aHPmFtRB1XvMsJAiza7LpPog0UJwccKdzw8rdf8MyN2ePYF896LC5hTzdZqxb6VNXInaupARLDNBWgI8spq4T0Qb5H4vWfPmHo8OyB1ito+AysNNz0oglj1U955sjUN9d41LnrX2D/u7eRwxyOaOpfyevCWbTgDEoilsOnu7zsKhjRCsnD/QzhdkYLBLXjiK4f3UWmcx2M7PO21CKVTH84638NTplt6JIQH0ZwCNuiWAfvuLhdrcOYPVO9eW3A67l7hZtgaY9GZo9AFc6cryjoeFBIWeU+npnk/nLE0OxCHL1eQsc1IciehjpJv5mqCsjeopaH6r15/MrxNnVhu7tmcslay2gO2Z1QfcfX0JMACG41/u0RrI9QAAAABJRU5ErkJggg==)\n![OneBot12](https://img.shields.io/badge/OneBot-12-black?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAMAAADxPgR5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAxQTFRF////29vbr6+vAAAAk1hCcwAAAAR0Uk5T////AEAqqfQAAAKcSURBVHja7NrbctswDATQXfD//zlpO7FlmwAWIOnOtNaTM5JwDMa8E+PNFz7g3waJ24fviyDPgfhz8fHP39cBcBL9KoJbQUxjA2iYqHL3FAnvzhL4GtVNUcoSZe6eSHizBcK5LL7dBr2AUZlev1ARRHCljzRALIEog6H3U6bCIyqIZdAT0eBuJYaGiJaHSjmkYIZd+qSGWAQnIaz2OArVnX6vrItQvbhZJtVGB5qX9wKqCMkb9W7aexfCO/rwQRBzsDIsYx4AOz0nhAtWu7bqkEQBO0Pr+Ftjt5fFCUEbm0Sbgdu8WSgJ5NgH2iu46R/o1UcBXJsFusWF/QUaz3RwJMEgngfaGGdSxJkE/Yg4lOBryBiMwvAhZrVMUUvwqU7F05b5WLaUIN4M4hRocQQRnEedgsn7TZB3UCpRrIJwQfqvGwsg18EnI2uSVNC8t+0QmMXogvbPg/xk+Mnw/6kW/rraUlvqgmFreAA09xW5t0AFlHrQZ3CsgvZm0FbHNKyBmheBKIF2cCA8A600aHPmFtRB1XvMsJAiza7LpPog0UJwccKdzw8rdf8MyN2ePYF896LC5hTzdZqxb6VNXInaupARLDNBWgI8spq4T0Qb5H4vWfPmHo8OyB1ito+AysNNz0oglj1U955sjUN9d41LnrX2D/u7eRwxyOaOpfyevCWbTgDEoilsOnu7zsKhjRCsnD/QzhdkYLBLXjiK4f3UWmcx2M7PO21CKVTH84638NTplt6JIQH0ZwCNuiWAfvuLhdrcOYPVO9eW3A67l7hZtgaY9GZo9AFc6cryjoeFBIWeU+npnk/nLE0OxCHL1eQsc1IciehjpJv5mqCsjeopaH6r15/MrxNnVhu7tmcslay2gO2Z1QfcfX0JMACG41/u0RrI9QAAAABJRU5ErkJggg==)\n\u003ca href=\"https://github.com/abrahum/Walle-core/blob/master/license\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/abrahum/Walle-core\" alt=\"license\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://crates.io/crates/walle-core\"\u003e\n  \u003cimg src=\"https://img.shields.io/crates/v/walle-core\"\u003e\n\u003c/a\u003e\n\n\nWalle-core 是一个 Rust OneBot Lib ( 不同于 libonebot 他同样可以应用于 OneBot 应用端 )\n\nWalle 的名字来源于机械总动员的 WALL-E ( A Rusty Bot )\n\n## 功能\n\n- 提供 OneBot v12 标准 Event、Action、ActionResp 序列化与反序列化功能，并支持自定义扩展\n- 提供 OneBot v12 实现端标准网络通讯协议\n- 提供 OneBot v12 应用端标准网络通讯协议（Http HttpWebhook 未支持）\n\n## features\n\n- http: 启用 Http 与 HttpWebhook 通讯协议\n- websocket: 启用正向 WebSocket 与反向 WebSocket 通讯协议\n- impl-obc: 启用实现端 obc\n- app-obc: 启用应用端 obc\n- alt: 启用 ColoredAlt trait 着色输出纯文本 alt\n- full: 启用所有 features\n\n## How to use\n\n仅展示最小实例\n\n### Implementation\n\n```rust\nuse std::sync::Arc;\nuse walle_core::alt::TracingHandler;\nuse walle_core::config::ImplConfig;\nuse walle_core::obc::ImplOBC;\nuse walle_core::prelude::*;\n\n#[tokio::main]\nasync fn main() {\n    tracing_subscriber::fmt::init();\n    let ob = Arc::new(OneBot::new(\n        TracingHandler::\u003cEvent, Action, Resp\u003e::default(),\n        ImplOBC::new(\"impl\".to_string()),\n        walle_core::structs::Version {\n            implt: walle_core::WALLE_CORE.to_owned(),\n            version: walle_core::VERSION.to_owned(),\n            onebot_version: 12.to_string(),\n        },\n    ));\n    ob.start((), ImplConfig::default(), true).await.unwrap();\n    // ob.wait_all().await;\n    ob.shutdown(true).await.ok();\n}\n```\n\n### Application\n\n```rust\nuse std::sync::Arc;\nuse walle_core::alt::TracingHandler;\nuse walle_core::config::AppConfig;\nuse walle_core::obc::AppOBC;\nuse walle_core::prelude::*;\n\n#[tokio::main]\nasync fn main() {\n    tracing_subscriber::fmt::init();\n    let ob = Arc::new(OneBot::new(\n        AppOBC::new(),\n        TracingHandler::\u003cEvent, Action, Resp\u003e::default(),\n        Version {\n            implt: walle_core::WALLE_CORE.to_owned(),\n            version: walle_core::VERSION.to_owned(),\n            onebot_version: 12.to_string(),\n        },\n    ));\n    ob.start(AppConfig::default(), (), true).await.unwrap();\n    // ob.wait_all().await;\n    ob.shutdown(true).await.ok();\n}\n\n```\n\n### Event\n\nwalle_core::event::Event 为序列化使用标准类型，该模型仅确保 event 基础模型各字段。\n\nwalle_core::event::BaseEvent\\\u003cT, D, S, P, I\\\u003e 为扩展模型，其中五个泛型依次为 type detail_type sub_type platform impl 五个层级的扩展字段\n\n需要实现 Event -\u003e BaseEvent 转化时，扩展字段需要 impl `TryFromEvent\u003cT\u003e` trait ，通常在应用端使用\n\n需要实现 BaseEvent -\u003e Event 转化时，扩展字段需要 impl `PushtoValueMap` 和 `ToEvent\u003cT\u003e` trait ，通常在协议端使用\n\n\u003e 其中 T 标识不同扩展级别，分别为 `TypeLevel` | `DetailTypeLevel` | `SubTypeLevel` | `PlatformLevel` | `ImplLevel`\n\n或者直接使用本 crate 提供的派生宏\n\n定义一个 type 级别扩展字段（ ob12 理论上不支持该级别扩展）:\n\n```rust\nuse walle_core::prelude::*;\n\n#[derive(ToEvent, PushToValueMap, TryFromEvent)]\n#[event(type)]\npub struct Message {\n    pub message_id: String,\n    pub message: Segments,\n    pub alt_message: String,\n    pub user_id: String,\n}\n```\n\n或者定义一个 detail_type 级别扩展字段\n\n```rust\nuse walle_core::prelude::*;\n\n#[derive(PushToValueMap, TryFromEvent, ToEvent)]\n#[event(detail_type = \"group\")]\npub struct Group_ {\n    pub group_id: String,\n}\n\n// TryFromEvent 支持 enum 类型的扩展\n#[derive(TryFromEvent)]\n#[event(detail_type)]\npub enum Details {\n    Group(walle_core::event::Group), // Group 应 impl TryFromValue\n    Private,\n}\n\n```\n\n### Action\n\nwalle_core::action::Action 为序列化使用标准类型，该模型仅确保 action 与 params 字段存在且类型正确\n\n实现 Action -\u003e BaseAction 或 Action -\u003e T 转化时，扩展字段需要 impl `TryFromAction` trait\n\n实现 BaseAction -\u003e Action 或 T -\u003e Action 转化时，扩展字段需要 impl `PushtoValueMap` 和 `ToAction` trait \n\n或者直接使用本 crate 提供的派生宏\n\n```rust\nuse walle_core::prelude::*;\n\n#[derive(ToAction, PushToValueMap, TryFromAction)]\npub struct GetFile {\n    pub file_id: String,\n    pub ty: String,\n}\n```\n\n或者\n\n```rust\nuse walle_core::prelude::*;\n\n#[derive(ToAction, TryFromAction, PushToValueMap)]\n#[action(\"upload_file\")]\npub struct UploadFile_ {\n    pub ty: String,\n    pub name: String,\n    pub url: Option\u003cString\u003e,\n    pub headers: Option\u003cstd::collections::HashMap\u003cString, String\u003e\u003e,\n    pub path: Option\u003cString\u003e,\n    pub data: Option\u003cOneBotBytes\u003e,\n    pub sha256: Option\u003cString\u003e,\n}\n```\n\n想要同时支持多种 Action ? 没问题! \n\n```rust\nuse walle_core::prelude::*;\nuse walle_core::action::GetUserInfo;\n\n#[derive(TryFromAction)]\npub enum MyAction {\n    GetUserInfo(GetUserInfo), // GetUserInfo 应 impl TryFromValue\n    GetGroupInfo { group_id: String },\n}\n```\n\n### Resp (Value)\n\nwalle_core::resp::Resp 为序列化使用标准类型\n\n同时本库还提供了 RespError 用于构造失败的 Resp，可以使用 \\\u003cResp\\\u003e.as_result() \n\n实现 Value -\u003e T 转化时，需要 impl `TryFromValue` trait\n\n实现 T -\u003e Value 转化时，需要 impl `PushToValueMap` trait (仅支持 struct )\n\n当然还是可以使用宏\n\n```rust\nuse walle_core::prelude::*;\n\n#[derive(PushToValueMap, TryFromValue)]\npub struct Status {\n    pub good: bool,\n    pub online: bool,\n}\n```\n\n同时实现了 Value 的结构体可以作为其他宏的字段使用。\n\n### MessageSegment\n\n基本与 Action 模型相同，唯一的不同是序列化使用的模型是 walle_core::message::MessageSegment，该模型同时也是一个 Value ，因此可以从 Event 或 Action 中获取。\n\n```rust\nuse walle_core::prelude::*;\n\n#[derive(PushToValueMap, TryFromMsgSegment, ToMsgSegment)]\npub struct Text {\n    pub text: String,\n}\n```\n\n### Notice\n\n由于与 Rust 保留字冲突，宏将会对以下字段自动转义：\n\n- `\"type\"` -\u003e `ty`\n- `\"impl\"` -\u003e `implt`\n- `\"self\"` -\u003e `selft`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonebot-walle%2Fwalle-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonebot-walle%2Fwalle-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonebot-walle%2Fwalle-core/lists"}