fix: giving yourself tokens

This commit is contained in:
2024-12-09 19:54:33 -05:00
parent 7e7e9ad824
commit 8fd9236709

View File

@@ -14,6 +14,11 @@ pub async fn give(ctx: Context<'_>, user: serenity::User, #[min = 1] amount: i32
return Ok(()); return Ok(());
} }
if user == *ctx.author() {
ctx.reply("You cannot give yourself money!").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?;