Don't restart if build error
parent
7bc601b685
commit
495159336b
|
@ -14,6 +14,7 @@ export default class Pull extends Command {
|
||||||
|
|
||||||
public async run(message: Message) {
|
public async run(message: Message) {
|
||||||
try {
|
try {
|
||||||
|
if (this.client.updating) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`);
|
||||||
this.client.updating = true;
|
this.client.updating = true;
|
||||||
const updateMessage = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Fetching latest commit...***\n\`\`\`sh\ngit pull\n\`\`\``);
|
const updateMessage = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Fetching latest commit...***\n\`\`\`sh\ngit pull\n\`\`\``);
|
||||||
let pull: string;
|
let pull: string;
|
||||||
|
@ -74,12 +75,14 @@ export default class Pull extends Command {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const updatedMessage = updatedPackages.content.replace(`${this.client.stores.emojis.loading} ***Rebuilding files...***`, `${this.client.stores.emojis.error} ***Failed to rebuild files***`)
|
const updatedMessage = updatedPackages.content.replace(`${this.client.stores.emojis.loading} ***Rebuilding files...***`, `${this.client.stores.emojis.error} ***Failed to rebuild files***`)
|
||||||
.replace(/```$/, `${error.message}\n\`\`\``);
|
.replace(/```$/, `${error.message}\n\`\`\``);
|
||||||
|
this.client.buildError = true;
|
||||||
this.client.updating = false;
|
this.client.updating = false;
|
||||||
return updateMessage.edit(updatedMessage);
|
return updateMessage.edit(updatedMessage);
|
||||||
}
|
}
|
||||||
const finalMessage = updatedPackages.content.replace(`${this.client.stores.emojis.loading} ***Rebuilding files...***`, `${this.client.stores.emojis.success} ***Files rebuilt***`)
|
const finalMessage = updatedPackages.content.replace(`${this.client.stores.emojis.loading} ***Rebuilding files...***`, `${this.client.stores.emojis.success} ***Files rebuilt***`)
|
||||||
.replace(/```$/, `${build}\n\`\`\``);
|
.replace(/```$/, `${build}\n\`\`\``);
|
||||||
this.client.updating = false;
|
this.client.updating = false;
|
||||||
|
this.client.buildError = false;
|
||||||
return updateMessage.edit(finalMessage);
|
return updateMessage.edit(finalMessage);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.client.updating = false;
|
this.client.updating = false;
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default class Restart extends Command {
|
||||||
public async run(message: Message, args: string[]) {
|
public async run(message: Message, args: string[]) {
|
||||||
try {
|
try {
|
||||||
if (this.client.updating && args[0] !== '-f') return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`);
|
if (this.client.updating && args[0] !== '-f') return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`);
|
||||||
|
if (this.client.buildError) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Build error, resolve before restarting***`);
|
||||||
await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Restarting...***`);
|
await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Restarting...***`);
|
||||||
return process.exit(1);
|
return process.exit(1);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue