mirror of
https://github.com/Mestima/luna.git
synced 2025-05-03 12:50:14 +00:00
added error handling to 'js' command
This commit is contained in:
parent
b33e253ffc
commit
613e6599ee
@ -22,7 +22,12 @@ export default {
|
||||
const hide = interaction.options.getBoolean('hide');
|
||||
node.runSource(code)
|
||||
.then(res => {
|
||||
let payload = '```js\n' + res.stdout + '\n```';
|
||||
let payload = '';
|
||||
if (res.stderr != '') {
|
||||
payload = '```Markdown\n# ' + res.errorType + ' error\n' + res.stderr + '\n```';
|
||||
} else {
|
||||
payload = '```js\n' + res.stdout + '\n```';
|
||||
}
|
||||
if (!hide) {
|
||||
payload = '```js\n' + code + '\n```' + payload;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user