Commit da3bd344 authored by nanahira's avatar nanahira

fix bad desc filter

parent cc74189c
...@@ -33,15 +33,14 @@ export class OrderPickerConfig { ...@@ -33,15 +33,14 @@ export class OrderPickerConfig {
); );
} }
isBad(text: string) {
return !this.blacklistMatchers.some((matcher) => text.match(matcher));
}
acceptMessage(session: Session) { acceptMessage(session: Session) {
if (!session.userId || !this.publishers.includes(session.userId)) { if (!session.userId || !this.publishers.includes(session.userId)) {
return false; return false;
} }
if (
this.blacklistMatchers.some((matcher) => session.content.match(matcher))
) {
return false;
}
const segments = segment.parse(session.content); const segments = segment.parse(session.content);
if (!segments.find((s) => s.type === 'at' && s.data.type === 'all')) { if (!segments.find((s) => s.type === 'at' && s.data.type === 'all')) {
return false; return false;
......
...@@ -29,7 +29,7 @@ function plainText(text: string) { ...@@ -29,7 +29,7 @@ function plainText(text: string) {
.trim(); .trim();
} }
export class SelfOnline { class SelfOnline {
@CacheKey() @CacheKey()
selfId: string; selfId: string;
...@@ -37,7 +37,7 @@ export class SelfOnline { ...@@ -37,7 +37,7 @@ export class SelfOnline {
} }
@CacheTTL(60000) @CacheTTL(60000)
export class LastMessage { class LastMessage {
@CacheKey() @CacheKey()
guildId: string; guildId: string;
userId: string; userId: string;
...@@ -159,6 +159,9 @@ export default class OrderPicker extends base { ...@@ -159,6 +159,9 @@ export default class OrderPicker extends base {
if (lastMessageContent) { if (lastMessageContent) {
description = lastMessageContent + '\n' + description; description = lastMessageContent + '\n' + description;
} }
if (this.config.isBad(description)) {
return next();
}
await session.bot.sendPrivateMessage( await session.bot.sendPrivateMessage(
this.config.masterId, this.config.masterId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment