cloudservices/src/commands/restart.ts

24 lines
869 B
TypeScript
Raw Normal View History

2019-11-18 15:14:43 -05:00
import { Message } from 'eris';
2020-06-29 02:50:26 -04:00
import { Client, Command } from '../class';
2019-11-18 15:14:43 -05:00
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 {
2020-06-29 02:35:14 -04:00
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...');
2019-11-18 15:14:43 -05:00
return process.exit(1);
} catch (error) {
return this.client.util.handleError(error, message, this);
}
}
}