Skip to content

reinacchi/kaho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kaho

VoidChan Logo

A Rust-based library for interacting with Stoat.

Getting Started · Examples · Stoat

Warning

This library is heavily under development. Bugs are expected.

Installation

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"] }

Ping Pong Example

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(())
}

License

Please refer to the LICENSE file.

About

A Rust-based library for interacting with Stoat.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages