From: Carl Worth Date: Fri, 23 Oct 2020 00:25:48 +0000 (-0700) Subject: Don't allow capital letters in a hunt or puzzle ID X-Git-Url: https://git.cworth.org/git?p=turbot;a=commitdiff_plain;h=f1bf3f8d0248372d0967811814e034ce53a11c9f Don't allow capital letters in a hunt or puzzle ID Since Slack won't allow them in a channel name. --- diff --git a/turbot/interaction.py b/turbot/interaction.py index 18dc4d2..d745a7a 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -12,8 +12,8 @@ actions = {} commands = {} submission_handlers = {} -# Hunt and Puzzle IDs are restricted to letters, numbers, and underscores -valid_id_re = r'^[_a-zA-Z0-9]+$' +# Hunt/Puzzle IDs are restricted to lowercase letters, numbers, and underscores +valid_id_re = r'^[_a-z0-9]+$' def bot_reply(message): """Construct a return value suitable for a bot reply @@ -92,7 +92,7 @@ def new_hunt_submission(turb, payload, metadata): # Validate that the hunt_id contains no invalid characters if not re.match(valid_id_re, hunt_id): return submission_error("hunt_id", - "Hunt ID can only contain letters, " + "Hunt ID can only contain lowercase letters, " + "numbers, and underscores") # Check to see if the hunts table exists @@ -342,7 +342,7 @@ def puzzle_submission(turb, payload, metadata): # Validate that the puzzle_id contains no invalid characters if not re.match(valid_id_re, puzzle_id): return submission_error("puzzle_id", - "Puzzle ID can only contain letters, " + "Puzzle ID can only contain lowercase letters, " + "numbers, and underscores") # Create a channel for the puzzle