Bank
Deposit
The `deposit` command allows users to transfer money from their wallet to their bank account for secure storage and protection.
Command Details
- Name: deposit
- Aliases: dep
- Category: Bank
- Description: Deposit money from your wallet into your bank account for safekeeping
- Usage:
P deposit <amount>
,p deposit <amount>
, or/deposit <amount>
- Examples:
P deposit 1000
p dep all
/deposit 50000
- Cooldown: 3 seconds
- Arguments: amount (required) - The amount to deposit or "all" for entire wallet
- Slash Command: Enabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks
- User: None
- Player Requirements: None (no voice, DJ, or active player required)
Functionality
- Wallet to Bank Transfer: Safely moves coins from wallet to bank storage for protection.
- Flexible Amount Input: Accepts specific amounts or "all" keyword for complete wallet deposit.
- Balance Validation: Ensures users have sufficient wallet funds before processing deposits.
- Instant Processing: Immediately updates both wallet and bank balances in real-time.
- Transaction Confirmation: Provides clear confirmation with before/after balance display.
- Input Sanitization: Handles various input formats including commas and multipliers.
- Error Prevention: Prevents deposits of more money than available in wallet.
- Zero Validation: Prevents deposits of zero or negative amounts with appropriate messaging.
- Database Updates: Securely updates user financial records with transaction details.
- Transaction History: May log deposit transactions for user financial tracking.
- Security Benefits: Protects money from gambling losses and theft commands.
- Real-Time Updates: Immediately reflects changes in user's financial status.
Code Overview
The command is built using a Command
class structure and handles both message-based and interaction-based (slash command) inputs. It uses:
client.utils.getUser()
for retrieving current user financial data from the database.- Amount parsing and validation including "all" keyword handling and number conversion.
client.utils.formatNumber()
for displaying transaction amounts in readable formats.- Balance validation ensuring sufficient wallet funds before processing deposits.
- Database transaction updates modifying both
balance.wallet.coin
andbalance.bank.coin
values. client.embed()
creation with transaction confirmation and updated balance display.- Input sanitization handling commas, multipliers (k, m, b), and various number formats.
- Error handling for insufficient funds, invalid amounts, or database connection issues.
- Transaction success confirmation with before/after balance comparisons.
- Integration with the bot's economy system for consistent financial data management.
- Deposited money is safer from being stolen or lost
- There may be daily deposit limits depending on server settings
Permissions
- No special permissions required
- Must have money in wallet to deposit