fix(issues): hopefully made the modal work?
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6s

This commit is contained in:
Seaswimmer 2023-08-18 13:13:01 -04:00
parent 7a79809368
commit b3c9ced80e
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -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)