Skip to content

Commit

Permalink
add extra chat filter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
stdcall0 committed Jun 10, 2024
1 parent 3795c70 commit aca8581
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/chat_filter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const enabled_group = [679169029]
const filter_prefix = "我是王俊超"
const filter_prefix_list = [
"我是王俊超",
"我是wjc"
]

const extra_filter_uid = [2318422439]
const extra_filter_prefix = "我是"
Expand Down Expand Up @@ -34,8 +37,11 @@ export class ChatFilterPlugin extends Plugin {
return;
}

const message: string = this.e.raw_message;
if (message.trimStart().startsWith(filter_prefix)) {
let message: string = this.e.raw_message;
message = message.trimStart().replace(" ", "");

// recall if starts with filter_prefix
if (filter_prefix_list.some(prefix => message.trimStart().startsWith(prefix))) {
this.e.group.recallMsg(this.e.message_id);
return;
}
Expand Down

0 comments on commit aca8581

Please sign in to comment.