1
0
Fork 0

Added pull command, testing only

refactor/models
Bsian 2019-10-30 12:53:36 +00:00
parent b4a64fde62
commit 15575e600e
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 30 additions and 0 deletions

30
src/commands/pull.ts Normal file
View File

@ -0,0 +1,30 @@
import { Message } from 'eris';
import { Client } from '..';
import { Command } from '../class';
export default class Pull extends Command {
constructor(client: Client) {
super(client);
this.name = 'pull';
this.description = 'Fetches the latest commit from Gitlab';
this.aliases = ['update'];
this.enabled = true;
this.permissions = { users: ['253600545972027394', '278620217221971968'] };
}
public async run(message: Message) {
try {
const updateMessage = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`);
let pull: string;
try {
pull = await this.client.util.exec('cd ../ && git pull');
} catch (error) {
return updateMessage.edit(`${this.client.stores.emojis.error} ***Could not fetch latest commit***\n\`\`\`sh\n${error.message}\n\`\`\``);
}
if (pull.includes('Already up to date')) return updateMessage.edit(`${this.client.stores.emojis.success} ***No updates available***`);
return message;
} catch (error) {
return this.client.util.handleError(error, message, this);
}
}
}