This commit is contained in:
root 2025-03-29 20:40:42 +00:00
commit 2a7b83c3d1

View file

@ -785,39 +785,33 @@ case "anime":
} }
break; break;
case "traceroute": case "traceroute":
try { try {
await interaction.deferReply(); await interaction.deferReply();
const target = interaction.options.getString("target"); const target = interaction.options.getString("target");
const maxHops = interaction.options.getInteger("hops") || 30; const maxHops = interaction.options.getInteger("hops") || 30;
const { exec } = require('child_process'); const { exec } = require('child_process');
exec(`traceroute -m ${maxHops} ${target}`, async (error, stdout, stderr) => { exec(`traceroute -m ${maxHops} ${target}`, async (error, stdout, stderr) => {
// windows version const output = stdout || stderr || 'No response';
// exec(`tracert -d -h ${maxHops} ${target}`, async (error, stdout, stderr) => {
const traceEmbed = {
title: "Traceroute Results",
description: `Target: ${target}\nMax Hops: ${maxHops}`,
color: 0x3498db,
fields: [
{
name: "Path",
value: `\`\`\`${stdout || stderr || 'No response'}\`\`\``
}
],
timestamp: new Date(),
footer: { text: "Network Diagnostics" }
};
await interaction.editReply({ embeds: [traceEmbed] }); const traceEmbed = {
}); title: "Traceroute Results",
} catch (error) { description: `Target: ${target}\nMax Hops: ${maxHops}\n\n\`\`\`\n${output}\`\`\``,
console.error(error); color: 0x3498db,
await interaction.editReply({ timestamp: new Date(),
content: "Failed to perform traceroute. Please check the target and try again.", footer: { text: "Network Diagnostics" }
ephemeral: true };
});
} await interaction.editReply({ embeds: [traceEmbed] });
break; });
} catch (error) {
console.error(error);
await interaction.editReply({
content: "Failed to perform traceroute. Please check the target and try again.",
ephemeral: true
});
}
break;
case "whois": case "whois":
try { try {
await interaction.deferReply(); await interaction.deferReply();