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