Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit aeb63d4

Browse files
committed
persistent data with docker volume
1 parent 91e1d69 commit aeb63d4

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

cogs/leaderboard.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
# get path name for csv file
77
file_path = os.path.join(os.getcwd(), "data")
8-
file_path = os.path.join(file_path, "")
8+
csv_file = "data.csv"
9+
file_path = os.path.join(file_path, csv_file)
10+
print(file_path)
911

1012
class Leaderboard(commands.Cog):
1113
def __init__(self,bot):
@@ -15,12 +17,12 @@ def __init__(self,bot):
1517
async def on_ready(self):
1618
print(f"leaderboard - Loaded")
1719

18-
@nextcord.slash_command(name="leaderboard", description="Frong leaderboard")
20+
@nextcord.slash_command(name="leaderboard", description="Frong leaderboard", guild_ids=[414625175217242113])
1921
async def leaderboard(self, interaction: nextcord.Interaction):
2022
csv_dict = {}
2123
data = ""
2224
total = 0
23-
with open(file_path + "data.csv", 'r') as file:
25+
with open(file_path, 'r') as file:
2426
reader = csv.DictReader(file)
2527

2628
# turn csv into dictionary
@@ -44,7 +46,7 @@ async def leaderboard(self, interaction: nextcord.Interaction):
4446
embed = nextcord.Embed(title=":crown: **LEADERBOARD**", color=0xd6b509)
4547
embed.add_field(name=":speech_balloon: __FRONGS BY USER__", value=data,inline=False)
4648
embed.add_field(name=":loudspeaker: __TOTAL FRONGS__", value=total,inline=False)
47-
await interaction.response.send_message(embed=embed, ephemeral=True)
49+
await interaction.response.send_message(embed=embed, ephemeral=False)
4850

4951
def setup(bot):
5052
bot.add_cog(Leaderboard(bot))

main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
load_dotenv()
1010

11-
file_path = os.path.join(os.getcwd(), "data")
1211
csv_file = "data.csv"
12+
file_path = os.path.join(os.getcwd(), "data")
1313
file_path = os.path.join(file_path, csv_file)
14+
print(file_path)
1415

1516
def update_csv(name, filename):
1617
updated = False

0 commit comments

Comments
 (0)