From 70dbe9139d8bd1186f3e6d07334f8a62f1ca0aa1 Mon Sep 17 00:00:00 2001 From: Xargana Date: Sat, 29 Mar 2025 23:40:36 +0300 Subject: [PATCH] a --- discord/index.js | 58 ++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/discord/index.js b/discord/index.js index b4c024f..d22f5da 100644 --- a/discord/index.js +++ b/discord/index.js @@ -785,39 +785,33 @@ case "anime": } break; case "traceroute": - try { - await interaction.deferReply(); - const target = interaction.options.getString("target"); - const maxHops = interaction.options.getInteger("hops") || 30; - - const { exec } = require('child_process'); - exec(`traceroute -m ${maxHops} ${target}`, async (error, stdout, stderr) => { - // windows version - // 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" } - }; + try { + await interaction.deferReply(); + const target = interaction.options.getString("target"); + const maxHops = interaction.options.getInteger("hops") || 30; - await interaction.editReply({ embeds: [traceEmbed] }); - }); - } catch (error) { - console.error(error); - await interaction.editReply({ - content: "Failed to perform traceroute. Please check the target and try again.", - ephemeral: true - }); - } - break; + const { exec } = require('child_process'); + exec(`traceroute -m ${maxHops} ${target}`, async (error, stdout, stderr) => { + const output = stdout || stderr || 'No response'; + + const traceEmbed = { + title: "Traceroute Results", + description: `Target: ${target}\nMax Hops: ${maxHops}\n\n\`\`\`\n${output}\`\`\``, + color: 0x3498db, + timestamp: new Date(), + footer: { text: "Network Diagnostics" } + }; + + await interaction.editReply({ embeds: [traceEmbed] }); + }); + } 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": try { await interaction.deferReply();