cloudservices/src/commands/restart.ts

24 lines
869 B
TypeScript

import { Message } from 'eris';
import { Client, Command } from '../class';
export default class Restart extends Command {
constructor(client: Client) {
super(client);
this.name = 'restart';
this.description = 'Restart the bot';
this.permissions = { users: ['253600545972027394', '278620217221971968'] };
this.enabled = true;
}
public async run(message: Message, args: string[]) {
try {
if (this.client.updating && args[0] !== '-f') return this.error(message.channel, 'Update in process.');
if (this.client.buildError) return this.error(message.channel, 'Build error detected, please resolve before continuing. See CI job on GitLab.');
await this.loading(message.channel, 'Restarting...');
return process.exit(1);
} catch (error) {
return this.client.util.handleError(error, message, this);
}
}
}