From d26ed54bb9b00b9245ebb842d5241cb771029ac6 Mon Sep 17 00:00:00 2001 From: pingu <106933377+pingu6@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:54:16 +0400 Subject: [PATCH] fix: close report button not working after the bot restart (#264) --- chiya/cogs/apps/report_message.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/chiya/cogs/apps/report_message.py b/chiya/cogs/apps/report_message.py index c83ab96d..a2587722 100644 --- a/chiya/cogs/apps/report_message.py +++ b/chiya/cogs/apps/report_message.py @@ -9,15 +9,6 @@ from chiya.utils import embeds -@commands.Cog.listener() -async def on_ready(self) -> None: - """ - Register the close report button that persists between bot - restarts. - """ - self.bot.add_view(ReportCloseButton()) - - class ReportCloseButton(discord.ui.View): def __init__(self) -> None: super().__init__(timeout=None) @@ -89,6 +80,14 @@ def __init__(self, bot) -> None: self.report_message_command = app_commands.ContextMenu(name="Report Message", callback=self.report_message) self.bot.tree.add_command(self.report_message_command) + @commands.Cog.listener() + async def on_ready(self) -> None: + """ + Register the close report button that persists between bot + restarts. + """ + self.bot.add_view(ReportCloseButton()) + @app_commands.guilds(config["guild_id"]) @app_commands.guild_only() async def report_message(self, ctx: discord.Interaction, message: discord.Message) -> None: