refactor!: use poise 0.6.1
This commit is contained in:
parent
203ba111cc
commit
7252ced3cb
16 changed files with 700 additions and 512 deletions
|
@ -2,6 +2,8 @@ use crate::api::rory::get_rory;
|
|||
use crate::Context;
|
||||
|
||||
use color_eyre::eyre::Result;
|
||||
use poise::serenity_prelude::{CreateEmbed, CreateEmbedFooter};
|
||||
use poise::CreateReply;
|
||||
|
||||
/// Gets a Rory photo!
|
||||
#[poise::command(slash_command, prefix_command)]
|
||||
|
@ -11,19 +13,22 @@ pub async fn rory(
|
|||
) -> Result<()> {
|
||||
let rory = get_rory(id).await?;
|
||||
|
||||
ctx.send(|m| {
|
||||
m.embed(|e| {
|
||||
if let Some(error) = rory.error {
|
||||
e.title("Error!").description(error)
|
||||
} else {
|
||||
e.title("Rory :3")
|
||||
.url(&rory.url)
|
||||
.image(rory.url)
|
||||
.footer(|f| f.text(format!("ID {}", rory.id)))
|
||||
}
|
||||
})
|
||||
})
|
||||
.await?;
|
||||
let embed = {
|
||||
let embed = CreateEmbed::new();
|
||||
if let Some(error) = rory.error {
|
||||
embed.title("Error!").description(error)
|
||||
} else {
|
||||
let footer = CreateEmbedFooter::new(format!("ID {}", rory.id));
|
||||
embed
|
||||
.title("Rory :3")
|
||||
.url(&rory.url)
|
||||
.image(rory.url)
|
||||
.footer(footer)
|
||||
}
|
||||
};
|
||||
|
||||
let reply = CreateReply::default().embed(embed);
|
||||
ctx.send(reply).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue