This repository has been archived on 2024-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
Files
2021-08-18 00:12:37 -07:00

19 lines
701 B
JavaScript

const { exec } = require('child_process');
module.exports = {
command: 'exec',
description: 'execute terminal commands from Discord',
syntax: '{PREFIX}exec [cmds]',
execute: async (_this, msg, args) => {
if (!args.join(' ')) return msg.channel.createMessage('No arguments were given');
msg.channel.createMessage(`\`INPUT\`\n\`\`\`ini\n${args.join(' ')}\n\`\`\``);
exec(args.join(' '), (error, stdout) => {
if (error) {
msg.channel.createMessage(`\`ERROR\`\n\`\`\`ini\n${error}\n\`\`\``);
} else {
msg.channel.createMessage(`\`OUTPUT\`\n\`\`\`ini\n${stdout}\n\`\`\``);
}
});
},
};