require attachment logs be in nsfw + regex tweaks

This commit is contained in:
Erik 2021-06-09 22:35:56 +03:00
parent b8319a4b36
commit 1e7386f06f
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16
6 changed files with 21 additions and 5 deletions

View File

@ -100,7 +100,7 @@ class GuildLogger extends Observer {
name: `${message.author.tag} (${message.author.id})`,
icon_url: message.author.displayAvatarURL({ size: 32 }) //eslint-disable-line camelcase
},
description: Util.escapeMarkdown(message.content)?.replace(/\\n/gu, ' '),
description: Util.escapeMarkdown(message.content)?.replace(/\\n/gu, ' ') || message.format('MSGLOG_NOCONTENT'),
color: CONSTANTS.COLORS.RED,
footer: {
text: `Message deleted in #${message.channel.name} | Message ID: ${message.id}`
@ -121,7 +121,7 @@ class GuildLogger extends Observer {
}
const uploadedFiles = [];
if(message.attachments.size > 0 && messageLog.attachments) {
if(message.attachments.size > 0 && messageLog.attachments && logChannel.nsfw) {
const imageExtensions = ['.png', '.webp', '.jpg', '.jpeg', '.gif'];
const data = await this.client.storageManager.mongodb.messages.findOne({
id: message.id
@ -248,6 +248,7 @@ class GuildLogger extends Observer {
let { member, content } = message;
const { author, id } = message;
content = Util.escapeMarkdown(content);
if (author.bot) continue;
if (!member || member.partial) member = await guild.members.fetch(message.author.id).catch(() => {

View File

@ -163,8 +163,14 @@ class MessageLogsSetting extends Setting {
const [bool] = args;
const result = this.client.resolver.resolveBoolean(bool);
const channel = await guild.resolveChannel(setting.channel);
if (result) {
if (channel && !channel.nsfw) return {
error: true,
msg: message.format('S_MESSAGELOG_NSFW')
};
setting.attachments = true;
index = 'S_MESSAGELOG_ATTACHMENTS';

View File

@ -81,11 +81,14 @@ module.exports = class WordFilter extends FilterSetting {
if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg, ['?', '\\', '(', ')', '|', '\\[', '\\]', '.', '-', '<']));
const resolved = await resolver.resolveMethod([first, ...args], {
existing: setting[method],
allowedMethods: ['add', 'remove', 'set', 'reset']
allowedMethods: ['add', 'remove', 'set', 'reset', 'list']
});
if (!resolved) return {
error: true,
msg: message.format('ERR_INVALID_METHOD', { method: resolved.method || args[0] })
msg: message.format('ERR_INVALID_METHOD', { method: first || args[0] })
};
else if (resolved.method === 'list') return {
msg: `\`${setting[method].join('`, `')}\``
};
else if (args.length < 1 && resolved.method !== 'reset') return {
error: true,

View File

@ -69,6 +69,9 @@ Link filter violation.
[MSGLOG_DELETE_TITLE]
{emoji_trash} {author}'s message was deleted in #{channel}
[MSGLOG_NOCONTENT]
**__NO TEXT CONTENT__**
[MSGLOG_FILTERED]
The message was filtered:

View File

@ -778,6 +778,9 @@ Successfully reset the message logger bypass list.
[S_MESSAGELOG_ATTACHMENTS]
Successfully turned attachment logging **{changed}**.
[S_MESSAGELOG_NSFW]
To enable attachment logging the channel needs to be marked nsfw.
[S_MESSAGELOG_RESET]
Successfully reset the chatlogs setting.

View File

@ -4,7 +4,7 @@
"n(ae|ea|ji|j|y|i|x|!|1|\\||l)(gg?|qq|99?|bb)(?!(ht|el))((e|3)r|let|ur|\\s?nog|y|ah?|or)?s?",
"(?<!u)niqa?",
"nick\\s?(gurr?|ger|ga)",
"(fur\\s?)?f(e|a|4|x)(gg?|qq?|99?)(otry|ots|ot|y|s)?",
"(fur\\s?)?f(e|a|4|x)(gg?|qq|99?)(otry|ots|ot|y|s)?",
"(fur\\s?)?fgg?ts?",
"negro(id|e)?s?",
"g(o|0)(o|0)k",