x
This commit is contained in:
@@ -270,7 +270,7 @@ interface Sender {
|
||||
getUserName(): string; //获取用户昵称
|
||||
getChatId(): string; //获取群聊ID
|
||||
getChatName(): string; //获取群聊名称
|
||||
getMessageId(): {message_id: string, error: string}; //获取消息ID
|
||||
getMessageId(): string; //获取消息ID
|
||||
getContent(): string; //获取消息内容
|
||||
continue(): void; //使消息继续往下匹配正则,消息正常第一次被匹配就会停止继续匹配
|
||||
setContent(content: string): void; //修改接收到的消息内容,可配合`continue`被其他规则匹配
|
||||
@@ -292,7 +292,7 @@ interface Sender {
|
||||
isAdmin(): boolean; //判断消息是否来自管理员
|
||||
getPlatform(): string; //获取消息平台
|
||||
getBotId(): string; //获取机器人ID
|
||||
reply(content: string): string; //回复消息,媒体消息推荐使用CQ码实现,返回消息ID
|
||||
reply(content: string): {message_id: string, error: string}; //回复消息,媒体消息推荐使用CQ码实现,返回消息ID
|
||||
recallMessage(meesageId: string | string[] | number): {error: string}; //撤回消息,number类型时为延时毫秒
|
||||
kick(user_id: string): {error: string}; //移出群聊
|
||||
unkick(user_id: string): {error: string}; //取消移出群聊
|
||||
@@ -410,7 +410,7 @@ interface Bucket(name: string) {
|
||||
get(key: string, defaultValue: any): any; // 取值
|
||||
set(key: string, value: any): Error | null; // 设值
|
||||
watch(key: string, event: (old: any, new_: any, key: string) => void); // 设置监听器,key 值为 * 时将监听整个桶的存储事件
|
||||
foreach(func: (key: string, value: any) => void): void; // 遍历值
|
||||
getAll(): []; // 获取全部值
|
||||
delete(key: string): Error | null; // 删值
|
||||
empty(): Error | undefined; // 清空桶
|
||||
keys(): string[]; // 获取所有键名
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -8,6 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/admin/umi.6114f405.js"></script>
|
||||
<script src="/admin/umi.1177c492.js"></script>
|
||||
|
||||
</body></html>
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -39,6 +39,7 @@ type Function struct {
|
||||
HasForm bool `json:"has_form"`
|
||||
Carry bool `json:"carry"`
|
||||
Messages interface{} `json:"messages"`
|
||||
Classes []string `json:"classes"`
|
||||
}
|
||||
type Filter struct {
|
||||
BlackMode bool
|
||||
|
||||
@@ -283,6 +283,7 @@ func initPlugin(data string, uuid string) (*common.Function, []func(), error) {
|
||||
var FindAll bool
|
||||
var hasForm bool
|
||||
var carry bool
|
||||
var classes = []string{}
|
||||
ks := map[string]bool{}
|
||||
ress := regexp.MustCompile(
|
||||
`\*\s?@([\d\w+-]+)\s+([^\n]+?)\n`,
|
||||
@@ -345,6 +346,9 @@ func initPlugin(data string, uuid string) (*common.Function, []func(), error) {
|
||||
} else {
|
||||
rules = append(rules, rule)
|
||||
}
|
||||
case "class":
|
||||
classes = append(classes, regexp.MustCompile(`[\S]+`).FindAllString(res[2], -1)...)
|
||||
classes = utils.Unique(classes)
|
||||
case "platform", "imType", "platform+", "imType+":
|
||||
var item []string
|
||||
for _, i := range regexp.MustCompile(`[\d\w-]+`).FindAllString(res[2], -1) {
|
||||
@@ -399,6 +403,7 @@ func initPlugin(data string, uuid string) (*common.Function, []func(), error) {
|
||||
BlackMode: true,
|
||||
Items: item,
|
||||
}
|
||||
|
||||
case "admin":
|
||||
admin = strings.TrimSpace(res[2]) == "true"
|
||||
case "disable":
|
||||
@@ -623,6 +628,7 @@ func initPlugin(data string, uuid string) (*common.Function, []func(), error) {
|
||||
FindAll: FindAll,
|
||||
HasForm: hasForm,
|
||||
Carry: carry,
|
||||
Classes: classes,
|
||||
}
|
||||
running = func() bool {
|
||||
return f.Running
|
||||
|
||||
@@ -25,6 +25,7 @@ type RequestPluginResult struct {
|
||||
Tab2 int `json:"tab2"`
|
||||
Tab3 int `json:"tab3"`
|
||||
Time time.Time `json:"time"`
|
||||
Classes map[string]int `json:"classes"`
|
||||
}
|
||||
|
||||
var plugin_list = []*common.Function{}
|
||||
@@ -121,12 +122,16 @@ func initWebPluginList() {
|
||||
activeKey := ctx.Query("activeKey")
|
||||
init := ctx.Query("init")
|
||||
keyword := ctx.Query("keyword")
|
||||
class := ctx.Query("class")
|
||||
rr := RequestPluginResult{
|
||||
Success: true,
|
||||
}
|
||||
if pageSize == 0 {
|
||||
pageSize = 10
|
||||
}
|
||||
if class == "" {
|
||||
class = "全部"
|
||||
}
|
||||
rr.Page = current
|
||||
rr.Data = []*common.Function{}
|
||||
if current != 0 {
|
||||
@@ -149,7 +154,34 @@ func initWebPluginList() {
|
||||
tab3 := []*common.Function{}
|
||||
fc := []*common.Function{}
|
||||
fc = append(fc, Functions...)
|
||||
classes := map[string][]*common.Function{}
|
||||
classesNum := map[string]int{}
|
||||
for i := range list {
|
||||
if len(list[i].Classes) == 0 {
|
||||
class := "未分类"
|
||||
if _, ok := classes[class]; !ok {
|
||||
classes[class] = []*common.Function{}
|
||||
}
|
||||
classes[class] = append(classes[class], list[i])
|
||||
} else {
|
||||
for _, class := range list[i].Classes {
|
||||
if _, ok := classes[class]; !ok {
|
||||
classes[class] = []*common.Function{}
|
||||
}
|
||||
classes[class] = append(classes[class], list[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for class, fs := range classes {
|
||||
classesNum[class] = len(fs)
|
||||
}
|
||||
classesNum["全部"] = len(list)
|
||||
if class != "全部" {
|
||||
list, _ = classes[class]
|
||||
}
|
||||
rr.Classes = classesNum
|
||||
for i := range list { //处理第二分类
|
||||
ded := false
|
||||
for j := range fc {
|
||||
if list[i].UUID == fc[j].UUID {
|
||||
@@ -166,6 +198,7 @@ func initWebPluginList() {
|
||||
tab2 = append(tab2, list[i])
|
||||
}
|
||||
}
|
||||
|
||||
if activeKey == "tab2" {
|
||||
list = tab2
|
||||
rr.Tab1 = len(tab1)
|
||||
@@ -232,6 +265,7 @@ func initWebPluginList() {
|
||||
}
|
||||
rr.Data[i].Description = parseReply2(rr.Data[i].Description)
|
||||
}
|
||||
|
||||
ctx.JSON(200, rr)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user