forked from Galactic/galactic-bot
logging
This commit is contained in:
parent
d29de648ed
commit
844e3f9baa
@ -35,7 +35,10 @@ class Logger {
|
||||
this.manager = manager;
|
||||
this.shardingManager = manager.shardingManager;
|
||||
|
||||
this._webhook = new WebhookClient({ url: process.env.ERROR_WEBHOOK_URL });
|
||||
const { ERROR_WEBHOOK_URL } = process.env;
|
||||
if (ERROR_WEBHOOK_URL) this._webhook = new WebhookClient({ url: ERROR_WEBHOOK_URL });
|
||||
// eslint-disable-next-line no-console
|
||||
else console.log('No webhook for logger');
|
||||
|
||||
this._options = options;
|
||||
|
||||
@ -82,7 +85,7 @@ class Logger {
|
||||
const embed = {
|
||||
color: 0xe88388,
|
||||
timestamp: new Date(),
|
||||
description: `\`\`\`${message}\`\`\``,
|
||||
description: `\`\`\`${message.length > 2000 ? message.substring(0, 2000) + ' ... CONTENT CUT OFF' : message}\`\`\``,
|
||||
};
|
||||
|
||||
this._webhook.send({ embeds: [embed], username: `ENV: ${process.env.NODE_ENV}` });
|
||||
|
@ -2,6 +2,7 @@
|
||||
const { MessageAttachment, WebhookClient } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const moment = require('moment');
|
||||
const { inspect } = require('util');
|
||||
|
||||
const { Observer } = require('../../interfaces/');
|
||||
const { Util } = require('../../../utilities');
|
||||
@ -606,7 +607,7 @@ class GuildLogger extends Observer {
|
||||
//if(newMessage.content.length > 1024) embed.description += '\n' + oldMessage.format('MSGLOG_EDIT_NEW_CUTOFF');
|
||||
|
||||
await hook.send({ embeds: [embed] }).catch((err) => {
|
||||
this.logger.error('Error in message edit:\n' + err.stack);
|
||||
this.logger.error('Error in message edit:\n' + err.stack, `\n${inspect(embed)}`);
|
||||
});
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user