botbotbotbot / database.py
coollsd's picture
Update database.py
f49df4b verified
raw
history blame
782 Bytes
import discord
from discord import app_commands
from cash import user_cash
@app_commands.command(name="database", description="shows database")
async def database(interaction: discord.Interaction):
if not user_cash:
await interaction.response.send_message("fefef.")
return
content = "\n".join(f"{user_id} cash({amount})" for user_id, amount in user_cash.items())
# Split the content into chunks of 1900 characters to avoid Discord's message limit
chunks = [content[i:i+1900] for i in range(0, len(content), 1900)]
for i, chunk in enumerate(chunks):
if i == 0:
await interaction.response.send_message(f" database:\n```\n{chunk}\n```")
else:
await interaction.followup.send(f"```\n{chunk}\n```")