diff --git a/ahtcg_bot.py b/ahtcg_bot.py index 7b9ea72..3e245b7 100755 --- a/ahtcg_bot.py +++ b/ahtcg_bot.py @@ -48,6 +48,23 @@ class ArkhamDBUpdater(discord.Client): with open(self.channel_list_file, "w") as f: json.dump(list(self.channel_list), f) + @tree.command() + @app_commands.checks.cooldown(2, 60 * 5, key=lambda i: i.guild.id) + async def adbupdate(interaction: discord.Interaction) -> None: + """Immediately update the deck summary""" + await interaction.response.defer(ephemeral=True, thinking=True) + await self.update_channel_latest_decks( + self.get_channel(interaction.channel_id) + ) + await interaction.followup.send("Done with update!", ephemeral=True) + + @adbupdate.error + async def on_adbupdate_error( + interaction: discord.Interaction, error: app_commands.AppCommandError + ): + if isinstance(error, app_commands.CommandOnCooldown): + await interaction.response.send_message(str(error), ephemeral=True) + @tree.command() async def adbforget(interaction: discord.Interaction) -> None: """Remove this channel from the monitor list"""