-
Notifications
You must be signed in to change notification settings - Fork 4
/
guoba.support.js
249 lines (247 loc) · 7.75 KB
/
guoba.support.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import Config from "./components/config/config.js";
import lodash from "lodash";
import path from "path";
import { pluginRoot } from "./model/path.js";
export function supportGuoba() {
return {
pluginInfo: {
name: 'nsfwjs-plugin',
title: '色图监听插件',
author: ['@CikeyQi', '@erzaozi'],
authorLink: ['https://github.com/CikeyQi', 'https://github.com/erzaozi'],
link: 'https://github.com/CikeyQi/nsfwjs-plugin',
isV3: true,
isV2: false,
showInMenu: true,
description: '基于 Yunzai 的涩图监听插件,使用 NSFWJS 模型',
// 显示图标,此为个性化配置
// 图标可在 https://icon-sets.iconify.design 这里进行搜索
icon: 'openmoji:stop-sign',
// 图标颜色,例:#FF0000 或 rgb(255, 0, 0)
iconColor: '#dc143c',
// 如果想要显示成图片,也可以填写图标路径(绝对路径)
iconPath: path.join(pluginRoot, 'resources/readme/girl.png'),
},
configInfo: {
schemas: [
{
component: "Divider",
label: "开关 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "listen.enable",
label: "监听开关",
bottomHelpMessage: "监听消息总开关",
component: "Switch",
},
{
field: "examine.enable",
label: "主动审核开关",
bottomHelpMessage: "主动审核开关",
component: "Switch",
},
{
component: "Divider",
label: "审核 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "threshold.porn",
label: "色情阈值",
bottomHelpMessage: "大于该值判定为色情",
component: "InputNumber",
componentProps: {
placeholder: '请输入色情阈值',
min: 0,
max: 1,
step: 0.01,
},
},
{
field: "threshold.sexy",
label: "性感阈值",
bottomHelpMessage: "大于该值判定为性感",
component: "InputNumber",
componentProps: {
placeholder: '请输入性感阈值',
min: 0,
max: 1,
step: 0.01,
},
},
{
field: "threshold.hentai",
label: "变态阈值",
bottomHelpMessage: "大于该值判定为变态",
component: "InputNumber",
componentProps: {
placeholder: '请输入变态阈值',
min: 0,
max: 1,
step: 0.01,
},
},
{
field: "warn_text",
label: "警告文本",
bottomHelpMessage: "违规时,发送的警告文本",
component: "Input",
componentProps: {
placeholder: '请输入警告文本',
},
},
{
component: "Divider",
label: "群组 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "notice_user",
label: "通知用户",
bottomHelpMessage: "如果有人触发违规,通知的用户",
component: "GTags",
componentProps: {
placeholder: '请输入用户ID',
allowAdd: true,
allowDel: true,
showPrompt: true,
promptProps: {
content: '请输入用户ID',
placeholder: '',
okText: '添加',
rules: [
{ required: true, message: '用户ID不能为空' },
],
},
valueParser: ((value) => value.split(',') || []),
},
},
{
field: "white_user_list",
label: "白名单用户",
bottomHelpMessage: "白名单用户,不会触发警告",
component: "GTags",
componentProps: {
placeholder: '请输入用户ID',
allowAdd: true,
allowDel: true,
showPrompt: true,
promptProps: {
content: '请输入用户ID',
placeholder: '',
okText: '添加',
rules: [
{ required: true, message: '用户ID不能为空' },
]
}
}
},
{
field: "black_user_list",
label: "黑名单用户",
bottomHelpMessage: "黑名单用户,不会触发警告",
component: "GTags",
componentProps: {
placeholder: '请输入用户ID',
allowAdd: true,
allowDel: true,
showPrompt: true,
promptProps: {
content: '请输入用户ID',
placeholder: '',
okText: '添加',
rules: [
{ required: true, message: '用户ID不能为空' },
]
}
}
},
{
field: "white_group_list",
label: "白名单模式",
bottomHelpMessage: "在白名单模式下,只有白名单群组才会触发警告",
component: "GTags",
componentProps: {
placeholder: '请输入群组ID',
allowAdd: true,
allowDel: true,
showPrompt: true,
promptProps: {
content: '请输入群组ID',
placeholder: '',
okText: '添加',
rules: [
{ required: true, message: '群组ID不能为空' },
]
}
}
},
{
field: "black_group_list",
label: "黑名单模式",
bottomHelpMessage: "在黑名单模式下,黑名单群组不会触发警告",
component: "GTags",
componentProps: {
placeholder: '请输入群组ID',
allowAdd: true,
allowDel: true,
showPrompt: true,
promptProps: {
content: '请输入群组ID',
placeholder: '',
okText: '添加',
rules: [
{ required: true, message: '群组ID不能为空' },
]
}
}
},
{
component: "Divider",
label: "其他 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "save_path",
label: "违规图片保存路径",
bottomHelpMessage: "违规图片保存路径",
component: "Input",
componentProps: {
placeholder: '请输入违规图片保存路径,可用变量:{group_id}、{user_id}、{time}',
},
},
],
getConfigData() {
let config = Config.getConfig()
return config
},
setConfigData(data, { Result }) {
let config = {}
for (let [keyPath, value] of Object.entries(data)) {
lodash.set(config, keyPath, value)
}
config = lodash.merge({}, Config.getConfig(), config)
config.notice_user = data['notice_user'].map(ele => isNaN(ele) ? ele : Number(ele))
config.white_user_list = data['white_user_list'].map(ele => isNaN(ele) ? ele : Number(ele))
config.black_user_list = data['black_user_list'].map(ele => isNaN(ele) ? ele : Number(ele))
config.white_group_list = data['white_group_list'].map(ele => isNaN(ele) ? ele : Number(ele))
config.black_group_list = data['black_group_list'].map(ele => isNaN(ele) ? ele : Number(ele))
Config.setConfig(config)
return Result.ok({}, '保存成功~')
},
},
}
}