diff options
author | 2022-08-07 14:25:46 +0100 | |
---|---|---|
committer | 2022-08-07 14:25:46 +0100 | |
commit | 52757d28aaddbb626027ded5d2b81004e069a401 (patch) | |
tree | 24315f95ccad0634ec5ca0b6e820636b9ac00452 | |
parent | Dont await tasks.loop methods (diff) |
Fix message detection and remove unused parameter
-rw-r--r-- | bot/exts/recruitment/talentpool/_cog.py | 2 | ||||
-rw-r--r-- | bot/exts/recruitment/talentpool/_review.py | 13 |
2 files changed, 6 insertions, 9 deletions
diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index e52b0f307..5956d38d5 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -34,7 +34,7 @@ class TalentPool(Cog, name="Talentpool"): def __init__(self, bot: Bot) -> None: self.bot = bot - self.reviewer = Reviewer(self.__class__.__name__, bot, self) + self.reviewer = Reviewer(bot, self) self.cache: Optional[defaultdict[dict]] = None self.api_default_params = {'active': 'true', 'ordering': '-inserted_at'} diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py index bd851e116..b7b8c3764 100644 --- a/bot/exts/recruitment/talentpool/_review.py +++ b/bot/exts/recruitment/talentpool/_review.py @@ -44,15 +44,11 @@ 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.""" - def __init__(self, name: str, bot: Bot, pool: 'TalentPool'): + def __init__(self, bot: Bot, pool: 'TalentPool'): self.bot = bot self._pool = pool @@ -86,8 +82,9 @@ class Reviewer: is_first_message = True async for msg in voting_channel.history(): # 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: + # one message from reviews split over multiple messages. We use fixed text + # from the start as any later text could be split over messages. + if not msg.author.bot or "for Helper!" not in msg.content: continue if is_first_message: @@ -203,7 +200,7 @@ class Reviewer: reviewed_emoji = self._random_ducky(guild) vote_request = ( - f"{REVIEW_FOOTER_MESSAGE}.\n" + f"*Refer to their nomination and infraction histories for further details.*\n" f"*Please react {reviewed_emoji} once you have reviewed this user," " and react :+1: for approval, or :-1: for disapproval*." ) |