Updated motivations to use new randoms

+ Handle task failures more gracefully
This commit is contained in:
joeyahines committed 2024-04-13 14:54:23 -06:00
1 parent f5ec1cd000
commit 2f7954632d
10 files changed
+76 -70

No files matched your search

+2 -2
View File
@@ -79,9 +79,9 @@ pub async fn list_birthdays(ctx: &Context, msg: &Message) -> CommandResult {
msg_builder.push_bold_line("All the birthdays I know:");
for birthday in birthdays {
let user_id = UserId::from(birthday.discord_id);
let user = user_id.to_user(&ctx.http).await?;
msg_builder.push_line(format!(
"* {} {}",
user.name,
+1 -36
View File
@@ -10,12 +10,7 @@ use serenity::model::channel::Message;
use std::borrow::Cow;
#[group]
#[commands(
motivation,
motivation_add_album,
motivation_add_action,
motivation_add_goal
)]
#[commands(motivation, motivation_add_album)]
pub struct Motivate;
pub async fn create_motivation_image(motivation: Motivation) -> Result<Vec<u8>, CommandError> {
@@ -132,33 +127,3 @@ async fn motivation_add_album(ctx: &Context, msg: &Message, args: Args) -> Comma
Ok(())
}
#[command]
#[description("Add an action to the motivation generator")]
async fn motivation_add_action(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
let data = ctx.data.read().await;
let global_data = data.get::<GlobalData>().unwrap();
let action = args.rest();
MotivationConfig::add_action(&global_data.db, action)?;
msg.reply(&ctx.http, "Done ;)").await?;
Ok(())
}
#[command]
#[description("Add goal to the motivation generator")]
async fn motivation_add_goal(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
let data = ctx.data.read().await;
let global_data = data.get::<GlobalData>().unwrap();
let goal = args.rest();
MotivationConfig::add_goal(&global_data.db, goal)?;
msg.reply(&ctx.http, "Done ;)").await?;
Ok(())
}