fix(issues): testing chatgpt fix
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 4s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 4s
This commit is contained in:
parent
5c0f74a08d
commit
8847754595
1 changed files with 11 additions and 9 deletions
|
@ -16,10 +16,10 @@ class Issues(commands.Cog):
|
||||||
@app_commands.command()
|
@app_commands.command()
|
||||||
async def issuestest(self, interaction: discord.Interaction):
|
async def issuestest(self, interaction: discord.Interaction):
|
||||||
color = await self.bot.get_embed_color(None)
|
color = await self.bot.get_embed_color(None)
|
||||||
await interaction.response.send_message(content="Hello world!", view=self.IssueButtons(color), ephemeral=True)
|
await interaction.response.send_message(content="Hello world!", view=self.IssueButtons(color, self), 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 = Issues.bot.get_channel(self.config.channel())
|
channel = self.bot.get_channel(self.config.channel())
|
||||||
if channel is None:
|
if channel is None:
|
||||||
await interaction.response.send_message(content=f"The cog is misconfigured, please report this error.", ephemeral=True)
|
await interaction.response.send_message(content=f"The cog is misconfigured, please report this error.", ephemeral=True)
|
||||||
try:
|
try:
|
||||||
|
@ -29,30 +29,32 @@ 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, color):
|
def __init__(self, color, cog_instance):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.color = color
|
self.color = color
|
||||||
|
self.cog_instance = cog_instance
|
||||||
|
|
||||||
@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(self.color))
|
await interaction.response.send_modal(Issues.BotBugModal(self.color, self.cog_instance))
|
||||||
|
|
||||||
@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(self.color))
|
await interaction.response.send_modal(Issues.BotBugModal(self.color, self.cog_instance))
|
||||||
|
|
||||||
@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(self.color))
|
await interaction.response.send_modal(Issues.BotBugModal(self.color, self.cog_instance))
|
||||||
|
|
||||||
@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(self.color))
|
await interaction.response.send_modal(Issues.BotBugModal(self.color, self.cog_instance))
|
||||||
|
|
||||||
class BotBugModal(discord.ui.Modal, title="Creating issue..."):
|
class BotBugModal(discord.ui.Modal, title="Creating issue..."):
|
||||||
def __init__(self, color):
|
def __init__(self, color, cog_instance):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.color = color
|
self.color = color
|
||||||
|
self.cog_instance = cog_instance
|
||||||
|
|
||||||
bug_description = discord.ui.TextInput(
|
bug_description = discord.ui.TextInput(
|
||||||
label="Describe the bug",
|
label="Describe the bug",
|
||||||
|
@ -95,4 +97,4 @@ class Issues(commands.Cog):
|
||||||
else:
|
else:
|
||||||
username = f"{interaction.user.name}#{interaction.user.discriminator}"
|
username = f"{interaction.user.name}#{interaction.user.discriminator}"
|
||||||
embed.set_footer(text=f"Submitted by {username} ({interaction.user.id})", icon_url=interaction.user.display_avatar.url)
|
embed.set_footer(text=f"Submitted by {username} ({interaction.user.id})", icon_url=interaction.user.display_avatar.url)
|
||||||
await Issues.submit_issue_request(self, interaction=interaction, embed=embed)
|
await self.cog_instance.submit_issue_request(self, interaction=interaction, embed=embed)
|
||||||
|
|
Loading…
Reference in a new issue