Added ability to pick albums for motivation
+ clippy + fmt
This commit is contained in:
+14
-4
@@ -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?;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user