Banking System Documentation
The Banking System is a comprehensive silver management solution for AlbionManager that handles both individual member balances and guild treasury accounts. This dual-layer system allows for complete financial tracking and management within your Albion Online guild.
📖 Table of Contents
- System Overview
- Dual-Layer Banking Architecture
- Player Balance System
- Guild Bank System
- Dashboard Management
- Discord Commands
- Transaction Management
- Data Structure
- Troubleshooting
🔍 System Overview
The Banking System provides a complete financial infrastructure for guild management:
- Individual Balances: Track silver for each guild member
- Guild Treasury: Manage multiple guild bank accounts
- Transaction History: Complete audit trail for all financial operations
- Web Dashboard: Visual interface for financial management
- Role-Based Access: Different permissions for different users
- BigInt Support: Handle large silver amounts without precision loss
🏦 Dual-Layer Banking Architecture
The banking system operates on two distinct but interconnected layers:
Layer 1: Player Balance System (Individual Accounts)
- Purpose: Track individual member silver balances
- Scope: One account per Discord user per guild
- Management: Admins can add/remove silver using
/silvercommands - Access: Members can check their balance using
/balance - Use Cases: Regear payments, event rewards, contribution tracking
Layer 2: Guild Bank System (Treasury Accounts)
- Purpose: Manage guild's collective silver across multiple accounts
- Scope: Multiple named accounts per guild
- Management: Admins can create accounts and manage transactions using
/bankcommands - Access: Management role required for all operations
- Use Cases: Main treasury, regear fund, event fund, emergency reserves
Critical Differences
| Aspect | Player Balances | Guild Banks |
|---|---|---|
| Command Prefix | /balance and /silver |
/bank |
| Account Structure | One per Discord user | Multiple named accounts |
| Access Level | Members can view their own | Management role required |
| Purpose | Individual rewards/payments | Guild treasury management |
| Transfer Between | Not supported | Between guild accounts only |
👤 Player Balance System
Individual Member Accounts
Every Discord user automatically gets a silver balance account when they first interact with the banking system. These accounts are completely independent of guild bank accounts.
Account Features
- Automatic Creation: Accounts created automatically when needed
- Current Balance: Available silver amount for the user
- Lifetime Balance: Total silver ever added to the account (excluding withdrawals)
- Transaction History: Complete record of all balance changes
- Cross-Guild Support: Each user has separate balances per guild
Use Cases for Player Balances
- Regear Payments: Compensate members for lost gear
- Event Rewards: Distribute rewards after successful events
- Contribution Tracking: Track member contributions to guild activities
- Performance Bonuses: Reward active or high-performing members
- Manual Adjustments: Correct errors or handle special cases
Player Balance Commands
/balance
Purpose: Check silver balance for yourself or another user
Usage: /balance [user: @username]
Access: All members can use this command
Parameters:
user(optional): Target user to check balance for
Response: Shows current balance and lifetime balance
/silver add
Purpose: Add silver to one or more users' accounts (Admin only)
Usage: /silver add users: [users] amount: [amount] reason: [reason]
Access: Requires management role or Manage Guild permission
Parameters:
users(required): Space-separated list of user mentions or IDsamount(required): Amount of silver to addreason(required): Reason for the transaction
/silver remove
Purpose: Remove silver from one or more users' accounts (Admin only)
Usage: /silver remove users: [users] amount: [amount] reason: [reason]
Access: Requires management role or Manage Guild permission
/silver set
Purpose: Set exact balance for one or more users (Admin only)
Usage: /silver set users: [users] amount: [amount] reason: [reason]
Access: Requires management role or Manage Guild permission
/silver history
Purpose: View transaction history for a user (Admin only)
Usage: /silver history user: [@user] [page: number]
Access: Requires management role or Manage Guild permission
/silver leaderboard
Purpose: Display top members by current or lifetime balance
Usage: /silver leaderboard [type: current|lifetime]
Access: All members can use this command
🏛️ Guild Bank System
Multiple Treasury Accounts
The guild bank system allows you to create multiple named accounts for different purposes. Each guild can have unlimited bank accounts, each with its own balance and transaction history.
Account Features
- Named Accounts: Each account has a unique name within the guild
- Current Balance: Available silver in the account
- Lifetime Statistics: Total added and total withdrawn
- Account Description: Optional description for account purpose
- Transaction History: Complete audit trail for all operations
- Transfer Support: Move silver between guild accounts
Common Guild Bank Account Types
- Main Treasury: Primary guild funds
- Regear Fund: Dedicated account for member regear payments
- Event Fund: Resources for organizing guild events
- Emergency Reserve: Backup funds for urgent situations
- Investment Fund: Capital for guild investments or purchases
- Donation Pool: Temporary holding for member donations
Guild Bank Commands
/bank overview
Purpose: Shows total silver balance across all guild bank accounts
Usage: /bank overview
Access: Requires management role
Response: Summary of all accounts with total balance
/bank create
Purpose: Create a new guild bank account
Usage: /bank create account_name: [name] description: [description]
Access: Requires management role
Parameters:
account_name(required): Unique name for the accountdescription(optional): Purpose or description of the account
/bank balance
Purpose: Check balance of a specific guild bank account
Usage: /bank balance account_name: [name]
Access: Requires management role
/bank add
Purpose: Add silver to a guild bank account
Usage: /bank add account_name: [name] amount: [amount] reason: [reason]
Access: Requires management role
/bank remove
Purpose: Remove silver from a guild bank account
Usage: /bank remove account_name: [name] amount: [amount] reason: [reason]
Access: Requires management role
/bank transfer
Purpose: Transfer silver between guild bank accounts
Usage: /bank transfer from_account: [name] to_account: [name] amount: [amount] reason: [reason]
Access: Requires management role
/bank history
Purpose: View transaction history for a guild bank account
Usage: /bank history account_name: [name] [page: number]
Access: Requires management role
/bank delete
Purpose: Delete a guild bank account (must be empty)
Usage: /bank delete account_name: [name]
Access: Requires management role
Warning: Account must have zero balance to be deleted
🖥️ Dashboard Management
The web dashboard provides a comprehensive interface for managing both player balances and guild bank accounts with advanced filtering, sorting, and bulk operations.
Accessing the Banking Dashboard
- Visit your bot's web interface
- Login with Discord OAuth
- Select a guild from the sidebar dropdown
- Click "Bank Management" from the guild overview
Dashboard Features
Banking Overview
The main banking page displays comprehensive statistics for both systems:
Guild Bank Statistics
- Total Guild Silver: Sum of all guild bank account balances
- Lifetime Guild Silver: Total amount ever added to guild accounts
- Guild Accounts: Number of active guild bank accounts
- Average Guild Balance: Average balance across all guild accounts
Player Balance Statistics
- Total Member Silver: Sum of all individual member balances
- Lifetime Member Silver: Total amount ever added to member accounts
- Active Members: Number of members with balance records
- Average Member Balance: Average balance across all members
Guild Bank Account Management
- Account List View: Table showing all guild bank accounts
- Balance Display: Current balance, total added, total withdrawn
- Create New Accounts: Button to create additional guild accounts
- Account Actions: View details, add/remove silver, view history
- Transfer Interface: Move silver between guild accounts
- Account Search: Find accounts by name or description
Player Balance Management
- Member List View: Table showing all member balances
- Global Search: Search by Discord username, ID, or balance amount
- Balance Sorting: Sort by current balance or lifetime balance
- Bulk Operations: Add/remove silver for multiple members
- Transaction History: View complete transaction log per member
- Export Options: Download balance data as CSV
Advanced Dashboard Features
- Real-Time Updates: Dashboard data updates automatically
- Transaction Logging: All operations logged with user attribution
- Balance Validation: Prevents negative balances and invalid operations
- Audit Trail: Complete history of all financial operations
- Permission Checks: Only authorized users can perform admin operations
- Mobile Responsive: Full functionality on mobile devices
💬 Discord Commands Summary
Player Balance Commands
| Command | Access | Purpose |
|---|---|---|
/balance |
All Members | Check user balance |
/silver add |
Admin | Add silver to user accounts |
/silver remove |
Admin | Remove silver from user accounts |
/silver set |
Admin | Set exact user balance |
/silver history |
Admin | View user transaction history |
/silver leaderboard |
All Members | View balance leaderboard |
Guild Bank Commands
| Command | Access | Purpose |
|---|---|---|
/bank overview |
Management | View all guild accounts summary |
/bank create |
Management | Create new guild bank account |
/bank balance |
Management | Check guild account balance |
/bank add |
Management | Add silver to guild account |
/bank remove |
Management | Remove silver from guild account |
/bank transfer |
Management | Transfer between guild accounts |
/bank history |
Management | View guild account history |
/bank delete |
Management | Delete empty guild account |
📋 Transaction Management
Transaction Types
The system tracks different types of transactions:
Player Balance Transactions
- Add: Silver added to user account
- Remove: Silver removed from user account
- Set: Balance set to specific amount
- Automatic: System-generated transactions (e.g., regear payments)
Guild Bank Transactions
- Deposit: Silver added to guild account
- Withdrawal: Silver removed from guild account
- Transfer In: Silver received from another guild account
- Transfer Out: Silver sent to another guild account
Transaction Data
Each transaction records:
- Amount: Silver amount (positive or negative)
- Type: Transaction type (add, remove, transfer, etc.)
- Reason: Admin-provided reason for the transaction
- Timestamp: When the transaction occurred
- Admin User: Who performed the transaction
- Balance Before/After: Account balance before and after transaction
Audit Trail
The system maintains a complete audit trail:
- Immutable Records: Transactions cannot be modified after creation
- Complete History: Every balance change is recorded
- Admin Attribution: All transactions linked to the admin who performed them
- Reason Tracking: Required reason for all admin operations
- Balance Verification: Running balance verification ensures data integrity
📊 Data Structure
Player Balance Model (BankAccount)
{
"userId": "discord_user_id",
"guildId": "discord_guild_id",
"balance": "current_silver_amount",
"totalAdded": "lifetime_silver_added",
"discordUsername": "cached_username",
"discordDiscriminator": "cached_discriminator",
"discordAvatarHash": "cached_avatar_hash",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-15T12:30:00.000Z"
}
Guild Bank Model (GuildBankAccount)
{
"id": "auto_increment_id",
"accountName": "account_display_name",
"guildId": "discord_guild_id",
"balance": "current_silver_amount",
"totalAdded": "lifetime_silver_added",
"totalWithdrawn": "lifetime_silver_withdrawn",
"description": "account_purpose_description",
"isActive": true,
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-15T12:30:00.000Z"
}
Transaction Models
Player Transaction (Transaction)
{
"id": "auto_increment_id",
"userId": "discord_user_id",
"guildId": "discord_guild_id",
"amount": "transaction_amount",
"type": "add|remove|set",
"reason": "admin_provided_reason",
"adminUserId": "admin_discord_id",
"balanceBefore": "balance_before_transaction",
"balanceAfter": "balance_after_transaction",
"createdAt": "2024-01-01T00:00:00.000Z"
}
Guild Bank Transaction (GuildBankTransaction)
{
"id": "auto_increment_id",
"accountId": "guild_bank_account_id",
"amount": "transaction_amount",
"type": "deposit|withdrawal|transfer_in|transfer_out",
"reason": "admin_provided_reason",
"adminUserId": "admin_discord_id",
"balanceBefore": "balance_before_transaction",
"balanceAfter": "balance_after_transaction",
"relatedAccountId": "for_transfers_only",
"createdAt": "2024-01-01T00:00:00.000Z"
}
Database Relationships
- BankAccount: hasMany Transaction (foreign key: userId + guildId)
- GuildBankAccount: hasMany GuildBankTransaction (foreign key: accountId)
- Cross-References: No direct relationship between player and guild systems
- Indexes: Optimized for guild-based queries and balance sorting
🔧 Troubleshooting
Common Issues
Insufficient Permissions
Symptoms: "You don't have permission" error when using banking commands
Solutions:
- Verify user has management role configured in setup
- Check if user has "Manage Guild" permission
- Ensure setup has been completed with role mappings
- Try running setup again to refresh permissions
Balance Not Updating
Symptoms: Commands succeed but balance doesn't change
Solutions:
- Check database connectivity
- Verify no validation errors in logs
- Use dashboard to confirm transaction was recorded
- Check for BigInt overflow issues with very large amounts
Guild Bank Account Not Found
Symptoms: "Account not found" error
Solutions:
- Verify account name is spelled correctly (case-sensitive)
- Use
/bank overviewto list all accounts - Check if account was deleted
- Create account using
/bank createif needed
Negative Balance Issues
Symptoms: Cannot remove silver or getting validation errors
Solutions:
- Check current balance before attempting removal
- Use
/silver setinstead of remove for zero balance - Verify amount is not larger than current balance
- Database prevents negative balances as a safety measure
Dashboard Access Issues
Symptoms: Cannot access banking dashboard
Solutions:
- Ensure Discord OAuth is working
- Check user permissions in guild
- Clear browser cache and cookies
- Verify web server is running
Large Number Display Issues
Symptoms: Very large silver amounts display incorrectly
Solutions:
- System uses BigInt for precision - this should not occur
- If it does occur, report as a bug
- Use dashboard for most accurate display
- Check for JavaScript number overflow in custom implementations
Data Recovery
If banking data is lost or corrupted:
- Check automatic database backups
- Review transaction logs for reconstruction
- Use audit trail to verify data integrity
- Contact support with specific error messages