Added ability to pick albums for motivation

+ clippy + fmt
This commit is contained in:
2023-09-16 10:18:47 -06:00
parent 295f2704bc
commit 8ec84ff946
3 changed files with 32 additions and 9 deletions
+14 -4
View File
@@ -59,13 +59,23 @@ pub async fn create_motivation_image(motivation: Motivation) -> Result<Vec<u8>,
#[command]
#[description("Let's give you motivation")]
async fn motivation(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
async fn motivation(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
let data = ctx.data.read().await;
let global_data = data.get::<GlobalData>().unwrap();
let motivation =
MotivationConfig::generate_motivation(&global_data.db, &global_data.cfg.img_path, "white")
.await?;
let album_name = if args.is_empty() {
None
} else {
Some(args.parse::<String>()?)
};
let motivation = MotivationConfig::generate_motivation(
&global_data.db,
&global_data.cfg.img_path,
"white",
album_name,
)
.await?;
let image = create_motivation_image(motivation).await?;
+1
View File
@@ -322,6 +322,7 @@ pub async fn restock_shop(ctx: &Context) -> Result<(), CommandError> {
&global_data.db,
&global_data.cfg.img_path,
"gold",
None,
)
.await
.unwrap();