add command to claim daily tokens

This commit is contained in:
2024-12-07 23:16:26 -05:00
parent 3bc51c858f
commit 6219dd8175
4 changed files with 47 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
pub mod balance;
pub mod give;
pub mod wager;
pub mod daily;
use crate::common::Error;
use poise::serenity_prelude::UserId;
@@ -28,4 +29,10 @@ pub async fn change_balance(id: UserId, balance: i32, db: &mut PgConnection) ->
.execute(db).await?;
Ok(())
}
pub async fn add_balance(id: UserId, amount: i32, db: &mut PgConnection) -> Result<(), Error> {
let balance = get_balance(id, db).await?;
change_balance(id, balance + amount, db).await?;
Ok(())
}