aboutsummaryrefslogtreecommitdiff
path: root/code/cogs
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-06-26 14:44:15 -0500
committerParker <contact@pkrm.dev>2024-06-26 14:44:15 -0500
commit7d78bbae16145b6ff4c337b10be196f9e7549f03 (patch)
tree4feb089232e7cb236da92d481c5c08c9bb223813 /code/cogs
parent654707368497990b716253e1c31131f43c2e4c12 (diff)
Split bug/feedback commands into separate files
Diffstat (limited to 'code/cogs')
-rw-r--r--code/cogs/bug.py59
-rw-r--r--code/cogs/feedback.py (renamed from code/cogs/forms.py)51
2 files changed, 62 insertions, 48 deletions
diff --git a/code/cogs/bug.py b/code/cogs/bug.py
new file mode 100644
index 0000000..67ae258
--- /dev/null
+++ b/code/cogs/bug.py
@@ -0,0 +1,59 @@
+import discord
+from discord import app_commands
+from discord.ext import commands
+
+from global_variables import BOT_COLOR, BUG_CHANNEL_ID
+
+
+class BugReport(discord.ui.Modal, title="Report a bug"):
+ def __init__(self, bot):
+ super().__init__()
+ self.bot = bot
+
+ name = discord.ui.TextInput(
+ label="Discord username",
+ placeholder="EX: itsmefreddy01...",
+ )
+ command = discord.ui.TextInput(
+ label="Command with error", placeholder="EX: skip...", required=True
+ )
+ report = discord.ui.TextInput(
+ label="A detailed report of the bug",
+ style=discord.TextStyle.long,
+ placeholder="Type your report here...",
+ required=True,
+ max_length=500,
+ )
+
+ async def on_submit(self, interaction: discord.Interaction):
+ await interaction.response.send_message(
+ f"Thanks for your bug report. We will get back to you as soon as possible",
+ ephemeral=True,
+ )
+ channel = self.bot.get_channel(BUG_CHANNEL_ID)
+
+ embed = discord.Embed(
+ title="Bug Report",
+ description=f"Submitted by {self.name} (<@{interaction.user.id}>)",
+ color=BOT_COLOR,
+ )
+ embed.add_field(
+ name="Command with issue:", value=f"{self.command}", inline=False
+ )
+ embed.add_field(name="Report:", value=f"{self.report}", inline=False)
+
+ await channel.send(embed=embed)
+
+
+class Bug(commands.Cog):
+ def __init__(self, bot):
+ self.bot = bot
+
+ @app_commands.command()
+ async def bug(self, interaction: discord.Interaction):
+ "Send a bug report to the developer"
+ await interaction.response.send_modal(BugReport(self.bot))
+
+
+async def setup(bot):
+ await bot.add_cog(Bug(bot))
diff --git a/code/cogs/forms.py b/code/cogs/feedback.py
index 59dbba4..e04eecf 100644
--- a/code/cogs/forms.py
+++ b/code/cogs/feedback.py
@@ -2,47 +2,7 @@ import discord
from discord import app_commands
from discord.ext import commands
-from global_variables import BOT_COLOR, BUG_CHANNEL_ID, FEEDBACK_CHANNEL_ID
-
-
-class BugReport(discord.ui.Modal, title="Report a bug"):
- def __init__(self, bot):
- super().__init__()
- self.bot = bot
-
- name = discord.ui.TextInput(
- label="Discord username",
- placeholder="EX: itsmefreddy01...",
- )
- command = discord.ui.TextInput(
- label="Command with error", placeholder="EX: skip...", required=True
- )
- report = discord.ui.TextInput(
- label="A detailed report of the bug",
- style=discord.TextStyle.long,
- placeholder="Type your report here...",
- required=True,
- max_length=500,
- )
-
- async def on_submit(self, interaction: discord.Interaction):
- await interaction.response.send_message(
- f"Thanks for your bug report. We will get back to you as soon as possible",
- ephemeral=True,
- )
- channel = self.bot.get_channel(BUG_CHANNEL_ID)
-
- embed = discord.Embed(
- title="Bug Report",
- description=f"Submitted by {self.name} (<@{interaction.user.id}>)",
- color=BOT_COLOR,
- )
- embed.add_field(
- name="Command with issue:", value=f"{self.command}", inline=False
- )
- embed.add_field(name="Report:", value=f"{self.report}", inline=False)
-
- await channel.send(embed=embed)
+from global_variables import BOT_COLOR, FEEDBACK_CHANNEL_ID
class FeedbackForm(discord.ui.Modal, title="Give feedback about the bot"):
@@ -86,20 +46,15 @@ class FeedbackForm(discord.ui.Modal, title="Give feedback about the bot"):
await channel.send(embed=embed)
-class Modals(commands.Cog):
+class Feedback(commands.Cog):
def __init__(self, bot):
self.bot = bot
@app_commands.command()
- async def bug(self, interaction: discord.Interaction):
- "Send a bug report to the developer"
- await interaction.response.send_modal(BugReport(self.bot))
-
- @app_commands.command()
async def feedback(self, interaction: discord.Interaction):
"Send bot feeback to the developer"
await interaction.response.send_modal(FeedbackForm(self.bot))
async def setup(bot):
- await bot.add_cog(Modals(bot))
+ await bot.add_cog(Feedback(bot))