misc(issues): changed how imports are processed in issues.py

This commit is contained in:
Seaswimmer 2023-08-20 15:48:26 -04:00
parent 978f5e857d
commit 9e95da3c9e
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -1,7 +1,6 @@
import discord import discord
from redbot.core import Config, app_commands, commands, checks from redbot.core import Config, app_commands, commands, checks
from .modals import BotBugModal, IssuesConfigurationModal, IssueResponseModal import modals
class Issues(commands.Cog): class Issues(commands.Cog):
"""This cog allows you to create Gitea issues through a Discord modal. """This cog allows you to create Gitea issues through a Discord modal.
@ -28,7 +27,8 @@ class Issues(commands.Cog):
await ctx.channel.send(content="Click the button below to configure the cog.", view=self.IssueConfigurationButton(self.config, ctx)) await ctx.channel.send(content="Click the button below to configure the cog.", view=self.IssueConfigurationButton(self.config, ctx))
@app_commands.command() @app_commands.command()
async def issuestest(self, interaction: discord.Interaction): async def issues(self, interaction: discord.Interaction):
"""Found a bug or have a suggestion for the Galaxy bot? Use this command."""
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, self, interaction), ephemeral=True) await interaction.response.send_message(content="Hello world!", view=self.IssueButtons(color, self, interaction), ephemeral=True)
@ -55,19 +55,19 @@ 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(BotBugModal(self.color, self.cog_instance, self.original_interaction)) await interaction.response.send_modal(modals.BotBugModal(self.color, self.cog_instance, self.original_interaction))
@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(BotBugModal(self.color, self.cog_instance, self.original_interaction)) await interaction.response.send_modal(modals.CogBugModal(self.color, self.cog_instance, self.original_interaction))
@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(BotBugModal(self.color, self.cog_instance, self.original_interaction)) await interaction.response.send_modal(modals.BotSuggestionModal(self.color, self.cog_instance, self.original_interaction))
@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(BotBugModal(self.color, self.cog_instance, self.original_interaction)) await interaction.response.send_modal(modals.CogSuggestionModal(self.color, self.cog_instance, self.original_interaction))
class IssueConfigurationButton(discord.ui.View): class IssueConfigurationButton(discord.ui.View):
def __init__(self, config, ctx): def __init__(self, config, ctx):
@ -77,7 +77,7 @@ class Issues(commands.Cog):
@discord.ui.button(label="Change Configuration", style=discord.ButtonStyle.blurple, row=0) @discord.ui.button(label="Change Configuration", style=discord.ButtonStyle.blurple, row=0)
async def issue_configuration_button(self, interaction: discord.Interaction, button: discord.ui.Button): async def issue_configuration_button(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_modal(IssuesConfigurationModal(self.config, self.ctx)) await interaction.response.send_modal(modals.IssuesConfigurationModal(self.config, self.ctx))
class IssueResponseButtons(discord.ui.View): class IssueResponseButtons(discord.ui.View):
def __init__(self, channel, message_id, user): def __init__(self, channel, message_id, user):
@ -88,8 +88,8 @@ class Issues(commands.Cog):
@discord.ui.button(label="Approve", style=discord.ButtonStyle.green) @discord.ui.button(label="Approve", style=discord.ButtonStyle.green)
async def issue_response_button_approve(self, interaction: discord.Interaction, button: discord.ui.Button): async def issue_response_button_approve(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_modal(IssueResponseModal(self.channel, self.message_id, self.user, True)) await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, True))
@discord.ui.button(label="Deny", style=discord.ButtonStyle.danger) @discord.ui.button(label="Deny", style=discord.ButtonStyle.danger)
async def issue_response_button_deny(self, interaction: discord.Interaction, button: discord.ui.Button): async def issue_response_button_deny(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_modal(IssueResponseModal(self.channel, self.message_id, self.user, False)) await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, False))