From 536d14a6adab060403ec9cfc2f288bc31ed048c5 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Sun, 9 May 2021 17:50:31 +0200 Subject: Nominations: promote the mention regex to a constant --- bot/exts/recruitment/talentpool/_review.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py index b0b9061db..2df5b2496 100644 --- a/bot/exts/recruitment/talentpool/_review.py +++ b/bot/exts/recruitment/talentpool/_review.py @@ -32,6 +32,9 @@ MAX_DAYS_IN_POOL = 30 # Maximum amount of characters allowed in a message MAX_MESSAGE_SIZE = 2000 +# Regex finding the user ID of a user mention +MENTION_RE = re.compile(r"<@!?(\d+?)>") + class Reviewer: """Schedules, formats, and publishes reviews of helper nominees.""" @@ -144,7 +147,7 @@ class Reviewer: content = "".join(message_.content for message_ in messages[::-1]) # We assume that the first user mentioned is the user that we are voting on - user_id = int(re.search(r"<@!?(\d+?)>", content).group(1)) + user_id = int(MENTION_RE.search(content).group(1)) # Get reaction counts seen = await count_unique_users_reaction( -- cgit v1.2.3