Skip to content

Commit

Permalink
Ban stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
boomzero committed Aug 6, 2024
1 parent 9d215b7 commit cd00930
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Source/Process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,8 @@ export class Process {
"ToUser": "string",
"Content": "string"
}));
if (this.DenyMessage()){
return new Result(false,"该用户已关闭短消息接收");
if (this.DenyMessage()) {
return new Result(false, "该用户已关闭短消息接收");
}
if (Data["Content"].startsWith("您好,我是") && ThrowErrorIfFailed(await this.IfUserExistChecker(Data["ToUser"]))["Exist"] === false) {
return new Result(false, "未找到用户");
Expand Down Expand Up @@ -1125,6 +1125,20 @@ export class Process {
if (Data["Content"].includes("管理员")) {
return new Result(false, "请不要试图冒充管理员");
}
const forbiddenPatterns = [
/อััััััััั/, // Specific problematic string
/[\u200E\u200F]/, // Left-to-Right and Right-to-Left markers
/\u0E31/, // Specific Thai character "ั"
/[\u202A-\u202E]/, // Bidirectional text control characters
/[\u2066-\u2069]/, // Additional bidirectional text control characters
/\uFEFF/, // Zero-width no-break space
/[\uFFF9-\uFFFB]/ // Interlinear annotation characters
];
for (const pattern of forbiddenPatterns) {
if (pattern.test(Data["Content"])) {
return new Result(false, "内容包含不允许的字符,导致渲染问题");
}
}
const check = await this.AI.run(
"@cf/huggingface/distilbert-sst-2-int8",
{
Expand Down

1 comment on commit cd00930

@ptsq-bot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boomzero 全是空格也要班

Please sign in to comment.