forked from engineering/cloudservices
Fix pull command not editing
parent
d8a240185d
commit
6d7d72e50e
|
@ -22,23 +22,23 @@ export default class Pull extends Command {
|
||||||
try {
|
try {
|
||||||
pull = await this.client.util.exec('git pull', { cwd: '/opt/CloudServices' });
|
pull = await this.client.util.exec('git pull', { cwd: '/opt/CloudServices' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const updatedMessage = updateMessage.content.replace(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`, `${this.client.stores.emojis.error} ***Could not fetch latest commit***\n`
|
const updatedMessage = updateMessage.content.replace(`***${this.client.stores.emojis.loading} Fetching latest commit...***`, `***${this.client.stores.emojis.error} Could not fetch latest commit***\n`
|
||||||
+ `\`\`\`\n${error.message}\n\`\`\``);
|
+ `\`\`\`\n${error.message}\n\`\`\``);
|
||||||
this.client.updating = false;
|
this.client.updating = false;
|
||||||
return updateMessage.edit(updatedMessage);
|
return updateMessage.edit(updatedMessage);
|
||||||
}
|
}
|
||||||
if (pull.includes('Already up to date') && args[0] !== '-f') {
|
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);
|
||||||
}
|
}
|
||||||
if (!pull.includes('origin/master') && !pull.includes(' changed, ')) {
|
if (!pull.includes('origin/master') && !pull.includes(' changed, ')) {
|
||||||
const updatedMessage = updateMessage.content.replace(`${this.client.stores.emojis.loading} ***Fetching latest commit...***`, `${this.client.stores.emojis.error} ***Unexpected git output***`);
|
const updatedMessage = updateMessage.content.replace(`***${this.client.stores.emojis.loading} Fetching latest commit...***`, `***${this.client.stores.emojis.error} Unexpected git output***`);
|
||||||
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} ***${pull.includes('Already up to date') ? 'No updates available' : 'Fetched latest commit'}***\n`
|
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...***`);
|
+ `***${this.client.stores.emojis.loading} Reinstalling dependencies...***`);
|
||||||
const passedPull = await updateMessage.edit(continueMessage);
|
const passedPull = await updateMessage.edit(continueMessage);
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,16 +47,16 @@ export default class Pull extends Command {
|
||||||
install = await this.client.util.exec('yarn install', { cwd: '/opt/CloudServices' });
|
install = await this.client.util.exec('yarn install', { cwd: '/opt/CloudServices' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.client.updating = false;
|
this.client.updating = false;
|
||||||
const updatedMessage = passedPull.content.replace(`${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`, `${this.client.stores.emojis.error} ***Failed to reinstall dependencies***\n`
|
const updatedMessage = passedPull.content.replace(`***${this.client.stores.emojis.loading} Reinstalling dependencies...***`, `***${this.client.stores.emojis.error} Failed to reinstall dependencies***\n`
|
||||||
+ `\`\`\`\n${error.message}\n\`\`\``);
|
+ `\`\`\`\n${error.message}\n\`\`\``);
|
||||||
return updateMessage.edit(updatedMessage);
|
return updateMessage.edit(updatedMessage);
|
||||||
}
|
}
|
||||||
let updatedPackages: Message;
|
let updatedPackages: Message;
|
||||||
if (install.includes('Already up-to-date')) {
|
if (install.includes('Already up-to-date')) {
|
||||||
const updatedMessage = passedPull.content.replace(`${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`, `${this.client.stores.emojis.success} ***No dependency updates available***\n${this.client.stores.emojis.loading} ***Rebuilding files...***`);
|
const updatedMessage = passedPull.content.replace(`***${this.client.stores.emojis.loading} Reinstalling dependencies...***`, `***${this.client.stores.emojis.success} No dependency updates available***\n***${this.client.stores.emojis.loading} Rebuilding files...***`);
|
||||||
updatedPackages = await updateMessage.edit(updatedMessage);
|
updatedPackages = await updateMessage.edit(updatedMessage);
|
||||||
} else {
|
} else {
|
||||||
const updatedMessage = passedPull.content.replace(`${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`, `${this.client.stores.emojis.success} ***Updated dependencies***\n${this.client.stores.emojis.loading} ***Rebuilding files...***`);
|
const updatedMessage = passedPull.content.replace(`***${this.client.stores.emojis.loading} Reinstalling dependencies...***`, `***${this.client.stores.emojis.success} Updated dependencies***\n***${this.client.stores.emojis.loading} Rebuilding files...***`);
|
||||||
updatedPackages = await updateMessage.edit(updatedMessage);
|
updatedPackages = await updateMessage.edit(updatedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ export default class Pull extends Command {
|
||||||
try {
|
try {
|
||||||
build = await this.client.util.exec('yarn run build', { cwd: '/opt/CloudServices' });
|
build = await this.client.util.exec('yarn run build', { cwd: '/opt/CloudServices' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
let updatedMessage = updatedPackages.content.replace(`${this.client.stores.emojis.loading} ***Rebuilding files...***`, `${this.client.stores.emojis.error} ***Failed to rebuild files***\n`);
|
let updatedMessage = updatedPackages.content.replace(`***${this.client.stores.emojis.loading} Rebuilding files...***`, `***${this.client.stores.emojis.error} Failed to rebuild files***\n`);
|
||||||
if (error.message.length < 1800) updatedMessage += `\`\`\`\n${error.message}\n\`\`\``;
|
if (error.message.length < 1800) updatedMessage += `\`\`\`\n${error.message}\n\`\`\``;
|
||||||
else {
|
else {
|
||||||
const split = this.client.util.splitString(error.message, 1975);
|
const split = this.client.util.splitString(error.message, 1975);
|
||||||
|
@ -83,7 +83,7 @@ export default class Pull extends Command {
|
||||||
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***`);
|
||||||
this.client.updating = false;
|
this.client.updating = false;
|
||||||
this.client.buildError = false;
|
this.client.buildError = false;
|
||||||
return updateMessage.edit(finalMessage);
|
return updateMessage.edit(finalMessage);
|
||||||
|
|
Loading…
Reference in New Issue