From bf4012f1f481dca109b593dd661a325fe0dd5c27 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Fri, 25 Sep 2026 13:58:02 +0800 Subject: [PATCH] improved preview feature for faq and lock --- src/commands/faq.rs | 19 +++++++++++++------ src/commands/lock.rs | 16 +++++++++++----- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/commands/faq.rs b/src/commands/faq.rs index ef6afc4..e88345a 100644 --- a/src/commands/faq.rs +++ b/src/commands/faq.rs @@ -168,13 +168,20 @@ pub async fn preview( .await?; let faq = faqs.first().expect("FAQ not found"); + let embed_description = format_embed_description(&faq.description).expect("Format error"); - let embed = CreateEmbed::new().title(&faq.title).description(format!( - "``` -{} - ```", - &faq.description - )); + let embed = CreateEmbed::new() + .title(format!("Title: {}", &faq.title)) + .description(format!( + "\ + **Raw Text**\n\ + ```\n\ + {}\ + ```\n\ + **Preview:**\n\ + {}", + &faq.description, embed_description + )); ctx.send(CreateReply::default().embed(embed)).await?; diff --git a/src/commands/lock.rs b/src/commands/lock.rs index d4cede1..f4d9d07 100644 --- a/src/commands/lock.rs +++ b/src/commands/lock.rs @@ -188,14 +188,20 @@ pub async fn preview(ctx: Context<'_>) -> Result<(), Error> { .await?; let lock_message = lock_messages.first().expect("Lock message not found"); + let embed_description = + format_embed_description(&lock_message.description).expect("Format error"); let embed = CreateEmbed::new() - .title(&lock_message.title) + .title(format!("Title: {}", &lock_message.title)) .description(format!( - "``` -{} - ```", - &lock_message.description + "\ + **Raw Text**\n\ + ```\n\ + {}\ + ```\n\ + **Preview:**\n\ + {}", + &lock_message.description, embed_description )); ctx.send(CreateReply::default().embed(embed)).await?;