This commit is contained in:
Erik 2022-05-04 02:26:32 +03:00
parent d29de648ed
commit 844e3f9baa
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 7 additions and 3 deletions

View File

@ -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}` });

View File

@ -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)}`);
});
}