require attachment logs be in nsfw + regex tweaks
This commit is contained in:
parent
b8319a4b36
commit
1e7386f06f
@ -100,7 +100,7 @@ class GuildLogger extends Observer {
|
|||||||
name: `${message.author.tag} (${message.author.id})`,
|
name: `${message.author.tag} (${message.author.id})`,
|
||||||
icon_url: message.author.displayAvatarURL({ size: 32 }) //eslint-disable-line camelcase
|
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,
|
color: CONSTANTS.COLORS.RED,
|
||||||
footer: {
|
footer: {
|
||||||
text: `Message deleted in #${message.channel.name} | Message ID: ${message.id}`
|
text: `Message deleted in #${message.channel.name} | Message ID: ${message.id}`
|
||||||
@ -121,7 +121,7 @@ class GuildLogger extends Observer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uploadedFiles = [];
|
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 imageExtensions = ['.png', '.webp', '.jpg', '.jpeg', '.gif'];
|
||||||
const data = await this.client.storageManager.mongodb.messages.findOne({
|
const data = await this.client.storageManager.mongodb.messages.findOne({
|
||||||
id: message.id
|
id: message.id
|
||||||
@ -248,6 +248,7 @@ class GuildLogger extends Observer {
|
|||||||
|
|
||||||
let { member, content } = message;
|
let { member, content } = message;
|
||||||
const { author, id } = message;
|
const { author, id } = message;
|
||||||
|
content = Util.escapeMarkdown(content);
|
||||||
|
|
||||||
if (author.bot) continue;
|
if (author.bot) continue;
|
||||||
if (!member || member.partial) member = await guild.members.fetch(message.author.id).catch(() => {
|
if (!member || member.partial) member = await guild.members.fetch(message.author.id).catch(() => {
|
||||||
|
@ -163,8 +163,14 @@ class MessageLogsSetting extends Setting {
|
|||||||
|
|
||||||
const [bool] = args;
|
const [bool] = args;
|
||||||
const result = this.client.resolver.resolveBoolean(bool);
|
const result = this.client.resolver.resolveBoolean(bool);
|
||||||
|
const channel = await guild.resolveChannel(setting.channel);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
||||||
|
if (channel && !channel.nsfw) return {
|
||||||
|
error: true,
|
||||||
|
msg: message.format('S_MESSAGELOG_NSFW')
|
||||||
|
};
|
||||||
|
|
||||||
setting.attachments = true;
|
setting.attachments = true;
|
||||||
index = 'S_MESSAGELOG_ATTACHMENTS';
|
index = 'S_MESSAGELOG_ATTACHMENTS';
|
||||||
|
@ -81,11 +81,14 @@ module.exports = class WordFilter extends FilterSetting {
|
|||||||
if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg, ['?', '\\', '(', ')', '|', '\\[', '\\]', '.', '-', '<']));
|
if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg, ['?', '\\', '(', ')', '|', '\\[', '\\]', '.', '-', '<']));
|
||||||
const resolved = await resolver.resolveMethod([first, ...args], {
|
const resolved = await resolver.resolveMethod([first, ...args], {
|
||||||
existing: setting[method],
|
existing: setting[method],
|
||||||
allowedMethods: ['add', 'remove', 'set', 'reset']
|
allowedMethods: ['add', 'remove', 'set', 'reset', 'list']
|
||||||
});
|
});
|
||||||
if (!resolved) return {
|
if (!resolved) return {
|
||||||
error: true,
|
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 {
|
else if (args.length < 1 && resolved.method !== 'reset') return {
|
||||||
error: true,
|
error: true,
|
||||||
|
@ -69,6 +69,9 @@ Link filter violation.
|
|||||||
[MSGLOG_DELETE_TITLE]
|
[MSGLOG_DELETE_TITLE]
|
||||||
{emoji_trash} {author}'s message was deleted in #{channel}
|
{emoji_trash} {author}'s message was deleted in #{channel}
|
||||||
|
|
||||||
|
[MSGLOG_NOCONTENT]
|
||||||
|
**__NO TEXT CONTENT__**
|
||||||
|
|
||||||
[MSGLOG_FILTERED]
|
[MSGLOG_FILTERED]
|
||||||
The message was filtered:
|
The message was filtered:
|
||||||
|
|
||||||
|
@ -778,6 +778,9 @@ Successfully reset the message logger bypass list.
|
|||||||
[S_MESSAGELOG_ATTACHMENTS]
|
[S_MESSAGELOG_ATTACHMENTS]
|
||||||
Successfully turned attachment logging **{changed}**.
|
Successfully turned attachment logging **{changed}**.
|
||||||
|
|
||||||
|
[S_MESSAGELOG_NSFW]
|
||||||
|
To enable attachment logging the channel needs to be marked nsfw.
|
||||||
|
|
||||||
[S_MESSAGELOG_RESET]
|
[S_MESSAGELOG_RESET]
|
||||||
Successfully reset the chatlogs setting.
|
Successfully reset the chatlogs setting.
|
||||||
|
|
||||||
|
@ -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?",
|
"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?",
|
"(?<!u)niqa?",
|
||||||
"nick\\s?(gurr?|ger|ga)",
|
"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?",
|
"(fur\\s?)?fgg?ts?",
|
||||||
"negro(id|e)?s?",
|
"negro(id|e)?s?",
|
||||||
"g(o|0)(o|0)k",
|
"g(o|0)(o|0)k",
|
||||||
|
Loading…
Reference in New Issue
Block a user