A Onebot SDK in Rust
计划是实现 Nonebot2 的完整架构
一个基础功能完备的可扩展 Onebot SDK ,使用 Plugin 作为扩展。nbrs 本体负责与 Onebot 实现端建立连接、将 Onebot 通信转化抽象为 Event 与 Bot (可以调用 Onebot Api 的 struct),并向各 Plugin 分发、读取配置文件。
目前作为 feature 内建有 matcher (与 Nonebot 类似机制的匹配处理机制)、scheduler (定时任务) Plugin。(其实 logger 也是一个内建插件)。
目前已经有计划的 Plugin 有: nbrs_lua(lua)、nbrs_py(Python)。
API文档地址:Docs.rs
- nonebot_rs: nbrs 本体
- nbrs_no4: nbrs 实例项目
- nbrs_lua: 使用 lua 为 nbrs 编写插件 (仅最小实例可用)
- nbrs_py: nbrs Python Plugin (To-do)
- nbrs_matcher_r6s: nbrs Rainbow Six Siege 战绩查询插件
nonebot_rs
- onebot 通讯方式
- HTTP (无限期推迟)
- 正向 WS (Err 未全部处理)
- 反向 WS
- Onebot v11 标准接口实现 (使用 serde 实现)
- Onebot v12 实现 (v12 发布在即!)
- matcher
- Built-in matcher
- echo (基础应答功能)
- Rcnb (对话功能实现)
- built-in rules pre_matchers
- Built-in matcher
- config
- 基本设置
- bot 设置
- Plugin 设置
- Message 构建 API 完善
- Plugin
- 文档
- 定时任务
- 声明宏
- logger (tracing-subscriber)
nbrs_lua
- 最小实例
- More Developer-friendly api for lua
nbrs_py
- 最小实例
OneBot: 一个聊天机器人应用接口标准,旨在统一不同聊天平台上的机器人应用开发接口,使开发者只需编写一次代码即可应用到多种机器人平台。
Nonebot2: 可扩展的 Python 异步机器人框架。(本项目的思路来源与模仿对象,妈!)
开发者只是一个非专业半吊子编程爱好者,如果发现 Bug || 低效算法 || 脱裤子放屁操作,请不吝指教(务必 Issue)
简单说明一下项目运行配置
[global] # 全局设置
debug = true # 开启 debug log
superusers = ["YourID"] # 全局管理员账号
nicknames = ["nickname"] # 全局 Bot 昵称
command_starts = ["/"] # 全局命令起始符
[ws_server] # 反向 WS 服务器
host = "127.0.0.1" # 监听 host
port = 8088 # 监听 port
access_token = "AccessToken" # 连接鉴权使用
[bots.BotID] # Bot 设置
superusers = ["YourID"] # 管理员账户
nicknames = ["nickname"] # Bot 昵称
command_starts = ["/"] # 命令起始符
ws_server = "server address" # 正向 WS 服务器地址(缺省不启用正向 WS 连接)
access_token = "AccessToken" # 连接鉴权使用
global 设置所有 bot 生效,特别设置后 global 设置将被覆盖。
nbrs 最小实例请看 nonebot_rs/src/bin/minimal.rs 或 nbrs_no4/src/main.rs
matcher 声明请看 nonebot_rs/src/builtin/echo.rs
scheduler 声明可以查看 nbrs_no4/src/clock.rs
目前本项目 Api 初步稳定。