fix: giving negative amount of tokens to someone

This commit is contained in:
2024-12-09 19:46:50 -05:00
parent 55fa5e0cdb
commit 8f87907520

View File

@@ -9,6 +9,11 @@ pub async fn give(ctx: Context<'_>, user: serenity::User, #[min = 1] amount: i32
return Ok(());
}
if amount < 1 {
ctx.reply("You cannot give someone a negative amount of money (that's stealing!).").await?;
return Ok(());
}
let mut tx = ctx.data().database.begin().await?;
let author_balance = super::get_balance(ctx.author().id, &mut *tx).await?;