diff --git a/conquest/conquest.py b/conquest/conquest.py index fa70911..2c3772c 100644 --- a/conquest/conquest.py +++ b/conquest/conquest.py @@ -1,5 +1,6 @@ import asyncio import json +import logging import os import pathlib from abc import ABC @@ -13,6 +14,8 @@ from redbot.core import Config, commands from redbot.core.bot import Red from redbot.core.data_manager import bundled_data_path, cog_data_path +log = logging.getLogger("red.fox_v3.conquest") + class Conquest(commands.Cog): """ @@ -53,14 +56,20 @@ class Conquest(commands.Cog): self.current_map = await self.config.current_map() if self.current_map: - await self.current_map_load() + if not await self.current_map_load(): + await self.config.current_map.clear() async def current_map_load(self): map_data_path = self.asset_path / self.current_map / "data.json" + if not map_data_path.exists(): + log.warning(f"{map_data_path} does not exist. Clearing current map") + return False + with map_data_path.open() as mapdata: self.map_data: dict = json.load(mapdata) self.ext = self.map_data["extension"] self.ext_format = "JPEG" if self.ext.upper() == "JPG" else self.ext.upper() + return True @commands.group() async def conquest(self, ctx: commands.Context): diff --git a/conquest/data/assets/maps.json b/conquest/data/assets/maps.json index a7d1c03..671a807 100644 --- a/conquest/data/assets/maps.json +++ b/conquest/data/assets/maps.json @@ -1,7 +1,7 @@ { "maps": [ - "simple_blank_map", - "test", - "test2" + "simple", + "ck2", + "HoI" ] } \ No newline at end of file