From b3c9ced80e642d58680adb53c8e61eb05ffc17dd Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 18 Aug 2023 13:13:01 -0400 Subject: [PATCH] fix(issues): hopefully made the modal work? --- issues/issues.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/issues/issues.py b/issues/issues.py index ccd5f64..76d753f 100644 --- a/issues/issues.py +++ b/issues/issues.py @@ -16,7 +16,8 @@ class Issues(commands.Cog): @app_commands.command() async def issuestest(self, interaction: discord.Interaction): - await interaction.response.send_message(content="Hello world!", view=self.IssueButtons(), ephemeral=True) + passed_info = interaction + await interaction.response.send_message(content="Hello world!", view=self.IssueButtons(passed_info), ephemeral=True) async def send_to_target(self, target: Union[discord.Member, discord.TextChannel], interaction: discord.Interaction, message: str, secondary_message: str = None): if isinstance(target, discord.Member): @@ -37,18 +38,19 @@ class Issues(commands.Cog): await interaction.response.send_message(content="I cannot access that channel!", ephemeral=True) class IssueButtons(discord.ui.View): + def __init__(self, passed_info): + super().__init__() + self.passed_info: discord.Interaction = passed_info + + @discord.ui.button(label="Bot Bug", style=discord.ButtonStyle.blurple) + async def issue_button_bot_bug(self, button: discord.ui.Button, interaction: discord.Interaction): + await self.passed_info.response.send_modal(Issues.BotBugModal()) + + class BotBugModal(discord.ui.Modal, title="Creating issue..."): def __init__(self): super().__init__() - @discord.ui.button(label="Yes", style=discord.ButtonStyle.success) - async def issue_button_bot(self, button: discord.ui.Button, interaction: discord.Interaction): - await interaction.response.send_modal(Issues.BotModal()) - - class BotModal(discord.ui.Modal, title="Creating issue..."): - def __init__(self): - super().__init__() - - description = discord.ui.TextInput( + bug_description = discord.ui.TextInput( label="Describe the bug", placeholder="A clear and concise description of what the bug is.", style=discord.TextStyle.paragraph, @@ -85,5 +87,5 @@ class Issues(commands.Cog): async def on_submit(self, interaction: discord.Interaction): embed = discord.Embed(title="Issue Request", color=await Issues.bot.get_embed_color(None)) - fields = [self.description, self.reproduction_steps, self.expected_behavior, self.additional_context, self.screenshots] + fields = [self.bug_description, self.reproduction_steps, self.expected_behavior, self.additional_context, self.screenshots] await Issues.send_to_target(self, self.target, interaction, self.message, self.secondary_message)