Skip to content

Commit

Permalink
release: version 0.1.0 (#21)
Browse files Browse the repository at this point in the history
* chore: bump version

* chore: use workspace package info

* chore: add license field

* chore: use workspace

* chore: use `^0.1.0` instead
  • Loading branch information
fu050409 authored Oct 27, 2024
1 parent c2cbbe5 commit 43e8f6a
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 40 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-fmt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aionbot": patch
---

Fix formatting of the `lib.rs` file.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
[workspace]
members = ["crates/*"]
resolver = "2"

[workspace.package]
authors = ["fu050409 <[email protected]>"]
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" }
8 changes: 7 additions & 1 deletion crates/aionbot-adapter-onebot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down
8 changes: 7 additions & 1 deletion crates/aionbot-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
10 changes: 8 additions & 2 deletions crates/aionbot-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
[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"
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
13 changes: 9 additions & 4 deletions crates/aionbot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
34 changes: 3 additions & 31 deletions crates/aionbot/src/main.rs → crates/aionbot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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<Box<dyn Event>>) -> Result<String> {
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();
Expand Down Expand Up @@ -59,17 +45,3 @@ fn setup_logger() -> Result<()> {
.apply()?;
Ok(())
}

#[tokio::main]
async fn main() -> Result<()> {
setup_logger()?;

aionbot_core::runtime::Builder::<OnebotRuntime>::default()
.invoke_handler(vec![hello_world()])
.manage(State {})
.run()
.await
.expect("Failed to start the bot runtime.");

Ok(())
}

0 comments on commit 43e8f6a

Please sign in to comment.