Haha-Yes/commands/owner/update.js

34 lines
831 B
JavaScript
Raw Normal View History

const { Command } = require('discord-akairo');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
2019-03-31 00:39:36 +01:00
const { MessageEmbed } = require('discord.js');
class EvalCommand extends Command {
constructor() {
super('update', {
2019-03-15 23:41:34 +01:00
aliases: ['update', 'pull', 'git pull'],
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');
2019-03-31 00:39:36 +01:00
const Embed = new MessageEmbed()
.addField('stdout', stdout)
.addField('stderr', stderr);
message.channel.send({embed: Embed});
2019-02-13 17:55:47 +01:00
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
}
update();
}
}
module.exports = EvalCommand;