Improve exec cmd

This commit is contained in:
Lamp 2018-10-06 12:04:10 -07:00
parent 1ea0adc962
commit 4c44089e6c
No known key found for this signature in database
GPG Key ID: 0F1F8704BEDE369E
1 changed files with 6 additions and 8 deletions

View File

@ -89,7 +89,8 @@ global.commands = {
"eval": { "eval": {
op: true, op: true,
usage: "<javascript>", description: "Evaluate javascript",
usage: "<code>",
aliases: ['>'], aliases: ['>'],
exec: async function (message) { exec: async function (message) {
var msg = message, m = message, var msg = message, m = message,
@ -110,19 +111,16 @@ global.commands = {
"exec": { "exec": {
op: true, op: true,
description: "Run a shell command",
usage: "<command>", usage: "<command>",
aliases: ["$"], aliases: ["$"],
exec: async function (msg) { exec: async function (msg) {
require("child_process").exec(msg.txt(1), function(error, stdout, stderr){ require("child_process").exec(msg.txt(1), function(error, stdout, stderr){
if (error) msg.channel.send(error, {split:{char:''}}); if (error) msg.channel.send(error, {split:{char:'',maxLength:2000}});
else { if (stdout) msg.channel.send(stdout, {split:{char:'',maxLength:2000}});
var str = "" if (stderr) msg.channel.send(stderr, {split:{char:'',maxLength:2000}});
if (stdout) msg.channel.send(stdout, {split:{char:''}});
if (stderr) msg.channel.send(stderr, {split:{char:''}});
}
}) })
} }
}, },
"query": { "query": {