updated exec to support html formatting
This commit is contained in:
parent
47700fce82
commit
080e957655
1 changed files with 3 additions and 3 deletions
|
@ -15,17 +15,17 @@ class ExecCommand extends Command {
|
|||
const code = this.options.cmd ?? this.args.join(" ");
|
||||
try {
|
||||
const execed = await exec(code);
|
||||
if (execed.stderr) return `${await clean(execed.stderr)}`;
|
||||
if (execed.stderr) return { html: `<pre><code>${await clean(execed.stderr)}</code></pre>` };
|
||||
const cleaned = await clean(execed.stdout);
|
||||
const sendString = `${cleaned}`;
|
||||
if (sendString.length >= 2000) {
|
||||
if (sendString.length >= 4000) {
|
||||
return {
|
||||
text: "The result was too large, so here it is as a file:",
|
||||
file: cleaned,
|
||||
name: "result.txt"
|
||||
};
|
||||
} else {
|
||||
return sendString;
|
||||
return { html: "<pre><code>"+sendString+"</code></pre>" };
|
||||
}
|
||||
} catch (err) {
|
||||
return `\`ERROR\` ${await clean(err)}`;
|
||||
|
|
Loading…
Reference in a new issue