misc client fixes

This commit is contained in:
Erik 2021-05-08 12:33:41 +03:00
parent 10fda573fe
commit 0ba3dc64bb
3 changed files with 16 additions and 3 deletions

View File

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

View File

@ -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) {

View File

@ -13,7 +13,7 @@ class IgnoreSetting extends Setting {
'channelIgnores',
'ignore'
],
usage: '<method|value> [value..]',
usage: '<method> [value..]',
examples: [
'ignore add #channel',
'ignore remove #channel',