discord-kurante/src/commands/heck.rs

24 lines
624 B
Rust
Raw Normal View History

2020-05-02 18:37:34 +00:00
use crate::{util::debug_say, DbConnPool};
2020-05-02 02:17:53 +00:00
use serenity::framework::standard::{macros::command, CommandResult};
use serenity::model::channel::Message;
use serenity::prelude::Context;
#[command]
2020-05-02 18:37:34 +00:00
async fn heck(ctx: &Context, msg: &Message) -> CommandResult {
2020-05-02 02:17:53 +00:00
let db_pool = ctx.data.clone();
let mut db_pool = db_pool.write().await;
2020-05-02 05:04:51 +00:00
let db_pool = db_pool
.get_mut::<DbConnPool>()
.expect("No db pool in context?!");
2020-05-02 02:17:53 +00:00
let value = db_pool.get_heck().await;
2020-05-02 18:37:34 +00:00
debug_say(
msg,
ctx,
format!("This command has been hecked {} times", value?),
)
.await?;
2020-05-02 02:17:53 +00:00
Ok(())
}