aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2022-02-23 12:28:31 -0500
committerGravatar GitHub <[email protected]>2022-02-23 12:28:31 -0500
commit719f94f0e437c92e1dbb7db478e35d4bb375fcfb (patch)
treef11bb1edb4434f21563e24dfb17e15d22ee5e8c1
parentMerge pull request #2078 from python-discord/chris/fix/help-channel-errors (diff)
parentfix: Make sure the regex match is not None before adding to claimaints cache (diff)
Merge pull request #2101 from python-discord/fix/help-channels-attribute-error
Make sure the regex match is not None before adding to claimaints cache
-rw-r--r--bot/exts/help_channels/_channel.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py
index ff9e6a347..ea7d972b5 100644
--- a/bot/exts/help_channels/_channel.py
+++ b/bot/exts/help_channels/_channel.py
@@ -182,9 +182,10 @@ async def ensure_cached_claimant(channel: discord.TextChannel) -> None:
if _message._match_bot_embed(message, _message.DORMANT_MSG):
log.info("Hit the dormant message embed before finding a claimant in %s (%d).", channel, channel.id)
break
- user_id = CLAIMED_BY_RE.match(message.embeds[0].description).group("user_id")
- await _caches.claimants.set(channel.id, int(user_id))
- return
+ # Only set the claimant if the first embed matches the claimed channel embed regex
+ if match := CLAIMED_BY_RE.match(message.embeds[0].description):
+ await _caches.claimants.set(channel.id, int(match.group("user_id")))
+ return
await bot.instance.get_channel(constants.Channels.helpers).send(
f"I couldn't find a claimant for {channel.mention} in that last 1000 messages. "