Add bug report system
Some checks are pending
ptero-push / build (push) Waiting to run

This commit is contained in:
Christopher Cookman 2025-05-27 14:28:17 -06:00
parent 26535d47d1
commit 73f2d86945
3 changed files with 108 additions and 3 deletions

View file

@ -13,7 +13,8 @@
"owner": "YOUR_ID", "owner": "YOUR_ID",
"mainGuild": "YOUR_GUILD", "mainGuild": "YOUR_GUILD",
"inviteChannel": "INVITE_CHANNEL", "inviteChannel": "INVITE_CHANNEL",
"logChannel": "LOG_CHANNEL" "logChannel": "LOG_CHANNEL",
"bugReportChannel": "1241106530435076189"
}, },
"ntfy": { "ntfy": {
"enabled": false, "enabled": false,

View file

@ -252,5 +252,50 @@
"required": false "required": false
} }
] ]
},
{
"name": "bugreport",
"description": "Report a bug with the bot",
"type": 1,
"integration_types": [0,1],
"contexts": [0, 1, 2],
"options": [
{
"name": "description",
"description": "Description of the bug",
"type": 3,
"required": true
},
{
"name": "reproduction_steps",
"description": "Steps to reproduce the bug",
"type": 3,
"required": false
},
{
"name": "expected_result",
"description": "What you expected to happen",
"type": 3,
"required": false
},
{
"name": "actual_result",
"description": "What actually happened",
"type": 3,
"required": false
},
{
"name": "channel",
"description": "Channel where the bug occurred",
"type": 7,
"required": false
},
{
"name": "screenshot",
"description": "Screenshot of the bug (optional)",
"type": 11,
"required": false
}
]
} }
] ]

View file

@ -1359,8 +1359,67 @@ discord.on("interactionCreate", async (interaction) => {
}); });
break; break;
case "bugreport":
isGuild = interaction.inGuild();
bugReportChannel = await discord.channels.fetch(config.discord.bugReportChannel);
report = {
embeds: [{
title: "Bug Report",
author: {
name: isGuild ? `${interaction.user.username} in ${interaction.guild.name}` : interaction.user.username,
icon_url: isGuild ? interaction.guild.iconURL() : interaction.user.displayAvatarURL()
},
description: interaction.options.getString("description"),
color: 0xff0000,
timestamp: new Date(),
footer: {
text: "Bug Report",
icon_url: interaction.user.displayAvatarURL()
},
image: {
url: interaction.options.getAttachment("screenshot").url || null
},
fields: [
{
name: "User",
value: `${interaction.user.username} (${interaction.user.id})`,
inline: true
},
{
name: "Guild",
value: isGuild ? interaction.guild.name : "DM",
inline: true
},
{
name: "Channel",
value: interaction.options.getChannel("channel") ? interaction.options.getChannel("channel").toString() : "N/A",
inline: true
},
{
name: "Reproduction Steps",
value: interaction.options.getString("reproduction_steps") || "N/A",
inline: false
},
{
name: "Expected Result",
value: interaction.options.getString("expected_result") || "N/A",
inline: false
},
{
name: "Actual Result",
value: interaction.options.getString("actual_result") || "N/A",
inline: false
}
],
}]
}
bugReportChannel.send(report).then(() => {
interaction.reply({ content: "Bug report sent! Thank you for your feedback.", embeds: report.embeds});
}).catch((err) => {
interaction.reply({ content: "Failed to send bug report. Please try again later.", ephemeral: true });
console.error(`${colors.red("[ERROR]")} Failed to send bug report: ${err.message}`);
});
break;
} }
case Discord.InteractionType.MessageComponent: case Discord.InteractionType.MessageComponent: