discord-kurante/src/commands/heck.rs

23 lines
629 B
Rust
Raw Normal View History

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