aboutsummaryrefslogtreecommitdiff
path: root/code/cogs
diff options
context:
space:
mode:
Diffstat (limited to 'code/cogs')
-rw-r--r--code/cogs/bug_report.py43
-rw-r--r--code/cogs/modals.py6
2 files changed, 49 insertions, 0 deletions
diff --git a/code/cogs/bug_report.py b/code/cogs/bug_report.py
new file mode 100644
index 0000000..a90f04d
--- /dev/null
+++ b/code/cogs/bug_report.py
@@ -0,0 +1,43 @@
+import discord
+
+from global_variables import BUG_CHANNEL_ID, BOT_COLOR
+
+
+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)
diff --git a/code/cogs/modals.py b/code/cogs/modals.py
index 999f3da..390bbda 100644
--- a/code/cogs/modals.py
+++ b/code/cogs/modals.py
@@ -2,6 +2,7 @@ import discord
from discord import app_commands
from discord.ext import commands
+from bug_report import BugReport
from feedback import FeedbackForm
@@ -10,6 +11,11 @@ class Modals(commands.Cog):
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))