codebase migration to poise

This commit is contained in:
2024-02-10 18:52:35 +01:00
parent 21fe190921
commit 6946ddc9f1
5 changed files with 206 additions and 70 deletions

View File

@@ -1,10 +1,10 @@
use serenity::{all::Message, client::Context, framework::standard::{macros::command, CommandResult}};
use crate::{Context, Error};
use crate::commands::misc::check_msg;
#[command]
async fn kashi(ctx: &Context, msg: &Message) -> CommandResult {
check_msg(msg.reply(ctx, "Kashi lyrics platform integration").await);
#[poise::command(prefix_command, slash_command)]
pub async fn kashi(ctx: Context<'_>) -> Result<(), Error> {
let response = format!("Kashi platform is currently under construction!");
ctx.say(response).await?;
Ok(())
}
}

View File

@@ -1,17 +1,16 @@
use crate::{Context, Error};
use std::time::SystemTime;
use serenity::{all::Message, client::Context, framework::standard::{macros::command, CommandResult}};
#[poise::command(prefix_command, slash_command)]
pub async fn ping(ctx: Context<'_>) -> Result<(), Error> {
let system_now = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap().as_millis() as i64;
use crate::commands::misc::check_msg;
let message_now = ctx.created_at().timestamp_millis();
#[command]
async fn ping(ctx: &Context, msg: &Message) -> CommandResult {
let system_now = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis() as i64;
let message_now = msg.timestamp.timestamp_millis();
// println!("System Time: {} ||| Message Time: {}", system_now, message_now);
check_msg(msg.reply(ctx, format!("Pong! (latency: {} ms)", system_now - message_now)).await);
let response = format!("Pong! (latency: {} ms)", system_now - message_now);
ctx.say(response).await?;
Ok(())
}
}