1
0
Fork 0

Add force update version

refactor/models
Bsian 2020-05-04 02:14:31 +01:00
parent ff3f4c0e9f
commit e8cfac48cc
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 4 additions and 3 deletions

View File

@ -13,7 +13,7 @@ export default class Pull extends Command {
this.permissions = { roles: ['662163685439045632'] }; this.permissions = { roles: ['662163685439045632'] };
} }
public async run(message: Message) { public async run(message: Message, args: string[]) {
try { try {
if (this.client.updating) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`); if (this.client.updating) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`);
this.client.updating = true; this.client.updating = true;
@ -28,7 +28,7 @@ export default class Pull extends Command {
this.client.updating = false; this.client.updating = false;
return updateMessage.edit(updatedMessage); return updateMessage.edit(updatedMessage);
} }
if (pull.includes('Already up to date')) { if (pull.includes('Already up to date') && args[0] !== '-f') {
const updatedMessage = updateMessage.content.replace(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`, `${this.client.stores.emojis.success} ***No updates available***`); const updatedMessage = updateMessage.content.replace(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`, `${this.client.stores.emojis.success} ***No updates available***`);
this.client.updating = false; this.client.updating = false;
return updateMessage.edit(updatedMessage); return updateMessage.edit(updatedMessage);
@ -38,7 +38,8 @@ export default class Pull extends Command {
this.client.updating = false; this.client.updating = false;
return updateMessage.edit(updatedMessage); return updateMessage.edit(updatedMessage);
} }
const continueMessage = updateMessage.content.replace(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`, `${this.client.stores.emojis.success} ***Pulled latest commit***\n${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`); const continueMessage = updateMessage.content.replace(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`, `${this.client.stores.emojis.success} ***${pull.includes('Already up to date') ? 'No updates available' : 'Fetched latest commit'}***\n`
+ `${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`);
const passedPull = await updateMessage.edit(continueMessage); const passedPull = await updateMessage.edit(continueMessage);