From 43e8f6a56a8e2b55ad62e42496fdbf2230cd0720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=90=91=E5=A4=9C?= <46275354+fu050409@users.noreply.github.com> Date: Sun, 27 Oct 2024 19:30:45 +0800 Subject: [PATCH] release: version 0.1.0 (#21) * chore: bump version * chore: use workspace package info * chore: add license field * chore: use workspace * chore: use `^0.1.0` instead --- .changes/fix-fmt.md | 5 ++++ Cargo.lock | 1 - Cargo.toml | 14 ++++++++++ crates/aionbot-adapter-onebot/Cargo.toml | 8 +++++- crates/aionbot-core/Cargo.toml | 8 +++++- crates/aionbot-macros/Cargo.toml | 10 +++++-- crates/aionbot/Cargo.toml | 13 ++++++--- crates/aionbot/src/{main.rs => lib.rs} | 34 +++--------------------- 8 files changed, 53 insertions(+), 40 deletions(-) create mode 100644 .changes/fix-fmt.md rename crates/aionbot/src/{main.rs => lib.rs} (67%) diff --git a/.changes/fix-fmt.md b/.changes/fix-fmt.md new file mode 100644 index 0000000..5fa5c0f --- /dev/null +++ b/.changes/fix-fmt.md @@ -0,0 +1,5 @@ +--- +"aionbot": patch +--- + +Fix formatting of the `lib.rs` file. diff --git a/Cargo.lock b/Cargo.lock index 551ba35..6f0edf7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,7 +30,6 @@ dependencies = [ name = "aionbot" version = "0.1.0" dependencies = [ - "aionbot-adapter-onebot", "aionbot-core", "aionbot-macros", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index d767148..5d7e0c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,17 @@ [workspace] members = ["crates/*"] resolver = "2" + +[workspace.package] +authors = ["fu050409 "] +description = "Rust-based high concurrency cross platform bot runtime" +edition = "2021" +homepage = "https://github.com/noctisynth/aionbot" +readme = "README.md" +license = "AGPL-3.0-only" +repository = "https://github.com/noctisynth/aionbot" + +[workspace.dependencies] +aionbot = { version = "^0.1.0", path = "crates/aionbot" } +aionbot-core = { version = "^0.1.0", path = "crates/aionbot-core" } +aionbot-macros = { version = "^0.1.0", path = "crates/aionbot-macros" } diff --git a/crates/aionbot-adapter-onebot/Cargo.toml b/crates/aionbot-adapter-onebot/Cargo.toml index 3e7b0e9..4cc780c 100644 --- a/crates/aionbot-adapter-onebot/Cargo.toml +++ b/crates/aionbot-adapter-onebot/Cargo.toml @@ -1,7 +1,13 @@ [package] name = "aionbot-adapter-onebot" version = "0.1.0" -edition = "2021" +authors.workspace = true +description.workspace = true +edition.workspace = true +homepage.workspace = true +readme.workspace = true +repository.workspace = true +license.workspace = true [dependencies] aionbot-core = { version = "0.1.0", path = "../aionbot-core" } diff --git a/crates/aionbot-core/Cargo.toml b/crates/aionbot-core/Cargo.toml index 9006bf6..5ff2208 100644 --- a/crates/aionbot-core/Cargo.toml +++ b/crates/aionbot-core/Cargo.toml @@ -1,7 +1,13 @@ [package] name = "aionbot-core" version = "0.1.0" -edition = "2021" +authors.workspace = true +description.workspace = true +edition.workspace = true +homepage.workspace = true +readme.workspace = true +repository.workspace = true +license.workspace = true [dependencies] anyhow = "1.0.89" diff --git a/crates/aionbot-macros/Cargo.toml b/crates/aionbot-macros/Cargo.toml index 4115a46..e303448 100644 --- a/crates/aionbot-macros/Cargo.toml +++ b/crates/aionbot-macros/Cargo.toml @@ -1,7 +1,13 @@ [package] name = "aionbot-macros" version = "0.1.0" -edition = "2021" +authors.workspace = true +description.workspace = true +edition.workspace = true +homepage.workspace = true +readme.workspace = true +repository.workspace = true +license.workspace = true [dependencies] proc-macro2 = "1.0.86" @@ -9,7 +15,7 @@ quote = "1.0.37" syn = { version = "2.0.77", features = ["full"] } [dev-dependencies] -aionbot-core = { path = "../aionbot-core" } +aionbot-core.workspace = true [lib] proc-macro = true diff --git a/crates/aionbot/Cargo.toml b/crates/aionbot/Cargo.toml index fdeeba6..3b61723 100644 --- a/crates/aionbot/Cargo.toml +++ b/crates/aionbot/Cargo.toml @@ -1,12 +1,17 @@ [package] name = "aionbot" version = "0.1.0" -edition = "2021" +authors.workspace = true +description.workspace = true +edition.workspace = true +homepage.workspace = true +readme.workspace = true +repository.workspace = true +license.workspace = true [dependencies] -aionbot-adapter-onebot = { version = "0.1.0", path = "../aionbot-adapter-onebot" } -aionbot-core = { version = "0.1.0", path = "../aionbot-core" } -aionbot-macros = { version = "0.1.0", path = "../aionbot-macros" } +aionbot-core.workspace = true +aionbot-macros.workspace = true anyhow = "1.0.91" colored = "2.1.0" fern = "0.7.0" diff --git a/crates/aionbot/src/main.rs b/crates/aionbot/src/lib.rs similarity index 67% rename from crates/aionbot/src/main.rs rename to crates/aionbot/src/lib.rs index dd6c5e5..fb83a5c 100644 --- a/crates/aionbot/src/main.rs +++ b/crates/aionbot/src/lib.rs @@ -1,24 +1,10 @@ -use std::sync::Arc; +pub use aionbot_core::prelude::*; +pub use aionbot_macros::register; -use aionbot_adapter_onebot::OnebotRuntime; -use aionbot_macros::register; use anyhow::Result; - use colored::Colorize; -struct State {} - -#[register(router = ExactMatchRouter::new("/hello"))] -pub async fn hello_world(event: Arc>) -> Result { - println!( - "Event content: {}", - event.content().downcast::<&str>().unwrap() - ); - event.reply(Box::new("Hello, world!")).await?; - Ok(()) -} - -fn setup_logger() -> Result<()> { +pub fn setup_logger() -> Result<()> { fern::Dispatch::new() .format(|out, message, record| { let level = record.level().as_str(); @@ -59,17 +45,3 @@ fn setup_logger() -> Result<()> { .apply()?; Ok(()) } - -#[tokio::main] -async fn main() -> Result<()> { - setup_logger()?; - - aionbot_core::runtime::Builder::::default() - .invoke_handler(vec![hello_world()]) - .manage(State {}) - .run() - .await - .expect("Failed to start the bot runtime."); - - Ok(()) -}