From 7df050e5a318f3d2fbd55b63e624a3c7cde880f6 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 13 Feb 2019 17:53:52 +0100 Subject: [PATCH] update from git without having to ssh to the server --- commands/owner/update.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 commands/owner/update.js diff --git a/commands/owner/update.js b/commands/owner/update.js new file mode 100644 index 00000000..144d357b --- /dev/null +++ b/commands/owner/update.js @@ -0,0 +1,29 @@ +const { Command } = require('discord-akairo'); +const util = require('util'); +const exec = util.promisify(require('child_process').exec); + +class EvalCommand extends Command { + constructor() { + super('update', { + aliases: ['update'], + category: 'owner', + ownerOnly: 'true', + description: { + content: 'Update the bot with git pull', + usage: '', + examples: [''] + } + }); + } + + async exec(message) { + async function update() { + const { stdout, stderr } = await exec('git pull'); + message.channel.send(stdout); + message.channel.send(stderr); + } + update(); + } +} + +module.exports = EvalCommand; \ No newline at end of file