Spaces:
Building
Building
Update database.py
Browse files- database.py +14 -14
database.py
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
import discord
|
2 |
from discord import app_commands
|
3 |
-
from cash import user_cash
|
4 |
|
5 |
-
@app_commands.command(name="database", description="database")
|
6 |
async def database(interaction: discord.Interaction):
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
if content:
|
14 |
-
formatted_content = "\n".join(content.split("\n"))
|
15 |
-
|
16 |
-
await interaction.response.send_message(f" database:\n```\n{formatted_content}\n```")
|
17 |
else:
|
18 |
-
await interaction.
|
19 |
-
except FileNotFoundError:
|
20 |
-
await interaction.response.send_message("l.")
|
|
|
1 |
import discord
|
2 |
from discord import app_commands
|
3 |
+
from cash import user_cash
|
4 |
|
5 |
+
@app_commands.command(name="database", description="shows database")
|
6 |
async def database(interaction: discord.Interaction):
|
7 |
+
if not user_cash:
|
8 |
+
await interaction.response.send_message("fefef.")
|
9 |
+
return
|
10 |
+
|
11 |
+
content = "\n".join(f"{user_id} cash({amount})" for user_id, amount in user_cash.items())
|
12 |
+
|
13 |
+
# Split the content into chunks of 1900 characters to avoid Discord's message limit
|
14 |
+
chunks = [content[i:i+1900] for i in range(0, len(content), 1900)]
|
15 |
|
16 |
+
for i, chunk in enumerate(chunks):
|
17 |
+
if i == 0:
|
18 |
+
await interaction.response.send_message(f" database:\n```\n{chunk}\n```")
|
|
|
|
|
|
|
|
|
|
|
19 |
else:
|
20 |
+
await interaction.followup.send(f"```\n{chunk}\n```")
|
|
|
|