From fa7d8ae3faa6eefc6cc3392fe37d196197e7500a Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 24 Mar 2024 04:10:15 -0600 Subject: [PATCH] Update shell --- commands.json | 6 ------ index.js | 13 +++++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/commands.json b/commands.json index eb5a726..056b44e 100644 --- a/commands.json +++ b/commands.json @@ -123,12 +123,6 @@ "description": "The command to run", "type": 3, "required": true - }, - { - "name": "timeout", - "description": "The timeout for the command if it doesn't return (in seconds). Default is none!", - "type": 4, - "required": false } ] }, diff --git a/index.js b/index.js index 014896c..1498e54 100644 --- a/index.js +++ b/index.js @@ -1245,24 +1245,25 @@ dcClient.on('interactionCreate', async interaction => { ephemeral: true }); let cmd3 = interaction.options.get("command").value; - let cmd3timeout = interaction.options.get("timeout").value; + // TODO: Timeout + //let cmd3timeout = interaction.options.get("timeout").value; sshConn.exec(cmd3, (err, stream) => { if (err) { interaction.editReply(`Error running command: ${err}`); sendLog(`${colors.red("[ERROR]")} ${err}`); } // if timeout is set, set a timeout before - timeout = setTimeout(() => { - stream.close(); - interaction.editReply(`Command timed out after ${cmd3timeout}ms`); - }) + //timeout = setTimeout(() => { + // stream.close(); + // interaction.editReply(`Command timed out after ${cmd3timeout}ms`); + //}) outputStream = "" stream.on("data", (data) => { outputStream += `${data}` }) stream.on('exit', (code, signal) => { // clear the timeout - clearTimeout(timeout); + //clearTimeout(timeout); // generate message json const msgJson = { content: `Ran command \`${cmd3}\`\n\`\`\`ansi\n${outputStream}\`\`\``