forked from engineering/cloudservices
Message update
parent
350466a6a9
commit
532dbcc320
|
@ -16,7 +16,7 @@ export default class Pull extends Command {
|
||||||
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;
|
||||||
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\n$ git pull\n\`\`\``);
|
||||||
let pull: string;
|
let pull: string;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -40,7 +40,7 @@ export default class Pull extends Command {
|
||||||
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} ***Pulled latest commit***\n${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`)
|
||||||
.replace(/```$/, `${pull}\nyarn install\n\`\`\``);
|
.replace(/```$/, `${pull}\n$ yarn install\n\`\`\``);
|
||||||
const passedPull = await updateMessage.edit(continueMessage);
|
const passedPull = await updateMessage.edit(continueMessage);
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,11 +56,11 @@ export default class Pull extends Command {
|
||||||
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...***`)
|
||||||
.replace(/```$/, `${install}\nyarn run build\n\`\`\``);
|
.replace(/```$/, `${install}\n$ yarn run build\n\`\`\``);
|
||||||
updatedPackages = await updateMessage.edit(updatedMessage);
|
updatedPackages = await updateMessage.edit(updatedMessage);
|
||||||
} else if (install.includes('success Saved lockfile.')) {
|
} else if (install.includes('success Saved lockfile.')) {
|
||||||
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...***`)
|
||||||
.replace(/```$/, `${install}\nyarn run build\n\`\`\``);
|
.replace(/```$/, `${install}\n$ yarn run build\n\`\`\``);
|
||||||
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.error} ***Unexpected yarn install output***`)
|
const updatedMessage = passedPull.content.replace(`${this.client.stores.emojis.loading} ***Reinstalling dependencies...***`, `${this.client.stores.emojis.error} ***Unexpected yarn install output***`)
|
||||||
|
|
|
@ -14,7 +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***`);
|
if (this.client.buildError) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Build error, resolve before restarting. See CI job on Gitlab***`);
|
||||||
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