preparing for async shit
This commit is contained in:
parent
a7f785e66b
commit
72dbd5cbab
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
irc_config.yaml
|
@ -11,3 +11,6 @@ async-native-tls = { version = "0.5.0", default-features = false, features = [ "
|
|||||||
serde = { version = "1.0.163", features = ["derive"] }
|
serde = { version = "1.0.163", features = ["derive"] }
|
||||||
serde_yaml = "0.9.21"
|
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