From a78c412eca35f8ba1fe883acaeac963dc9042226 Mon Sep 17 00:00:00 2001 From: zeragonii Date: Sun, 20 Oct 2024 09:22:06 +0000 Subject: [PATCH] Moved dungeon aliases to json file --- bot.py | 22 +++++++++------------- dungeon_aliases.json | 11 +++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 dungeon_aliases.json diff --git a/bot.py b/bot.py index 2e2f846..11a40d2 100644 --- a/bot.py +++ b/bot.py @@ -19,24 +19,20 @@ bot = commands.Bot(command_prefix='/', intents=intents) # File to store the LFM logs log_file = "lfm_logs.json" -# Define dungeon aliases -dungeon_aliases = { - "Ara-Kara, City of Echoes": ["ara", "city of echoes", "coe"], - "City of Threads": ["threads", "city of threads", "cot"], - "The Stonevault": ["stonevault", "vault", "sv"], - "The Dawnbreaker": ["dawnbreaker", "breaker", "dawn"], - "Mists of Tirna Scithe": ["mists", "tirna", "scithe", "mots"], - "The Necrotic Wake": ["nw", "necrotic wake", "necrotic"], - "Siege of Boralus": ["siege", "boralus", "sob"], - "Grim Batol": ["grim", "batol", "gb", "gib tatol"] -} +# Function to load dungeon aliases from a JSON file +def load_dungeon_aliases(): + with open('dungeon_aliases.json', 'r') as f: + return json.load(f) + +# Load dungeon aliases from the JSON file +dungeon_aliases = load_dungeon_aliases() # Reverse the dictionary for easier lookup dungeon_lookup = {} for full_name, aliases in dungeon_aliases.items(): for alias in aliases: - dungeon_lookup[alias] = full_name - + dungeon_lookup[alias.lower()] = full_name + # Load or create the JSON log file def load_lfm_logs(): if not os.path.exists(log_file): diff --git a/dungeon_aliases.json b/dungeon_aliases.json new file mode 100644 index 0000000..effd11f --- /dev/null +++ b/dungeon_aliases.json @@ -0,0 +1,11 @@ +{ + "Ara-Kara, City of Echoes": ["ara", "city of echoes", "coe"], + "City of Threads": ["threads", "city of threads", "cot"], + "The Stonevault": ["stonevault", "vault"], + "The Dawnbreaker": ["dawnbreaker", "breaker"], + "Mists of Tirna Scithe": ["mists", "tirna", "scithe", "mots"], + "The Necrotic Wake": ["nw", "necrotic wake", "necrotic"], + "Siege of Boralus": ["siege", "boralus", "sob"], + "Grim Batol": ["grim", "batol", "gb"] + } + \ No newline at end of file