File size: 704 Bytes
ebb0b1d
 
87f59cd
ebb0b1d
87f59cd
 
 
114843b
668d7e6
780c149
 
 
 
 
 
 
 
 
668d7e6
780c149
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import discord
from discord import app_commands
from cash import user_cash, save_database

@app_commands.command(name="database", description="database")
async def database(interaction: discord.Interaction):
    save_database()
    
    try:
        with open("database.txt", "r") as f:
            content = f.read().strip()
        
        if content:
            formatted_content = "\n".join(content.split("\n"))
            
            await interaction.response.send_message(f" database:\n```\n{formatted_content}\n```")
        else:
            await interaction.response.send_message("The database is empty.")
    except FileNotFoundError:
        await interaction.response.send_message("l.")