Do what I did to eval with exec as well
This commit is contained in:
parent
12abe9156d
commit
279d73feb8
2 changed files with 12 additions and 3 deletions
|
@ -9,11 +9,12 @@ exports.run = async (message, args) => {
|
||||||
const sendString = `\`\`\`js\n${cleaned}\n\`\`\``;
|
const sendString = `\`\`\`js\n${cleaned}\n\`\`\``;
|
||||||
if (sendString.length >= 2000) {
|
if (sendString.length >= 2000) {
|
||||||
return message.channel.createMessage("The result was too large, so here it is as a file:", [{
|
return message.channel.createMessage("The result was too large, so here it is as a file:", [{
|
||||||
file: evaled,
|
file: cleaned,
|
||||||
name: "result.txt"
|
name: "result.txt"
|
||||||
}]);
|
}]);
|
||||||
}
|
} else {
|
||||||
return sendString;
|
return sendString;
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
|
return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,15 @@ exports.run = async (message, args) => {
|
||||||
const execed = await exec(code);
|
const execed = await exec(code);
|
||||||
if (execed.stderr) return `\`ERROR\` \`\`\`xl\n${await clean(execed.stderr)}\n\`\`\``;
|
if (execed.stderr) return `\`ERROR\` \`\`\`xl\n${await clean(execed.stderr)}\n\`\`\``;
|
||||||
const cleaned = await clean(execed.stdout);
|
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) {
|
} catch (err) {
|
||||||
return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
|
return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue