use chrono::Utc; use poise::CreateReply; use serde::{Deserialize, Serialize}; use crate::{ models::CtxData, utils::{Extract, Recordable}, Context, Error, }; #[derive(Serialize, Deserialize, Extract)] pub struct Options; impl Recordable for Options { async fn run(self, ctx: Context<'_>) -> Result<(), Error> { ctx.defer_ephemeral().await?; let tz = ctx.timezone().await; let now = Utc::now().with_timezone(&tz); ctx.send(CreateReply::default().ephemeral(true).content(format!( "Time in **{}**: `{}`", tz, now.format("%H:%M") ))) .await?; Ok(()) } } /// View the current time in your selected timezone #[poise::command(slash_command, rename = "clock", identifying_name = "clock")] pub async fn command(ctx: Context<'_>) -> Result<(), Error> { (Options {}).run(ctx).await }