fix(issues): reverted modal to older version for testing purposes
This commit is contained in:
parent
88ce09cb2d
commit
83b7c3f17e
1 changed files with 35 additions and 68 deletions
103
issues/issues.py
103
issues/issues.py
|
@ -44,89 +44,56 @@ class Issues(commands.Cog):
|
|||
|
||||
@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):
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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..."):
|
||||
def __init__(self, button_id):
|
||||
class BotBugModal(discord.ui.Modal, title="Creating issue..."):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.button_id = button_id
|
||||
self.input_list = []
|
||||
|
||||
if self.button_id == "cog_suggestion" or self.button_id == "cog_bug":
|
||||
self.cog_name = discord.ui.TextInput(
|
||||
label="What cog is your suggestion for?",
|
||||
placeholder="If unsure, input 'GalaxyCogs'",
|
||||
style=discord.TextStyle.short,
|
||||
required=True,
|
||||
max_length=100
|
||||
)
|
||||
self.input_list.append(self.cog_name)
|
||||
if self.button_id == "cog_suggestion" or self.button_id == "bot_suggestion":
|
||||
self.suggestion_description = discord.ui.TextInput(
|
||||
label="Describe your suggestion.",
|
||||
placeholder="A clear and concise description of what the suggestion is.",
|
||||
style=discord.TextStyle.paragraph,
|
||||
required=True,
|
||||
max_length=2048
|
||||
)
|
||||
self.input_list.append(self.suggestion_description)
|
||||
if self.button_id == "bot_bug" or self.button_id == "cog_bug":
|
||||
self.bug_description = discord.ui.TextInput(
|
||||
label="Describe the bug",
|
||||
placeholder="A clear and concise description of what the bug is.",
|
||||
style=discord.TextStyle.paragraph,
|
||||
required=True,
|
||||
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)
|
||||
bug_description = discord.ui.TextInput(
|
||||
label="Describe the bug",
|
||||
placeholder="A clear and concise description of what the bug is.",
|
||||
style=discord.TextStyle.paragraph,
|
||||
max_length=2048
|
||||
)
|
||||
reproduction_steps = discord.ui.TextInput(
|
||||
label="To Reproduce",
|
||||
placeholder="What caused the bug?",
|
||||
style=discord.TextStyle.paragraph,
|
||||
required=True,
|
||||
max_length=2048
|
||||
)
|
||||
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
|
||||
)
|
||||
additional_context = discord.ui.TextInput(
|
||||
label="Additional Context",
|
||||
placeholder="Add any other context about the problem here.",
|
||||
style=discord.TextStyle.paragraph,
|
||||
required=False,
|
||||
max_length=2048
|
||||
)
|
||||
|
||||
async def on_submit(self, interaction: discord.Interaction):
|
||||
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
|
||||
value = item.value
|
||||
if value is not None:
|
||||
|
|
Loading…
Reference in a new issue