fix: giving negative amount of tokens to someone
This commit is contained in:
@@ -9,6 +9,11 @@ pub async fn give(ctx: Context<'_>, user: serenity::User, #[min = 1] amount: i32
|
|||||||
return Ok(());
|
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 mut tx = ctx.data().database.begin().await?;
|
||||||
|
|
||||||
let author_balance = super::get_balance(ctx.author().id, &mut *tx).await?;
|
let author_balance = super::get_balance(ctx.author().id, &mut *tx).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user