Commit da3bd344 authored by nanahira's avatar nanahira

fix bad desc filter

parent cc74189c
......@@ -33,15 +33,14 @@ export class OrderPickerConfig {
);
}
isBad(text: string) {
return !this.blacklistMatchers.some((matcher) => text.match(matcher));
}
acceptMessage(session: Session) {
if (!session.userId || !this.publishers.includes(session.userId)) {
return false;
}
if (
this.blacklistMatchers.some((matcher) => session.content.match(matcher))
) {
return false;
}
const segments = segment.parse(session.content);
if (!segments.find((s) => s.type === 'at' && s.data.type === 'all')) {
return false;
......
......@@ -29,7 +29,7 @@ function plainText(text: string) {
.trim();
}
export class SelfOnline {
class SelfOnline {
@CacheKey()
selfId: string;
......@@ -37,7 +37,7 @@ export class SelfOnline {
}
@CacheTTL(60000)
export class LastMessage {
class LastMessage {
@CacheKey()
guildId: string;
userId: string;
......@@ -159,6 +159,9 @@ export default class OrderPicker extends base {
if (lastMessageContent) {
description = lastMessageContent + '\n' + description;
}
if (this.config.isBad(description)) {
return next();
}
await session.bot.sendPrivateMessage(
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