aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-04-02 16:16:47 -0500
committerParker <contact@pkrm.dev>2024-04-02 16:16:47 -0500
commitb6cbac40509a37751f9a027cdae6b69cd86aaf00 (patch)
tree17ec0a927c637015e5e1cba3d43e9af6ecb8fb21 /code
parente38ed487ae0914888e12f2ce4d1283f5e3ea50f7 (diff)
Combine forms into 1 file
Diffstat (limited to 'code')
-rw-r--r--code/cogs/bug_report.py43
-rw-r--r--code/cogs/feedback.py44
-rw-r--r--code/cogs/forms.py105
-rw-r--r--code/cogs/modals.py25
4 files changed, 105 insertions, 112 deletions
diff --git a/code/cogs/bug_report.py b/code/cogs/bug_report.py
deleted file mode 100644
index a90f04d..0000000
--- a/code/cogs/bug_report.py
+++ /dev/null
@@ -1,43 +0,0 @@
-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/feedback.py b/code/cogs/feedback.py
deleted file mode 100644
index 77a3b5a..0000000
--- a/code/cogs/feedback.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import discord
-
-from global_variables import FEEDBACK_CHANNEL_ID, BOT_COLOR
-
-
-class FeedbackForm(discord.ui.Modal, title="Give feedback about the bot"):
- def __init__(self, bot):
- super().__init__()
- self.bot = bot
-
- name = discord.ui.TextInput(
- label="Discord username",
- placeholder="EX: itsmefreddy01...",
- )
- positive = discord.ui.TextInput(
- label="What do you like about the bot?",
- style=discord.TextStyle.long,
- placeholder="Your response here...",
- required=True,
- max_length=500,
- )
- negative = discord.ui.TextInput(
- label="What should be changed about the bot?",
- style=discord.TextStyle.long,
- placeholder="Your response here...",
- required=True,
- max_length=500,
- )
-
- async def on_submit(self, interaction: discord.Interaction):
- await interaction.response.send_message(
- f"Thank you for your feedback. We love hearing from users!", ephemeral=True
- )
- channel = self.bot.get_channel(FEEDBACK_CHANNEL_ID)
-
- embed = discord.Embed(
- title="Bot Feedback",
- description=f"Submitted by {self.name} (<@{interaction.user.id}>)",
- color=BOT_COLOR,
- )
- embed.add_field(name="Positive:", value=f"{self.positive}", inline=False)
- embed.add_field(name="Negative:", value=f"{self.negative}", inline=False)
-
- await channel.send(embed=embed)
diff --git a/code/cogs/forms.py b/code/cogs/forms.py
new file mode 100644
index 0000000..59dbba4
--- /dev/null
+++ b/code/cogs/forms.py
@@ -0,0 +1,105 @@
+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)
+
+
+class FeedbackForm(discord.ui.Modal, title="Give feedback about the bot"):
+ def __init__(self, bot):
+ super().__init__()
+ self.bot = bot
+
+ name = discord.ui.TextInput(
+ label="Discord username",
+ placeholder="EX: itsmefreddy01...",
+ )
+ positive = discord.ui.TextInput(
+ label="What do you like about the bot?",
+ style=discord.TextStyle.long,
+ placeholder="Your response here...",
+ required=True,
+ max_length=500,
+ )
+ negative = discord.ui.TextInput(
+ label="What should be changed about the bot?",
+ style=discord.TextStyle.long,
+ placeholder="Your response here...",
+ required=True,
+ max_length=500,
+ )
+
+ async def on_submit(self, interaction: discord.Interaction):
+ await interaction.response.send_message(
+ f"Thank you for your feedback. We love hearing from users!", ephemeral=True
+ )
+ channel = self.bot.get_channel(FEEDBACK_CHANNEL_ID)
+
+ embed = discord.Embed(
+ title="Bot Feedback",
+ description=f"Submitted by {self.name} (<@{interaction.user.id}>)",
+ color=BOT_COLOR,
+ )
+ embed.add_field(name="Positive:", value=f"{self.positive}", inline=False)
+ embed.add_field(name="Negative:", value=f"{self.negative}", inline=False)
+
+ await channel.send(embed=embed)
+
+
+class Modals(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))
diff --git a/code/cogs/modals.py b/code/cogs/modals.py
deleted file mode 100644
index 390bbda..0000000
--- a/code/cogs/modals.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import discord
-from discord import app_commands
-from discord.ext import commands
-
-from bug_report import BugReport
-from feedback import FeedbackForm
-
-
-class Modals(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))