Spaces:
Building
Building
File size: 782 Bytes
ebb0b1d f49df4b ebb0b1d f49df4b 87f59cd f49df4b 114843b f49df4b 780c149 f49df4b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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```")
|