From 279d73feb84dc47d460ab598ef574f471128ed12 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Fri, 27 Mar 2020 08:25:04 -0500 Subject: [PATCH] Do what I did to eval with exec as well --- commands/eval.js | 5 +++-- commands/exec.js | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/commands/eval.js b/commands/eval.js index c556b30..33bd93d 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -9,11 +9,12 @@ exports.run = async (message, args) => { const sendString = `\`\`\`js\n${cleaned}\n\`\`\``; if (sendString.length >= 2000) { return message.channel.createMessage("The result was too large, so here it is as a file:", [{ - file: evaled, + file: cleaned, name: "result.txt" }]); + } else { + return sendString; } - return sendString; } catch (err) { return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``; } diff --git a/commands/exec.js b/commands/exec.js index 64b7fd3..906e047 100644 --- a/commands/exec.js +++ b/commands/exec.js @@ -9,7 +9,15 @@ exports.run = async (message, args) => { const execed = await exec(code); if (execed.stderr) return `\`ERROR\` \`\`\`xl\n${await clean(execed.stderr)}\n\`\`\``; const cleaned = await clean(execed.stdout); - return `\`\`\`bash\n${cleaned}\n\`\`\``; + const sendString = `\`\`\`bash\n${cleaned}\n\`\`\``; + if (sendString.length >= 2000) { + return message.channel.createMessage("The result was too large, so here it is as a file:", [{ + file: cleaned, + name: "result.txt" + }]); + } else { + return sendString; + } } catch (err) { return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``; }