improved preview feature for faq and lock
This commit is contained in:
parent
6d6c2b2952
commit
bf4012f1f4
2 changed files with 24 additions and 11 deletions
|
|
@ -168,13 +168,20 @@ pub async fn preview(
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let faq = faqs.first().expect("FAQ not found");
|
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!(
|
let embed = CreateEmbed::new()
|
||||||
"```
|
.title(format!("Title: {}", &faq.title))
|
||||||
{}
|
.description(format!(
|
||||||
```",
|
"\
|
||||||
&faq.description
|
**Raw Text**\n\
|
||||||
));
|
```\n\
|
||||||
|
{}\
|
||||||
|
```\n\
|
||||||
|
**Preview:**\n\
|
||||||
|
{}",
|
||||||
|
&faq.description, embed_description
|
||||||
|
));
|
||||||
|
|
||||||
ctx.send(CreateReply::default().embed(embed)).await?;
|
ctx.send(CreateReply::default().embed(embed)).await?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,14 +188,20 @@ pub async fn preview(ctx: Context<'_>) -> Result<(), Error> {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let lock_message = lock_messages.first().expect("Lock message not found");
|
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()
|
let embed = CreateEmbed::new()
|
||||||
.title(&lock_message.title)
|
.title(format!("Title: {}", &lock_message.title))
|
||||||
.description(format!(
|
.description(format!(
|
||||||
"```
|
"\
|
||||||
{}
|
**Raw Text**\n\
|
||||||
```",
|
```\n\
|
||||||
&lock_message.description
|
{}\
|
||||||
|
```\n\
|
||||||
|
**Preview:**\n\
|
||||||
|
{}",
|
||||||
|
&lock_message.description, embed_description
|
||||||
));
|
));
|
||||||
|
|
||||||
ctx.send(CreateReply::default().embed(embed)).await?;
|
ctx.send(CreateReply::default().embed(embed)).await?;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue