A Rust-based library for interacting with Stoat.
Getting Started · Examples · Stoat
Warning
This library is heavily under development. Bugs are expected.
Kaho supports a MSRV of Rust 1.76 or later.
# Add crate to your Cargo.toml
[dependencies]
kaho = "*"
tokio = { version = "*", features = ["macros", "rt-multi-thread"] }use kaho::{
client::KahoClientBuilder,
models::{GatewayEvent, MessageSend},
KahoResult,
};
#[tokio::main]
async fn main() -> KahoResult<()> {
let mut client = KahoClientBuilder::new()
.token("TOKEN")
.build()?;
client.connect().await?;
let mut events = client.events();
while let Some(Ok(event)) = events.next().await {
match event {
GatewayEvent::Message(m) if m.content == "!ping" => {
m.reply(
&client.http,
MessageSend {
content: "Pong!".into(),
..Default::default()
},
false,
)
.await?;
}
_ => {}
}
}
Ok(())
}Please refer to the LICENSE file.
