From aeb63d4317d83fc09c21c70c29bde41be8a5fd43 Mon Sep 17 00:00:00 2001 From: Soulsender Date: Thu, 6 Jun 2024 14:21:33 -0700 Subject: [PATCH] persistent data with docker volume --- cogs/leaderboard.py | 10 ++++++---- main.py | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cogs/leaderboard.py b/cogs/leaderboard.py index 8734ab0..da76466 100644 --- a/cogs/leaderboard.py +++ b/cogs/leaderboard.py @@ -5,7 +5,9 @@ # get path name for csv file file_path = os.path.join(os.getcwd(), "data") -file_path = os.path.join(file_path, "") +csv_file = "data.csv" +file_path = os.path.join(file_path, csv_file) +print(file_path) class Leaderboard(commands.Cog): def __init__(self,bot): @@ -15,12 +17,12 @@ def __init__(self,bot): async def on_ready(self): print(f"leaderboard - Loaded") - @nextcord.slash_command(name="leaderboard", description="Frong leaderboard") + @nextcord.slash_command(name="leaderboard", description="Frong leaderboard", guild_ids=[414625175217242113]) async def leaderboard(self, interaction: nextcord.Interaction): csv_dict = {} data = "" total = 0 - with open(file_path + "data.csv", 'r') as file: + with open(file_path, 'r') as file: reader = csv.DictReader(file) # turn csv into dictionary @@ -44,7 +46,7 @@ async def leaderboard(self, interaction: nextcord.Interaction): embed = nextcord.Embed(title=":crown: **LEADERBOARD**", color=0xd6b509) embed.add_field(name=":speech_balloon: __FRONGS BY USER__", value=data,inline=False) embed.add_field(name=":loudspeaker: __TOTAL FRONGS__", value=total,inline=False) - await interaction.response.send_message(embed=embed, ephemeral=True) + await interaction.response.send_message(embed=embed, ephemeral=False) def setup(bot): bot.add_cog(Leaderboard(bot)) \ No newline at end of file diff --git a/main.py b/main.py index abaa7a7..376db1c 100644 --- a/main.py +++ b/main.py @@ -8,9 +8,10 @@ load_dotenv() -file_path = os.path.join(os.getcwd(), "data") csv_file = "data.csv" +file_path = os.path.join(os.getcwd(), "data") file_path = os.path.join(file_path, csv_file) +print(file_path) def update_csv(name, filename): updated = False