coollsd commited on
Commit
780c149
·
verified ·
1 Parent(s): 668d7e6

Update database.py

Browse files
Files changed (1) hide show
  1. database.py +10 -3
database.py CHANGED
@@ -7,7 +7,14 @@ async def database(interaction: discord.Interaction):
7
  save_database()
8
 
9
  try:
10
- file = discord.File("database.txt", filename="database.txt")
11
- await interaction.response.send_message("database:", file=file)
 
 
 
 
 
 
 
12
  except FileNotFoundError:
13
- await interaction.response.send_message("data EMPTY.")
 
7
  save_database()
8
 
9
  try:
10
+ with open("database.txt", "r") as f:
11
+ content = f.read().strip()
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.response.send_message("The database is empty.")
19
  except FileNotFoundError:
20
+ await interaction.response.send_message("l.")