diff --git a/config.json.template b/config.json.template index d0945de..ebd0c33 100644 --- a/config.json.template +++ b/config.json.template @@ -13,7 +13,8 @@ "owner": "YOUR_ID", "mainGuild": "YOUR_GUILD", "inviteChannel": "INVITE_CHANNEL", - "logChannel": "LOG_CHANNEL" + "logChannel": "LOG_CHANNEL", + "bugReportChannel": "1241106530435076189" }, "ntfy": { "enabled": false, diff --git a/data/commands.json b/data/commands.json index b0742a6..eba77c6 100644 --- a/data/commands.json +++ b/data/commands.json @@ -252,5 +252,50 @@ "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 + } + ] } ] \ No newline at end of file diff --git a/index.js b/index.js index 3150c16..041760e 100644 --- a/index.js +++ b/index.js @@ -1359,8 +1359,67 @@ discord.on("interactionCreate", async (interaction) => { }); 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: