Skip to content

Commit

Permalink
fix: close report button not working after the bot restart (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
pingu6 authored Sep 29, 2023
1 parent 6909433 commit d26ed54
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions chiya/cogs/apps/report_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d26ed54

Please sign in to comment.