Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cogs/maplist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ def readable_time(elapsed):
if(minutes > 0):
readable += str(minutes) + " minutes "

return readable
return readable


def contains_version_number(map_name: str) -> bool:
return bool(re.search(r"\d|final|rc"))