From 0ba3dc64bb604523553b7205c1cd007804fdfe7b Mon Sep 17 00:00:00 2001 From: Navy Date: Sat, 8 May 2021 12:33:41 +0300 Subject: [PATCH] misc client fixes --- .../client/components/observers/Automoderation.js | 4 +++- .../client/components/observers/GuildLogging.js | 13 ++++++++++++- .../settings/administration/IgnoreChannels.js | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/structure/client/components/observers/Automoderation.js b/structure/client/components/observers/Automoderation.js index 65aec04..a7148cb 100644 --- a/structure/client/components/observers/Automoderation.js +++ b/structure/client/components/observers/Automoderation.js @@ -395,7 +395,7 @@ module.exports = class AutoModeration extends Observer { if (!action) return msg.delete(); - msg.filtered.sactioned = true; + msg.filtered.sanctioned = true; this.client.rateLimiter.queueDelete(msg.channel, msg); //msg.delete(); @@ -451,7 +451,9 @@ module.exports = class AutoModeration extends Observer { } async filterMentions(message) { + + } }; \ No newline at end of file diff --git a/structure/client/components/observers/GuildLogging.js b/structure/client/components/observers/GuildLogging.js index 80c6cb2..fb2c921 100644 --- a/structure/client/components/observers/GuildLogging.js +++ b/structure/client/components/observers/GuildLogging.js @@ -107,6 +107,7 @@ class GuildLogger extends Observer { }, timestamp: message.createdAt }; + if (message.filtered) { embed.fields = [ { @@ -135,22 +136,32 @@ class GuildLogger extends Observer { const files = []; for (const attachment of sortedAttachments) { + const attachmentData = attachments.find((a) => a.attachmentId === attachment.id); + if (attachmentData) { + attachmentData.buffer = Buffer.from(attachmentData.buffer, 'base64'); const messageAttachment = new MessageAttachment(attachmentData.buffer, attachment.name, { size: attachment.size }); + if (messageAttachment.size < CONSTANTS.IMAGES.UPLOAD_LIMIT[message.guild.premiumTier] * CONSTANTS.IMAGES.MB_DIVIDER) { + if (imageExtensions.includes(attachment.extension) && uploadedFiles.length === 0) { + uploadedFiles.push(messageAttachment); embed.image = { url: `attachment://${attachment.name}` }; + } else { + if (messageAttachment.size > 8 * CONSTANTS.IMAGES.MB_DIVIDER) { + const combined = uploadedFiles.length > 0 ? uploadedFiles.map((f) => f.size).reduce((p, v) => p + v) : 0; if ((combined + messageAttachment.size) / CONSTANTS.IMAGES.MB_DIVIDER < CONSTANTS.IMAGES.UPLOAD_LIMIT[message.guild.premiumTier]) { uploadedFiles.push(messageAttachment); } + } else { files.push(messageAttachment); } @@ -166,7 +177,7 @@ class GuildLogger extends Observer { const attachmentMessage = await this.attachmentWebhook.send(null, files).catch((error) => this.client.logger.error(error)); attachmentMessage.attachments.map((a) => uploaded.push(`[${a.filename} (${(a.size / CONSTANTS.IMAGES.MB_DIVIDER).toFixed(2)}mb)](${a.url})`)); }; - + console.log(files) for (const file of files) { const currentMb = currentFiles.length > 0 ? currentFiles.map((f) => f.size).reduce((p, v) => p + v) : 0; if (currentMb + file.size > 8 * CONSTANTS.IMAGES.MB_DIVIDER) { diff --git a/structure/client/components/settings/administration/IgnoreChannels.js b/structure/client/components/settings/administration/IgnoreChannels.js index c2e82ce..4840b0f 100644 --- a/structure/client/components/settings/administration/IgnoreChannels.js +++ b/structure/client/components/settings/administration/IgnoreChannels.js @@ -13,7 +13,7 @@ class IgnoreSetting extends Setting { 'channelIgnores', 'ignore' ], - usage: ' [value..]', + usage: ' [value..]', examples: [ 'ignore add #channel', 'ignore remove #channel',