1
0
Fork 0
refactor/models
Bsian 2019-10-20 18:08:16 +01:00
parent e283251e68
commit 78a858fbed
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ export default class Util {
} }
public async handleError(error: Error, message?: Message, command?: Command): Promise<void> { public async handleError(error: Error, message?: Message, command?: Command): Promise<void> {
const info = { content: `\`\`\`js\n${error.stack}\n\`\`\``, embed: null } const info = { content: `\`\`\`js\n${error.stack}\n\`\`\``, embed: null };
if (message) { if (message) {
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setColor('FF0000'); embed.setColor('FF0000');
@ -48,13 +48,13 @@ export default class Util {
embed.addField('Channel', message.channel.mention, true); embed.addField('Channel', message.channel.mention, true);
let guild: string; let guild: string;
if (message.channel instanceof PrivateChannel) guild = '@me'; if (message.channel instanceof PrivateChannel) guild = '@me';
else guild = message.channel.guild.id else guild = message.channel.guild.id;
embed.addField('Message link', `[Click here](https://discordapp.com/channels/${guild}/${message.channel.id}/${message.id})`, true) embed.addField('Message link', `[Click here](https://discordapp.com/channels/${guild}/${message.channel.id}/${message.id})`, true);
embed.setTimestamp(new Date(message.timestamp)); embed.setTimestamp(new Date(message.timestamp));
info.embed = embed; info.embed = embed;
} }
await this.client.createMessage('595788220764127272', info); await this.client.createMessage('595788220764127272', info);
if (message) this.client.createMessage('595788220764127272', `Message content for above error`) if (message) this.client.createMessage('595788220764127272', 'Message content for above error');
if (command) this.client.commands.get(command.name).enabled = false; if (command) this.client.commands.get(command.name).enabled = false;
if (message) message.channel.createMessage(`***${this.client.stores.emojis.error} An unexpected error has occured - please contact a member of the Engineering Team.${command ? ' This command has been disabled.' : ''}***`); if (message) message.channel.createMessage(`***${this.client.stores.emojis.error} An unexpected error has occured - please contact a member of the Engineering Team.${command ? ' This command has been disabled.' : ''}***`);
} }