From e8bddc2959bfb9c0d35315320fb1a578ab593982 Mon Sep 17 00:00:00 2001 From: "Maurits van Riezen (mousetail)" Date: Tue, 28 Feb 2023 14:57:05 +0100 Subject: [PATCH 1/3] undo formatting --- cogs/maplist.py | 11 +++++++++-- utils/misc.py | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) 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..5c53780 100644 --- a/utils/misc.py +++ b/utils/misc.py @@ -39,4 +39,7 @@ 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|beta|alpha")) From b6853a136d99be06d41058b4d8d4ee36902eb4f9 Mon Sep 17 00:00:00 2001 From: "Maurits van Riezen (mousetail)" Date: Tue, 28 Feb 2023 14:57:27 +0100 Subject: [PATCH 2/3] remove alpha beta --- utils/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/misc.py b/utils/misc.py index 5c53780..d586d1b 100644 --- a/utils/misc.py +++ b/utils/misc.py @@ -42,4 +42,4 @@ def readable_time(elapsed): return readable def contains_version_number(map_name: str) -> bool: - return bool(re.search(r"\d|final|rc|beta|alpha")) + return bool(re.search(r"\d|final|rc")) From 40e12695cd808e660c0e55d377de0f804f887cfa Mon Sep 17 00:00:00 2001 From: "Maurits van Riezen (mousetail)" Date: Tue, 28 Feb 2023 15:00:25 +0100 Subject: [PATCH 3/3] extra line break --- utils/misc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/misc.py b/utils/misc.py index d586d1b..a861592 100644 --- a/utils/misc.py +++ b/utils/misc.py @@ -41,5 +41,6 @@ def readable_time(elapsed): return readable + def contains_version_number(map_name: str) -> bool: return bool(re.search(r"\d|final|rc"))