1
0
Fork 0

Message update

refactor/models
Bsian 2019-12-17 00:04:39 +00:00
parent 350466a6a9
commit 532dbcc320
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
2 changed files with 5 additions and 5 deletions

View File

@ -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***`)

View File

@ -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) {