Haha-Yes/commands/owner/update.js

33 lines
857 B
JavaScript
Raw Permalink Normal View History

const { Command } = require('discord-akairo');
2019-11-22 12:54:32 +01:00
const Util = require('util');
const exec = Util.promisify(require('child_process').exec);
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) {
2019-11-22 13:00:41 +01:00
await exec('git pull')
.then(output => {
const Embed = this.client.util.embed()
2020-02-24 14:36:37 +01:00
.addField('stdout', output.stdout ? output.stdout : 'No update')
.addField('stderr', output.stderr ? output.stderr : 'No error');
2019-11-22 13:00:41 +01:00
message.channel.send({embed: Embed})
.catch(() => {
message.channel.send(`stdout: ${output.stdout}\nstderr: ${output.stderr}`);
});
2019-11-22 12:58:12 +01:00
});
}
}
module.exports = EvalCommand;