24个版本
| 0.1.23 | 2021年5月8日 | 
|---|---|
| 0.1.22 | 2021年5月7日 | 
| 0.1.20 | 2021年4月13日 | 
25 在 #消息
每月36次下载
16KB
313 代码行
dogehouse-rs
警告:仍在开发中,请勿使用
文档 在这里
示例
在Cargo.toml中
dogehouse-rs = "*"
在src/main.rs中
use dogehouse_rs::prelude::*;
use dotenv::dotenv;
use std::env;
struct Handler;
#[async_trait]
impl EventHandler for Handler {
	async fn on_message(&self, msg: String) {
		println!("{}", msg);
	}
	async fn on_pong(&self) {
		println!("Received ping")
	}
	async fn connection_closed(&self) {
		println!("Connection has closed");
		std::process::exit(1);
	}
}
#[tokio::main]
async fn main() -> Result<()> {
	dotenv().ok();
	let mut client = Client::new(
		env::var("TOKEN").unwrap(),
		env::var("REFRESH_TOKEN").unwrap()
	).add_event_handler(Handler);
	client.use_create_bot(String::from("coolbotusername")).await?;
	if let Err(err) = client.start("61d5e75b-bc42-42ea-84bc-38a205482d3f").await {
		eprintln!("Client failed to start. {}", err.to_string());
	}
	Ok(())
}
测试
cd tests/
cargo run
依赖关系
~10–24MB
~397K SLoC