fix(issues): fixed a bug causing an error when the embed color was set
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 5s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 5s
This commit is contained in:
parent
246242ad71
commit
44769ae4b0
1 changed files with 11 additions and 10 deletions
|
@ -15,8 +15,8 @@ class Issues(commands.Cog):
|
||||||
|
|
||||||
@app_commands.command()
|
@app_commands.command()
|
||||||
async def issuestest(self, interaction: discord.Interaction):
|
async def issuestest(self, interaction: discord.Interaction):
|
||||||
passed_info = interaction
|
color = await self.bot.get_embed_color(None)
|
||||||
await interaction.response.send_message(content="Hello world!", view=self.IssueButtons(passed_info), ephemeral=True)
|
await interaction.response.send_message(content="Hello world!", view=self.IssueButtons(color), ephemeral=True)
|
||||||
|
|
||||||
async def submit_issue_request(self, interaction: discord.Interaction, embed: discord.Embed):
|
async def submit_issue_request(self, interaction: discord.Interaction, embed: discord.Embed):
|
||||||
channel = self.bot.get_channel(self.config.channel())
|
channel = self.bot.get_channel(self.config.channel())
|
||||||
|
@ -29,29 +29,30 @@ class Issues(commands.Cog):
|
||||||
await interaction.response.send_message(content=f"The cog is misconfigured, please report this error.\n```{error}```", ephemeral=True)
|
await interaction.response.send_message(content=f"The cog is misconfigured, please report this error.\n```{error}```", ephemeral=True)
|
||||||
|
|
||||||
class IssueButtons(discord.ui.View):
|
class IssueButtons(discord.ui.View):
|
||||||
def __init__(self, passed_info):
|
def __init__(self, color):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.passed_info: discord.Interaction = passed_info
|
self.color = color
|
||||||
|
|
||||||
@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.BotBugModal())
|
await interaction.response.send_modal(Issues.BotBugModal(self.color))
|
||||||
|
|
||||||
@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.BotBugModal())
|
await interaction.response.send_modal(Issues.BotBugModal(self.color))
|
||||||
|
|
||||||
@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.BotBugModal())
|
await interaction.response.send_modal(Issues.BotBugModal(self.color))
|
||||||
|
|
||||||
@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.BotBugModal())
|
await interaction.response.send_modal(Issues.BotBugModal(self.color))
|
||||||
|
|
||||||
class BotBugModal(discord.ui.Modal, title="Creating issue..."):
|
class BotBugModal(discord.ui.Modal, title="Creating issue..."):
|
||||||
def __init__(self):
|
def __init__(self, color):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.color = color
|
||||||
|
|
||||||
bug_description = discord.ui.TextInput(
|
bug_description = discord.ui.TextInput(
|
||||||
label="Describe the bug",
|
label="Describe the bug",
|
||||||
|
@ -82,7 +83,7 @@ class Issues(commands.Cog):
|
||||||
)
|
)
|
||||||
|
|
||||||
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 = self.color)
|
||||||
fields = [self.bug_description, self.reproduction_steps, self.expected_behavior, self.additional_context]
|
fields = [self.bug_description, self.reproduction_steps, self.expected_behavior, self.additional_context]
|
||||||
for item in fields:
|
for item in fields:
|
||||||
title = item.label
|
title = item.label
|
||||||
|
|
Loading…
Reference in a new issue