use chrono::Utc; use poise::{ serenity_prelude::{Mentionable, User}, CreateReply, }; use crate::{models::CtxData, Context, Error}; /// View the current time in a user's selected timezone #[poise::command(context_menu_command = "View Local Time")] pub async fn clock_context_menu(ctx: Context<'_>, user: User) -> Result<(), Error> { ctx.defer_ephemeral().await?; let user_data = ctx.user_data(user.id).await?; let tz = user_data.timezone(); let now = Utc::now().with_timezone(&tz); ctx.send(CreateReply::default().ephemeral(true).content(format!( "Time in {}'s timezone: `{}`", user.mention(), now.format("%H:%M") ))) .await?; Ok(()) }