diff --git a/ahtcg_bot.py b/ahtcg_bot.py index f483d89..b762b5e 100755 --- a/ahtcg_bot.py +++ b/ahtcg_bot.py @@ -31,12 +31,14 @@ class ArkhamDBUpdater(discord.Client): async def gather_deck_ids(self, channel: discord.TextChannel) -> dict[int, str]: deck_ids: dict[int, str] = {} + url_regex = re.compile( + r'(?P.*)' + self.arkhamdb_client.origin + r'/deck/view/(?P\d+)') async for message in channel.history(limit=200, oldest_first=True): # ignore the bot's messages if message.author.id == self.user.id: continue - matches = re.finditer(r'(?P.*)' + self.arkhamdb_client.origin + r'/deck/view/(?P\d+)', message.content) + matches = url_regex.finditer(message.content) for match in matches: deck_ids[int(match.group('deck_id'))] = match.group('prefix')