feat: Add bank and wallet balance commands with improved transfer validation
- Added /bank and /wallet commands to check user balances - Enhanced transfer validation to check for valid number input - Included debug token logging in main function (to be removed in production) - Added account creation logic for new users in balance commands - Improved error handling for invalid transfer amounts
This commit is contained in:
@@ -27,7 +27,11 @@ async def bank_data(user: discord.Member | discord.User) -> Dict[str, int]:
|
||||
if balance is None:
|
||||
await create_account(user)
|
||||
return await bank_data(user)
|
||||
return balance
|
||||
# Ensure we return a dictionary with WALLET and BANK keys
|
||||
return {
|
||||
"WALLET": balance.get("WALLET", 0),
|
||||
"BANK": balance.get("BANK", 0)
|
||||
}
|
||||
|
||||
|
||||
async def record_transaction(
|
||||
@@ -88,5 +92,4 @@ async def update_daily_timestamp(user: discord.User | discord.Member, timestamp:
|
||||
Updates the DAILY_TIMESTAMP field for the user in the economy table.
|
||||
Stores the timestamp as a float (UNIX time).
|
||||
"""
|
||||
db.execute_query("UPDATE economy SET DAILY = %s WHERE ID = %s",(timestamp.timestamp(), user.id),
|
||||
)
|
||||
db.execute_query("UPDATE economy SET DAILY = %s WHERE ID = %s",(timestamp.timestamp(), user.id))
|
||||
|
||||
Reference in New Issue
Block a user