fix(issues): reverted modal to older version for testing purposes

This commit is contained in:
Seaswimmer 2023-08-18 14:30:16 -04:00
parent 88ce09cb2d
commit 83b7c3f17e
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -44,89 +44,56 @@ class Issues(commands.Cog):
@discord.ui.button(label="Bot Bug", style=discord.ButtonStyle.danger, row=0) @discord.ui.button(label="Bot Bug", style=discord.ButtonStyle.danger, row=0)
async def issue_button_bot_bug(self, interaction: discord.Interaction, button: discord.ui.Button): async def issue_button_bot_bug(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_modal(Issues.IssuesModal(button_id="bot_bug")) await interaction.response.send_modal(Issues.BotBugModal())
@discord.ui.button(label="Cog Bug", style=discord.ButtonStyle.danger, row=1) @discord.ui.button(label="Cog Bug", style=discord.ButtonStyle.danger, row=1)
async def issue_button_cog_bug(self, interaction: discord.Interaction, button: discord.ui.Button): async def issue_button_cog_bug(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_modal(Issues.IssuesModal(button_id="cog_bug")) await interaction.response.send_modal(Issues.BotBugModal())
@discord.ui.button(label="Bot Suggestion", style=discord.ButtonStyle.blurple, row=0) @discord.ui.button(label="Bot Suggestion", style=discord.ButtonStyle.blurple, row=0)
async def issue_button_bot_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): async def issue_button_bot_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_modal(Issues.IssuesModal(button_id="bot_suggestion")) await interaction.response.send_modal(Issues.BotBugModal())
@discord.ui.button(label="Cog Suggestion", style=discord.ButtonStyle.blurple, row=1) @discord.ui.button(label="Cog Suggestion", style=discord.ButtonStyle.blurple, row=1)
async def issue_button_cog_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): async def issue_button_cog_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_modal(Issues.IssuesModal(button_id="cog_suggestion")) await interaction.response.send_modal(Issues.BotBugModal())
class IssuesModal(discord.ui.Modal, title="Creating issue..."): class BotBugModal(discord.ui.Modal, title="Creating issue..."):
def __init__(self, button_id): def __init__(self):
super().__init__() super().__init__()
self.button_id = button_id
self.input_list = []
if self.button_id == "cog_suggestion" or self.button_id == "cog_bug": bug_description = discord.ui.TextInput(
self.cog_name = discord.ui.TextInput( label="Describe the bug",
label="What cog is your suggestion for?", placeholder="A clear and concise description of what the bug is.",
placeholder="If unsure, input 'GalaxyCogs'", style=discord.TextStyle.paragraph,
style=discord.TextStyle.short, max_length=2048
required=True, )
max_length=100 reproduction_steps = discord.ui.TextInput(
) label="To Reproduce",
self.input_list.append(self.cog_name) placeholder="What caused the bug?",
if self.button_id == "cog_suggestion" or self.button_id == "bot_suggestion": style=discord.TextStyle.paragraph,
self.suggestion_description = discord.ui.TextInput( required=True,
label="Describe your suggestion.", max_length=2048
placeholder="A clear and concise description of what the suggestion is.", )
style=discord.TextStyle.paragraph, expected_behavior = discord.ui.TextInput(
required=True, label="Expected Behavior",
max_length=2048 placeholder="A clear and concise description of what you expected to happen.",
) style=discord.TextStyle.paragraph,
self.input_list.append(self.suggestion_description) required=True,
if self.button_id == "bot_bug" or self.button_id == "cog_bug": max_length=2048
self.bug_description = discord.ui.TextInput( )
label="Describe the bug", additional_context = discord.ui.TextInput(
placeholder="A clear and concise description of what the bug is.", label="Additional Context",
style=discord.TextStyle.paragraph, placeholder="Add any other context about the problem here.",
required=True, style=discord.TextStyle.paragraph,
max_length=2048 required=False,
) max_length=2048
self.reproduction_steps = discord.ui.TextInput( )
label="To Reproduce",
placeholder="What caused the bug?",
style=discord.TextStyle.paragraph,
required=True,
max_length=2048
)
self.expected_behavior = discord.ui.TextInput(
label="Expected Behavior",
placeholder="A clear and concise description of what you expected to happen.",
style=discord.TextStyle.paragraph,
required=True,
max_length=2048
)
self.input_list.append(self.bug_description)
self.input_list.append(self.reproduction_steps)
self.input_list.append(self.expected_behavior)
self.additional_context = discord.ui.TextInput(
label="Additional Context",
placeholder=f"Add any other context about the {'problem' if self.button_id == 'cog_bug' or self.button_id == 'bot_bug' else 'suggestion'} here.",
style=discord.TextStyle.paragraph,
required=False,
max_length=2048
)
self.screenshots = discord.ui.TextInput(
label="Screenshots",
placeholder=f"Add screenshots to help explain your {'problem' if self.button_id == 'cog_bug' or self.button_id == 'bot_bug' else 'suggestion'}. Seperate each screenshot with a newline.",
style=discord.TextStyle.paragraph,
required=False,
max_length=2048
)
self.input_list.append(self.additional_context)
self.input_list.append(self.screenshots)
async def on_submit(self, interaction: discord.Interaction): async def on_submit(self, interaction: discord.Interaction):
embed = discord.Embed(title="Issue Request", color=await Issues.bot.get_embed_color(None)) embed = discord.Embed(title="Issue Request", color=await Issues.bot.get_embed_color(None))
for item in self.input_list: fields = [self.bug_description, self.reproduction_steps, self.expected_behavior, self.additional_context]
for item in fields:
title = item.label title = item.label
value = item.value value = item.value
if value is not None: if value is not None: