discord-kurante/src/commands/heck.rs

18 lines
550 B
Rust

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;
let db_pool = db_pool.get_mut::<DbConnPool>().unwrap();
let value = db_pool.get_heck().await;
msg.channel_id
.say(ctx, format!("This command has been hecked {} times", value))
.await?;
Ok(())
}