excluded_message_regex -> _regexes

This commit is contained in:
Dragory 2019-10-11 23:43:52 +03:00
parent 66ccba6a2d
commit 83f4e0c982

View file

@ -38,7 +38,7 @@ const LogChannel = t.partial({
batched: t.boolean, batched: t.boolean,
batch_time: t.number, batch_time: t.number,
excluded_users: t.array(t.string), excluded_users: t.array(t.string),
excluded_message_regex: t.array(TSafeRegex), excluded_message_regexes: t.array(TSafeRegex),
}); });
type TLogChannel = t.TypeOf<typeof LogChannel>; type TLogChannel = t.TypeOf<typeof LogChannel>;
@ -150,16 +150,16 @@ export class LogsPlugin extends ZeppelinPlugin<TConfigSchema> {
} }
} }
if (type === LogType.MESSAGE_DELETE && opts.excluded_message_regex && data.message.data.content) { if (type === LogType.MESSAGE_DELETE && opts.excluded_message_regexes && data.message.data.content) {
for (const regex of opts.excluded_message_regex) { for (const regex of opts.excluded_message_regexes) {
if (regex.test(data.message.data.content)) { if (regex.test(data.message.data.content)) {
return; return;
} }
} }
} }
if (type === LogType.MESSAGE_EDIT && opts.excluded_message_regex && data.before.data.content) { if (type === LogType.MESSAGE_EDIT && opts.excluded_message_regexes && data.before.data.content) {
for (const regex of opts.excluded_message_regex) { for (const regex of opts.excluded_message_regexes) {
if (regex.test(data.before.data.content)) { if (regex.test(data.before.data.content)) {
return; return;
} }