From 4e59178d9cc4e23ed4c7b40a2c672ca61e6c9843 Mon Sep 17 00:00:00 2001 From: wookie184 Date: Sat, 6 Aug 2022 19:46:17 +0100 Subject: Make handling of reviews over multiple messages more robust --- bot/exts/recruitment/talentpool/_review.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py index c3c29fa54..bd851e116 100644 --- a/bot/exts/recruitment/talentpool/_review.py +++ b/bot/exts/recruitment/talentpool/_review.py @@ -44,6 +44,10 @@ NOMINATION_MESSAGE_REGEX = re.compile( re.MULTILINE ) +# This is a constant so we can detect the final message in a nomination. Keep this in mind +# if changing this value. +REVIEW_FOOTER_MESSAGE = "*Refer to their nomination and infraction histories for further details.*" + class Reviewer: """Manages, formats, and publishes reviews of helper nominees.""" @@ -81,8 +85,9 @@ class Reviewer: review_count = 0 is_first_message = True async for msg in voting_channel.history(): - # Try and filter out any non-review messages. - if not msg.author.bot or "for Helper!" not in msg.content: + # Try and filter out any non-review messages. We also only want to count + # the final message in the case of reviews split over multiple messages. + if not msg.author.bot or REVIEW_FOOTER_MESSAGE not in msg.content: continue if is_first_message: @@ -198,7 +203,7 @@ class Reviewer: reviewed_emoji = self._random_ducky(guild) vote_request = ( - "*Refer to their nomination and infraction histories for further details*.\n" + f"{REVIEW_FOOTER_MESSAGE}.\n" f"*Please react {reviewed_emoji} once you have reviewed this user," " and react :+1: for approval, or :-1: for disapproval*." ) -- cgit v1.2.3