This commit is contained in:
Xargana 2025-03-30 09:57:46 +03:00
parent d747c3f0da
commit 378b89d158

View file

@ -821,15 +821,20 @@ case "anime":
const maxHops = interaction.options.getInteger("hops") || 16; const maxHops = interaction.options.getInteger("hops") || 16;
const { spawn } = require('child_process'); const { spawn } = require('child_process');
// Simplify the command and avoid piping through awk which might cause issues // Use shell option to properly handle the pipe
const tracepath = spawn('traceroute', ['-q', '1', '-d', '-m', `${maxHops}`, target]); const tracepath = spawn('traceroute -q 1 -d -m ' + maxHops + ' ' + target + ' | awk \'{print $1, $2, $3}\'', {
shell: true
});
let output = ''; let output = '';
tracepath.stdout.on('data', async (data) => { tracepath.stdout.on('data', async (data) => {
// Simply append the data without additional processing const newData = data.toString()
output += data.toString(); .split('\n')
.map(line => line.trim())
.join('\n');
output += newData;
const traceEmbed = { const traceEmbed = {
title: `Path to ${target}`, title: `Path to ${target}`,
description: `\`\`\`\n${output}\`\`\``, description: `\`\`\`\n${output}\`\`\``,
@ -863,7 +868,7 @@ case "anime":
ephemeral: true ephemeral: true
}); });
} }
break; break;
case "whois": case "whois":
try { try {
await interaction.deferReply(); await interaction.deferReply();