From 22532982c3c52b32d88dfa5c7441f32f7709262e Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 18 May 2021 02:18:10 -0600 Subject: [PATCH] n?execute --- commands/dev/execute.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 commands/dev/execute.js diff --git a/commands/dev/execute.js b/commands/dev/execute.js new file mode 100644 index 0000000..1c25e55 --- /dev/null +++ b/commands/dev/execute.js @@ -0,0 +1,37 @@ +const Discord = require('discord.js'); + +const cp = require("child_process"); + +module.exports = { + name: "Execute", + aliases: ['exec'], + meta: { + category: 'Developer', + description: "Execute a console command", + syntax: '`Execute `', + extra: null + }, + help: "Dev only! Executes a console command", + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}execute \``);} + return cp.exec(args.join(" "), function(error, stdout, stderr) { + if (error) { + return message.channel.send(new Discord.MessageEmbed() + .setTitle("Error") + .setDescription(`\`\`\`${error}\`\`\``) + .setColor("ff446a") + .setFooter("Natsuki", client.user.avatarURL()) + .setTimestamp() + ); + } + + return message.channel.send(new Discord.MessageEmbed() + .setTitle("Execution Successful") + .setDescription(`\`\`\`${stdout}\`\`\``) + .setColor("c375f0") + .setFooter("Natsuki", client.user.avatarURL()) + .setTimestamp() + ); + }); + } +}; \ No newline at end of file