ricardodabest

Make me a bot called Moat & Castle Credit Union and make it look nice also some command explases like /balance /loanPay /loanRequest /planBuy /planCancel /planRenew and make the balance look like this but with our Brand this is our logo

1 image attached
Kodari AI
KodariMay 20 at 1:37 am 10,962 (v2)

Iโ€™ll create a professional Discord banking bot for Moat & Castle Credit Union with elegant embeds and financial management commands.

MoatCastleCreditUnion
A Discord banking bot simulating a credit union experience with account management, loan services, and subscription plans. Features balance checking, loan requests and payments, plan purchases, cancellations, and renewals. Uses rich embeds with professional dark teal and silver branding matching the Moat & Castle Credit Union identity. Includes persistent data storage for user accounts and transactions.

โœ… Moat & Castle Credit Union bot created!

The bot features:

  • Professional dark teal & silver branding matching your logo

  • Rich embeds with account summaries and financial details

  • 6 slash commands: /balance, /loanrequest, /loanpay, /planbuy, /plancancel, /planrenew

  • Persistent data storage using JSON database

  • 3-tier subscription system (Basic $4.99, Premium $9.99, Elite $19.99)

  • Loan management with interest rates and payment tracking

Setup:

  1. Replace your_discord_bot_token_here in .env with your actual Discord bot token

  2. Install dependencies: pip install -r requirements.txt

  3. Run the bot: python bot.py

The /balance command displays a beautiful branded embed showing current balance, available funds, active loans, and subscription plans!

ricardodabest

<redacted>

Kodari AI
KodariMay 20 at 1:45 am 2,191 (v2)

Iโ€™ll update the .env file with your Discord bot token.

โœ… Token configured! Your bot is now ready to run. Just execute:

Shell
python bot.py

The Moat & Castle Credit Union bot will come online with all your financial commands! ๐Ÿฐ๐Ÿ’ฐ

ricardodabest

can you make the loan ammount higer so u can make a request to take out inf

Kodari AI
KodariMay 20 at 1:48 am 4,621 (v2)

โœ… Loan limit increased! Users can now request loans up to $1,000,000 (effectively unlimited for most use cases). The bot will approve any loan request under that amount! ๐Ÿฆ๐Ÿ’ธ

ricardodabest

no dont approve anything make it so it make a request to some one that have this role is staff can appove it only

Kodari AI
KodariMay 20 at 1:51 am 17,772 (v2)

Iโ€™ll modify the loan system so loan requests need approval from staff members with the โ€œstaffโ€ role.

โœ… Loan approval system implemented!

Now loan requests require staff approval:

How it works:

  1. Users submit loan requests with /loanrequest <amount> <reason> - it goes into a pending queue

  2. Staff members (with โ€œstaffโ€ role) use /loanpending to see all pending requests

  3. Staff approve with /loanapprove <request_id> or reject with /loanreject <request_id> <reason>

  4. Users get notified via DM when their loan is approved or rejected

New Staff Commands:

  • /loanpending - View all pending loan requests

  • /loanapprove <request_id> - Approve a loan and deposit funds

  • /loanreject <request_id> <reason> - Reject a loan with explanation

Important: Make sure to create a role called โ€œstaffโ€ (case-insensitive) in your Discord server and assign it to authorized members! ๐Ÿฆ

ricardodabest

no like make it appre in there discord messesge so they can appove it or not

Kodari AI
KodariMay 20 at 1:57 am 40,294 (v2)

Iโ€™ll modify the system so loan requests appear as messages in Discord with Approve/Reject buttons that staff can click!

โœ… Loan approval system updated!

Now loan requests appear as Discord messages with clickable buttons for staff to approve/reject:

How it works:

  1. User submits loan with /loanrequest <amount> <reason>

  2. They get a private confirmation message

  3. A public message appears in the same channel with loan details and two buttons: โœ… Approve and โŒ Reject

  4. Staff members (with โ€œstaffโ€ role) can click the buttons to process the request

  5. When clicking Reject, a popup asks for the rejection reason

  6. The message updates automatically to show the approval/rejection

  7. The user is notified via DM with the result

Changes made:

  • Removed /loanpending, /loanapprove, and /loanreject commands (no longer needed)

  • Loan requests now post to the channel with interactive buttons

  • Staff can approve/reject directly by clicking buttons

  • Messages update in real-time with the decision

  • Cleaner, more interactive workflow!

Your bot is ready to run! ๐Ÿฐ๐Ÿ’ผ

Kodari can make mistakes. Review important code before using.
Files
.gitignore
bot.py
requirements.txt
Code
3 700
bot.py
import discord
from discord import app_commands
from discord.ext import commands
import os
from dotenv import load_dotenv
import json
from datetime import datetime, timedelta
from typing import Optional
import asyncio

load_dotenv()

intents = discord.Intents.default()
intents.message_content = True
intents.members = True

bot = commands.Bot(command_prefix='!', intents=intents)

BRAND_COLOR = 0x0D4F4F
ACCENT_COLOR = 0xC0C0C0
SUCCESS_COLOR = 0x2ECC71
ERROR_COLOR = 0xE74C3C

DATA_FILE = 'data.json'

def load_data():
    try:
        with open(DATA_FILE, 'r') as f:
            return json.load(f)
    except FileNotFoundError:
        return {'users': {}, 'pending_loans': []}

def save_data(data):
    with open(DATA_FILE, 'w') as f:
        json.dump(data, f, indent=4)

def get_user_account(user_id: str):
    data = load_data()
    if user_id not in data['users']:
        data['users'][user_id] = {
            'balance': 1000.00,
            'loans': [],
            'plan': None,
            'transaction_history': []
        }
        save_data(data)
    return data['users'][user_id]

def update_user_account(user_id: str, account_data):
    data = load_data()
    data['users'][user_id] = account_data
    save_data(data)

def create_brand_embed(title: str, description: str = None, color: int = BRAND_COLOR):
    embed = discord.Embed(
        title=title,
        description=description,
        color=color,
        timestamp=datetime.utcnow()
    )
    embed.set_footer(text="Moat & Castle Credit Union", icon_url="https://i.imgur.com/placeholder.png")
    return embed

class LoanRequestView(discord.ui.View):
    def __init__(self, request_id: int, user_id: str, amount: float, reason: str, interest_rate: float, monthly_payment: float):
        super().__init__(timeout=None)
        self.request_id = request_id
        self.user_id = user_id
        self.amount = amount
        self.reason = reason
        self.interest_rate = interest_rate
        self.monthly_payment = monthly_payment
    
    @discord.ui.button(label="Approve", style=discord.ButtonStyle.success, emoji="โœ…")
    async def approve_button(self, interaction: discord.Interaction, button: discord.ui.Button):
        # Check if user has staff role
        if not any(role.name.lower() == "staff" for role in interaction.user.roles):
            await interaction.response.send_message("โŒ Only staff members can approve loans!", ephemeral=True)
            return
        
        data = load_data()
        
        # Remove from pending loans
        data['pending_loans'] = [req for req in data.get('pending_loans', []) if req['request_id'] != self.request_id]
        
        # Add loan to user's account
        account = get_user_account(self.user_id)
        
        loan = {
            'amount': self.amount,
            'remaining': self.amount,
            'interest_rate': self.interest_rate,
            'monthly_payment': self.monthly_payment,
            'date_issued': datetime.now().strftime('%Y-%m-%d'),
            'reason': self.reason,
            'approved_by': str(interaction.user)
        }
        
        account['loans'].append(loan)
        account['balance'] += self.amount
        update_user_account(self.user_id, account)
        save_data(data)
        
        # Disable buttons
        for item in self.children:
            item.disabled = True
        
        # Update the message
        approval_embed = create_brand_embed(
            title="โœ… Loan Request APPROVED",
            description=f"This loan has been approved by {interaction.user.mention}",
            color=SUCCESS_COLOR
        )
        
        approval_embed.add_field(name="๐Ÿ‘ค Applicant", value=f"<@{self.user_id}>", inline=True)
        approval_embed.add_field(name="๐Ÿ’ต Amount", value=f"${self.amount:,.2f}", inline=True)
        approval_embed.add_field(name="๐Ÿ“ˆ Interest Rate", value=f"{self.interest_rate}%", inline=True)
        approval_embed.add_field(name="๐Ÿ“… Monthly Payment", value=f"${self.monthly_payment:,.2f}", inline=True)
        approval_embed.add_field(name="๐Ÿ“ Reason", value=self.reason, inline=False)
        approval_embed.add_field(name="โœ… Approved By", value=interaction.user.mention, inline=True)
        approval_embed.add_field(name="โฐ Approved At", value=f"<t:{int(datetime.now().timestamp())}:F>", inline=True)
        
        await interaction.response.edit_message(embed=approval_embed, view=self)
        
        # Notify the user
        try:
            user = await bot.fetch_user(int(self.user_id))
            user_embed = create_brand_embed(
                title="๐ŸŽ‰ Loan Approved!",
                description=f"Your loan request has been approved by staff!",
                color=SUCCESS_COLOR
            )
            user_embed.add_field(name="๐Ÿ’ต Loan Amount", value=f"${self.amount:,.2f}", inline=True)
            user_embed.add_field(name="๐Ÿ“ˆ Interest Rate", value=f"{self.interest_rate}%", inline=True)
            user_embed.add_field(name="๐Ÿ“… Monthly Payment", value=f"${self.monthly_payment:,.2f}", inline=True)
            user_embed.add_field(name="๐Ÿ’ฐ New Balance", value=f"${account['balance']:,.2f}", inline=False)
            user_embed.add_field(name="๐Ÿ“ Note", value="The funds have been deposited into your account. Use `/balance` to view your account.", inline=False)
            
            await user.send(embed=user_embed)
        except:
            pass
    
    @discord.ui.button(label="Reject", style=discord.ButtonStyle.danger, emoji="โŒ")
    async def reject_button(self, interaction: discord.Interaction, button: discord.ui.Button):
        # Check if user has staff role
        if not any(role.name.lower() == "staff" for role in interaction.user.roles):
            await interaction.response.send_message("โŒ Only staff members can reject loans!", ephemeral=True)
            return
        
        # Show modal to get rejection reason
        modal = RejectReasonModal(self)
        await interaction.response.send_modal(modal)

class RejectReasonModal(discord.ui.Modal, title="Reject Loan Request"):
    def __init__(self, view: LoanRequestView):
        super().__init__()
        self.view = view
    
    reason = discord.ui.TextInput(
        label="Reason for Rejection",
        placeholder="Enter the reason why this loan is being rejected...",
        style=discord.TextStyle.paragraph,
        required=True,
        max_length=500
    )
    
    async def on_submit(self, interaction: discord.Interaction):
        data = load_data()
        
        # Remove from pending loans
        data['pending_loans'] = [req for req in data.get('pending_loans', []) if req['request_id'] != self.view.request_id]
        save_data(data)
        
        # Disable buttons
        for item in self.view.children:
            item.disabled = True
        
        # Update the message
        rejection_embed = create_brand_embed(
            title="โŒ Loan Request REJECTED",
            description=f"This loan has been rejected by {interaction.user.mention}",
            color=ERROR_COLOR
        )
        
        rejection_embed.add_field(name="๐Ÿ‘ค Applicant", value=f"<@{self.view.user_id}>", inline=True)
        rejection_embed.add_field(name="๐Ÿ’ต Requested Amount", value=f"${self.view.amount:,.2f}", inline=True)
        rejection_embed.add_field(name="๐Ÿ“ Original Reason", value=self.view.reason, inline=False)
        rejection_embed.add_field(name="โŒ Rejection Reason", value=self.reason.value, inline=False)
        rejection_embed.add_field(name="โŒ Rejected By", value=interaction.user.mention, inline=True)
        rejection_embed.add_field(name="โฐ Rejected At", value=f"<t:{int(datetime.now().timestamp())}:F>", inline=True)
        
        await interaction.response.edit_message(embed=rejection_embed, view=self.view)
        
        # Notify the user
        try:
            user = await bot.fetch_user(int(self.view.user_id))
            user_embed = create_brand_embed(
                title="โŒ Loan Request Rejected",
                description=f"Your loan request has been rejected by staff.",
                color=ERROR_COLOR