From f57f67191cc06effdab016f7d7a748c14fa81be4 Mon Sep 17 00:00:00 2001 From: "k.eaven" Date: Sun, 10 Aug 2025 10:53:25 -0700 Subject: [PATCH] Improve directory architecture --- dockerfile | 4 +++- embed_locations.json => embed/embed_locations.json | 4 ++-- generate_config.py | 2 ++ pterodisbot.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) rename embed_locations.json => embed/embed_locations.json (61%) diff --git a/dockerfile b/dockerfile index 806d517..2d77c22 100644 --- a/dockerfile +++ b/dockerfile @@ -24,7 +24,9 @@ RUN useradd -m bot USER bot # Create directories for persistent storage and modify permissions -RUN mkdir -p /app/logs && chown -R bot:bot /app && chmod -R 777 /app/logs +RUN chown -R bot:bot /app +RUN mkdir -p /app/logs && chmod -R 777 /app/logs +RUN mkdir -p /app/embed && chmod -R 777 /app/embed # Set environment variables for configuration ENV PYTHONUNBUFFERED=1 diff --git a/embed_locations.json b/embed/embed_locations.json similarity index 61% rename from embed_locations.json rename to embed/embed_locations.json index 2dfd678..f65877b 100644 --- a/embed_locations.json +++ b/embed/embed_locations.json @@ -1,10 +1,10 @@ { "401095ca": { "channel_id": "1392730642206429307", - "message_id": "1404111932625260566" + "message_id": "1404158812084109423" }, "548c4f18": { "channel_id": "1392730682576343121", - "message_id": "1404111938975432725" + "message_id": "1404158818476097656" } } \ No newline at end of file diff --git a/generate_config.py b/generate_config.py index b8c5b54..2b1c6bb 100644 --- a/generate_config.py +++ b/generate_config.py @@ -1,6 +1,7 @@ import os import configparser from pathlib import Path +from dotenv import load_dotenv def validate_env_vars(): """Validate that required environment variables are set and non-empty.""" @@ -45,4 +46,5 @@ def generate_config(): print(f"Config file generated at {config_path}") if __name__ == "__main__": + load_dotenv() generate_config() diff --git a/pterodisbot.py b/pterodisbot.py index b3f3316..4d1a5cb 100644 --- a/pterodisbot.py +++ b/pterodisbot.py @@ -143,7 +143,7 @@ try: ALLOWED_GUILD_ID = config.getint('Discord', 'AllowedGuildID') REQUIRED_ROLE = "Game Server User" UPDATE_INTERVAL = 10 - EMBED_LOCATIONS_FILE = "embed_locations.json" + EMBED_LOCATIONS_FILE = "./embed/embed_locations.json" logger.debug("Loaded and validated configuration values from config.ini")