preparing for async shit

This commit is contained in:
wrk 2023-06-19 09:57:25 +02:00
parent a7f785e66b
commit 72dbd5cbab
4 changed files with 20 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
/target
Cargo.lock
Cargo.lock
irc_config.yaml

View File

@ -10,4 +10,7 @@ tokio = { version = "1.28.2", features = ["full"] }
async-native-tls = { version = "0.5.0", default-features = false, features = [ "runtime-tokio" ] }
serde = { version = "1.0.163", features = ["derive"] }
serde_yaml = "0.9.21"
log = "0.4.18"
log = "0.4.18"
[dev-dependencies]
env_logger = "0.10.0"

14
examples/hello_world.rs Normal file
View File

@ -0,0 +1,14 @@
use ircie::{system::IntoResponse, Irc, IrcPrefix};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let mut irc = Irc::from_config("irc_config.yaml").await?;
irc.add_system("hello", hello_world).await;
irc.run().await
}
fn hello_world(prefix: IrcPrefix) -> impl IntoResponse {
format!("Hello {}!", prefix.nick)
}