diff --git a/cogs/maplist.py b/cogs/maplist.py index 6c3d6bb..6e56e9f 100644 --- a/cogs/maplist.py +++ b/cogs/maplist.py @@ -253,13 +253,20 @@ async def add_map(self, ctx, message, link, notes="", old_map=None): # Insert map into DB await message.edit(content=f"{loading} Putting `{map_name}` into the map queue...") + if not contains_version_number(map_name): + version_warning = f"\n\n{warning} Your map seems to not include a version number. You must include a version number for your map to be tested."\ + "\nThe map was still uploaded. You can use `/update` to replace it with a verision that includes a proper version number. If you did "\ + "include one, disregard this message" + else: + version_warning = "" + if old_map: old_map.url = link old_map.map = map_name if notes: old_map.notes = notes await old_map.save() - await message.edit(content=f"{success} Updated `{map_name}` successfully! Ready for testing!") + await message.edit(content=f"{success} Updated `{map_name}` successfully! Ready for testing!{version_warning}") else: await Maps.create( discord_user_handle=f"{ctx.author.name}#{ctx.author.discriminator}", @@ -270,7 +277,7 @@ async def add_map(self, ctx, message, link, notes="", old_map=None): notes=notes, added=datetime.now() ) - await message.edit(content=f"{success} Uploaded `{map_name}` successfully! Ready for testing!") + await message.edit(content=f"{success} Uploaded `{map_name}` successfully! Ready for testing!{version_warning}") @staticmethod diff --git a/utils/misc.py b/utils/misc.py index 22a047b..a861592 100644 --- a/utils/misc.py +++ b/utils/misc.py @@ -39,4 +39,8 @@ def readable_time(elapsed): if(minutes > 0): readable += str(minutes) + " minutes " - return readable \ No newline at end of file + return readable + + +def contains_version_number(map_name: str) -> bool: + return bool(re.search(r"\d|final|rc"))