diff --git a/ahtcg_bot.py b/ahtcg_bot.py index 5929a2f..3666d0f 100755 --- a/ahtcg_bot.py +++ b/ahtcg_bot.py @@ -103,23 +103,21 @@ class ArkhamDBUpdater(commands.Bot): else: await channel.send(embed=message_embed) + async def maybe_update_channel_for_message(self, message: discord.Message) -> None: + # don't to react to the bot's changes, and only update registered channels + if message.author.id != self.user.id and \ + message.channel.id in self.channel_list: + await self.update_channel_latest_decks(message) + async def on_message(self, message: discord.Message): await self.process_commands(message) - - # we do not want the bot to reply to itself - if message.author.id == self.user.id: - return - - if message.channel.id in self.channel_list: - await self.update_channel_latest_decks(message.channel) + await self.maybe_update_channel_for_message(message) async def on_message_edit(self, before: discord.Message, after: discord.Message): - # we do not want the bot to reply to itself - if after.author.id == self.user.id: - return + await self.maybe_update_channel_for_message(after) - if after.channel.id in self.channel_list: - await self.update_channel_latest_decks(after.channel) + async def on_message_delete(self, message: discord.Message): + await self.maybe_update_channel_for_message(message) @tasks.loop(hours=1) async def arkhamdb_monitor(self) -> None: