Fix too long error
parent
58989a9b7e
commit
6a0596d3a4
|
@ -1,4 +1,5 @@
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
|
import axios from 'axios';
|
||||||
import { Client } from '..';
|
import { Client } from '..';
|
||||||
import { Command } from '../class';
|
import { Command } from '../class';
|
||||||
|
|
||||||
|
@ -68,8 +69,21 @@ 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) {
|
||||||
const 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`);
|
||||||
+ `\`\`\`\n${error.message}\n\`\`\``);
|
if (error.message.length < 1800) updatedMessage += `\`\`\`\n${error.message}\n\`\`\``;
|
||||||
|
else {
|
||||||
|
const split = this.client.util.splitString(error.message, 1975);
|
||||||
|
if (split[5]) {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.post('https://snippets.cloud.libraryofcode.org/documents', split.join(''));
|
||||||
|
updatedMessage += `${this.client.stores.emojis.success} The error output can be found on https://snippets.cloud.libraryofcode.org/${data.key}`;
|
||||||
|
} catch (e) {
|
||||||
|
updatedMessage += `${this.client.stores.emojis.error} Could not upload error: ${e}`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
split.forEach((m) => message.channel.createMessage(`\`\`\`bash\n${m}\n\`\`\``));
|
||||||
|
}
|
||||||
|
}
|
||||||
this.client.buildError = true;
|
this.client.buildError = true;
|
||||||
this.client.updating = false;
|
this.client.updating = false;
|
||||||
return updateMessage.edit(updatedMessage);
|
return updateMessage.edit(updatedMessage);
|
||||||
|
|
Loading…
Reference in New Issue