preparing for async shit
This commit is contained in:
parent
a7f785e66b
commit
72dbd5cbab
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/target
|
||||
Cargo.lock
|
||||
Cargo.lock
|
||||
irc_config.yaml
|
@ -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
14
examples/hello_world.rs
Normal 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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user