From 99a55f28623d9344af744aa3fe98aeca3b339703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E6=B5=B7?= Date: Wed, 20 Mar 2024 12:09:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=8C=87=E4=BB=A4=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wclient/robot/handler.go | 3 ++ webview/src/apps/keyword/create.html | 64 +++++++++++++++------------- webview/src/apps/keyword/create.ts | 5 +++ webview/src/apps/keyword/update.html | 64 +++++++++++++++------------- webview/src/apps/keyword/update.ts | 5 +++ 5 files changed, 81 insertions(+), 60 deletions(-) diff --git a/wclient/robot/handler.go b/wclient/robot/handler.go index 843dfdc..5dcca88 100644 --- a/wclient/robot/handler.go +++ b/wclient/robot/handler.go @@ -68,6 +68,9 @@ func ResetHandlers() { for _, v := range kws { if hmap[v.Target] != nil { hmap[v.Phrase+"@"+v.Roomid] = hmap[v.Target] + if v.Roomid == "*" { + hmap[v.Target].Level = v.Level + } } } } diff --git a/webview/src/apps/keyword/create.html b/webview/src/apps/keyword/create.html index 26ef059..95fa75f 100644 --- a/webview/src/apps/keyword/create.html +++ b/webview/src/apps/keyword/create.html @@ -18,8 +18,8 @@
- - @for (item of keywordGroups | keyvalue; track item.key) { } @@ -28,31 +28,6 @@ 关键词分组,标记短语的作用
- @if (formdata.group == 'badword') { -
- - -
- 用于违规积分累计,当前计 {{formdata.level}} 分 -
-
- } @else { -
- - -
- 用于限制指令使用权限,对指令别名无效 -
-
- }
填写可执行程序的绝对路径及参数,如:node.exe D:\wrest\app.js
@@ -79,8 +54,8 @@ } @if (formdata.group == 'handler') {
- - @for (item of robotHandler; track item.command) { } @@ -90,6 +65,35 @@
} + @if (formdata.group == 'badword') { +
+ + +
+ 用于违规积分累计,当前计 {{formdata.level}} 分 +
+
+ } @else { +
+ + +
+ @if (formdata.group == 'handler') { + 全局别名级别设置将重写原指令级别,其他场景则忽略 + } @else { + 用于限制外部指令的使用权限 + } +
+
+ }
diff --git a/webview/src/apps/keyword/create.ts b/webview/src/apps/keyword/create.ts index ed8a2d2..d4b2a1d 100644 --- a/webview/src/apps/keyword/create.ts +++ b/webview/src/apps/keyword/create.ts @@ -43,6 +43,11 @@ export class KeywordCreateComponent { }); } + public changeHandler() { + const h = this.robotHandler.find((h) => h.command === this.formdata.target); + this.formdata.level = h ? h.level : -1; + } + public getRobotHandlers() { return SundryApi.handlerList({}).then((data) => { this.robotHandler = data || []; diff --git a/webview/src/apps/keyword/update.html b/webview/src/apps/keyword/update.html index e75d310..9214f97 100644 --- a/webview/src/apps/keyword/update.html +++ b/webview/src/apps/keyword/update.html @@ -18,8 +18,8 @@
- - @for (item of keywordGroups | keyvalue; track item.key) { } @@ -28,31 +28,6 @@ 关键词分组,标记短语的作用
- @if (formdata.group == 'badword') { -
- - -
- 用于违规积分累计,当前计 {{formdata.level}} 分 -
-
- } @else { -
- - -
- 用于限制指令使用权限,对指令别名无效 -
-
- }
填写可执行程序的绝对路径及参数,如:node.exe D:\wrest\app.js
@@ -79,8 +54,8 @@ } @if (formdata.group == 'handler') {
- - @for (item of robotHandler; track item.command) { } @@ -90,6 +65,35 @@
} + @if (formdata.group == 'badword') { +
+ + +
+ 用于违规积分累计,当前计 {{formdata.level}} 分 +
+
+ } @else { +
+ + +
+ @if (formdata.group == 'handler') { + 全局别名级别设置将重写原指令级别,其他场景则忽略 + } @else { + 用于限制外部指令的使用权限 + } +
+
+ }
diff --git a/webview/src/apps/keyword/update.ts b/webview/src/apps/keyword/update.ts index df47a45..9ef6daf 100644 --- a/webview/src/apps/keyword/update.ts +++ b/webview/src/apps/keyword/update.ts @@ -51,6 +51,11 @@ export class KeywordUpdateComponent implements OnInit { }); } + public changeHandler() { + const h = this.robotHandler.find((h) => h.command === this.formdata.target); + this.formdata.level = h ? h.level : -1; + } + public getRobotHandlers() { return SundryApi.handlerList({}).then((data) => { this.robotHandler = data || [];