Add bug report command
This commit is contained in:
parent
e0b75e7de5
commit
e38ed487ae
43
code/cogs/bug_report.py
Normal file
43
code/cogs/bug_report.py
Normal file
@ -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)
|
@ -2,6 +2,7 @@ import discord
|
|||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
|
from bug_report import BugReport
|
||||||
from feedback import FeedbackForm
|
from feedback import FeedbackForm
|
||||||
|
|
||||||
|
|
||||||
@ -9,6 +10,11 @@ class Modals(commands.Cog):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = 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()
|
@app_commands.command()
|
||||||
async def feedback(self, interaction: discord.Interaction):
|
async def feedback(self, interaction: discord.Interaction):
|
||||||
"Send bot feeback to the developer"
|
"Send bot feeback to the developer"
|
||||||
|
@ -47,6 +47,7 @@ config.read_string(file_contents)
|
|||||||
BOT_TOKEN = config["BOT_INFO"]["TOKEN"]
|
BOT_TOKEN = config["BOT_INFO"]["TOKEN"]
|
||||||
BOT_COLOR = discord.Color(int((config["BOT_INFO"]["BOT_COLOR"]).replace("#", ""), 16))
|
BOT_COLOR = discord.Color(int((config["BOT_INFO"]["BOT_COLOR"]).replace("#", ""), 16))
|
||||||
FEEDBACK_CHANNEL_ID = int(config["BOT_INFO"]["FEEDBACK_CHANNEL_ID"])
|
FEEDBACK_CHANNEL_ID = int(config["BOT_INFO"]["FEEDBACK_CHANNEL_ID"])
|
||||||
|
BUG_CHANNEL_ID = int(config["BOT_INFO"]["BUG_CHANNEL_ID"])
|
||||||
|
|
||||||
LAVALINK_HOST = config["LAVALINK"]["HOST"]
|
LAVALINK_HOST = config["LAVALINK"]["HOST"]
|
||||||
LAVALINK_PORT = config["LAVALINK"]["PORT"]
|
LAVALINK_PORT = config["LAVALINK"]["PORT"]
|
||||||
|
@ -35,6 +35,12 @@ def validate_config(file_contents):
|
|||||||
|
|
||||||
elif len(config["BOT_INFO"]["FEEDBACK_CHANNEL_ID"]) != 19:
|
elif len(config["BOT_INFO"]["FEEDBACK_CHANNEL_ID"]) != 19:
|
||||||
LOG.critical("FEEDBACK_CHANNEL_ID is not a valid Discord channel ID.")
|
LOG.critical("FEEDBACK_CHANNEL_ID is not a valid Discord channel ID.")
|
||||||
|
# Validate BUG_CHANNEL_ID
|
||||||
|
if not config["BOT_INFO"]["BUG_CHANNEL_ID"]:
|
||||||
|
LOG.critical("BUG_CHANNEL_ID has not been set.")
|
||||||
|
|
||||||
|
elif len(config["BOT_INFO"]["BUG_CHANNEL_ID"]) != 19:
|
||||||
|
LOG.critical("BUG_CHANNEL_ID is not a valid Discord channel ID.")
|
||||||
|
|
||||||
# Validate LAVALINK
|
# Validate LAVALINK
|
||||||
# Validate HOST
|
# Validate HOST
|
||||||
@ -68,7 +74,12 @@ def create_config():
|
|||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config["BOT_INFO"] = {"TOKEN": "", "BOT_COLOR": "", "FEEDBACK_CHANNEL_ID": ""}
|
config["BOT_INFO"] = {
|
||||||
|
"TOKEN": "",
|
||||||
|
"BOT_COLOR": "",
|
||||||
|
"FEEDBACK_CHANNEL_ID": "",
|
||||||
|
"BUG_CHANNEL_ID": "",
|
||||||
|
}
|
||||||
|
|
||||||
config["LAVALINK"] = {"HOST": "", "PORT": "", "PASSWORD": ""}
|
config["LAVALINK"] = {"HOST": "", "PORT": "", "PASSWORD": ""}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
token =
|
token =
|
||||||
bot_color =
|
bot_color =
|
||||||
feedback_channel_id =
|
feedback_channel_id =
|
||||||
|
bug_channel_id =
|
||||||
|
|
||||||
[LAVALINK]
|
[LAVALINK]
|
||||||
host =
|
host =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user