Skip to content

Commit

Permalink
updated container to use a docker volume for data
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulsender committed Jun 6, 2024
1 parent 1fc0983 commit 91e1d69
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__
.github
data/data.csv
.env
3 changes: 2 additions & 1 deletion cogs/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import csv

# get path name for csv file
file_path = os.path.join(os.getcwd(), "")
file_path = os.path.join(os.getcwd(), "data")
file_path = os.path.join(file_path, "")

class Leaderboard(commands.Cog):
def __init__(self,bot):
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ services:
image: soulsender/frong-bot:latest
environment:
- TOKEN=your_token_here
volumes:
- /frong-data:/app/data
restart: unless-stopped

7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

load_dotenv()

file_path = os.path.join(os.getcwd(), "data")
csv_file = "data.csv"
file_path = os.path.join(file_path, csv_file)

def update_csv(name, filename):
updated = False
with open(filename, 'r') as file:
Expand Down Expand Up @@ -45,7 +49,6 @@ def main():
owner_id="null",
)

csv_file = "data.csv"

# responses for the arch user replies
responses = ["",
Expand Down Expand Up @@ -101,7 +104,7 @@ async def on_message(message):
for word in frong_words:
if word.lower() in content_lower:
# increment message author frong count
update_csv(str(message.author), 'data.csv')
update_csv(str(message.author), file_path)

# send frong response
await message.channel.send('frong', files=[nextcord.File('frong.png')])
Expand Down

0 comments on commit 91e1d69

Please sign in to comment.