forked from Catrong/phi-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
guoba.support.js
302 lines (300 loc) · 11.9 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
import Config from './components/Config.js'
// 支持锅巴
export function supportGuoba() {
return {
// 配置项信息
configInfo: {
// 配置项 schemas
schemas: [
{
field: 'b19size',
label: '渲染体积',
helpMessage: '标准(100)值的宽度为1800px,按照百分比进行缩放,图片越大渲染越慢',
bottomHelpMessage: '选择b19和update图片的渲染体积,以缩减渲染所需时间,太大可能会炸掉 Chromium ',
component: 'InputNumber',
required: true,
componentProps: {
min: 1,
max: 9999,
placeholder: '缩放百分比',
},
},
{
field: 'randerQuality',
label: '渲染质量',
bottomHelpMessage: '对所有的图片生效,设置渲染的质量',
component: 'InputNumber',
required: true,
componentProps: {
min: 1,
max: 100,
placeholder: '请输入渲染质量',
},
},
{
field: 'renderScale',
label: '渲染精度',
bottomHelpMessage: '对所有的图片生效,设置渲染精度',
component: 'InputNumber',
required: true,
componentProps: {
min: 50,
max: 200,
placeholder: '请输入渲染精度',
},
},
{
field: 'timeout',
label: '渲染超时时间',
bottomHelpMessage: '对所有的图片生效,超时后重启puppeteer,单位ms',
component: 'InputNumber',
required: true,
componentProps: {
min: 1000,
max: 120000,
placeholder: '请输入渲染超时时间',
},
},
{
field: 'waitingTimeout',
label: '等待超时时间',
bottomHelpMessage: '对所有的图片生效,单位ms',
component: 'InputNumber',
required: true,
componentProps: {
min: 1000,
max: 120000,
placeholder: '请输入等待超时时间',
},
},
{
field: 'B19MaxNum',
label: 'B19最大限制',
bottomHelpMessage: '用户可以获取B19图片成绩的最大数量,建议不要太大',
component: 'InputNumber',
required: true,
componentProps: {
min: 22,
max: 1000,
placeholder: '请输入B19最大限制',
},
},
{
field: 'HistoryDayNum',
label: '历史成绩单日数量',
bottomHelpMessage: '/update 展现历史成绩的单日最大数量,至少为2',
component: 'InputNumber',
required: true,
componentProps: {
min: 2,
max: 10000,
placeholder: '请输入最大限制',
},
},
{
field: 'HistoryScoreNum',
label: '历史成绩展示数量',
bottomHelpMessage: '/update 展现历史成绩的最大数量',
component: 'InputNumber',
required: true,
componentProps: {
min: 10,
max: 10000,
placeholder: '请输入最大限制',
},
},
{
field: 'HistoryScoreDate',
label: '历史成绩展示天数',
bottomHelpMessage: '/update 展现历史成绩的最大天数',
component: 'InputNumber',
required: true,
componentProps: {
min: 1,
max: 100,
placeholder: '请输入最大限制',
},
},
{
field: 'isGuild',
label: '频道模式',
bottomHelpMessage: '开启后文字版仅限私聊,关闭文字版图片,文字版将折叠为一条消息',
component: 'Switch',
},
{
field: 'WordB19Img',
label: '文字版B19曲绘图片',
bottomHelpMessage: '关闭可大幅度提升发送速度',
component: 'Switch',
},
{
field: 'WordSuggImg',
label: 'Suggest曲绘图片',
bottomHelpMessage: '关闭可大幅度提升发送速度',
component: 'Switch',
},
{
field: 'GuessTipRecall',
label: '猜曲绘撤回',
bottomHelpMessage: '是否在下一条提示发出的时候撤回上一条',
component: 'Switch',
},
{
field: 'cmdhead',
label: '命令头',
bottomHelpMessage: '命令正则匹配开头,不包含#/,支持正则表达式,\'\\\' 请双写( \\s --> \\\\s ),最外层可以不加括号',
component: 'Input',
required: false,
componentProps: {
placeholder: '请输入命令头',
},
},
{
field: 'otherinfo',
label: '曲库',
bottomHelpMessage: '使用曲库的模式,若启用自定义则重名的以自定义为准',
component: 'Select',
componentProps: {
options: [
{
label: '原版曲库',
value: 0
},
{
label: '原版+自定义',
value: 1
},
{
label: '仅自定义',
value: 2
}
]
}
},
{
field: 'GuessTipCd',
label: '曲绘提示间隔',
bottomHelpMessage: '猜曲绘的提示间隔时间,单位:秒',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 120,
placeholder: '请输入时间',
},
},
{
field: 'LetterNum',
label: '字母条数',
bottomHelpMessage: '开字母的条数,最大为99999最小为1',
component: 'InputNumber',
required: true,
componentProps: {
min: 1,
max: 99999,
placeholder: '请输入数量',
},
},
{
field: 'LetterRevealCd',
label: '字母提示间隔',
bottomHelpMessage: '开字母的全局开字母间隔时间,单位:秒',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 120,
placeholder: '请输入时间',
},
},
{
field: 'LetterGuessCd',
label: '字母开启间隔',
bottomHelpMessage: '开字母的全局开启间隔时间,单位:秒',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 120,
placeholder: '请输入时间',
},
},
{
field: 'LetterTipCd',
label: '字母猜测间隔',
bottomHelpMessage: '开字母的全局猜测间隔时间,单位:秒',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 120,
placeholder: '请输入时间',
},
},
{
field: 'LetterTimeLength',
label: '猜字母最长时长',
bottomHelpMessage: '单位:秒',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 9999999,
placeholder: '请输入时间',
},
},
{
field: 'MicTipCd',
label: '猜歌提示冷却',
bottomHelpMessage: '猜歌的全局提示冷却时间,单位:秒',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
max: 120,
placeholder: '请输入时间',
},
},
{
field: 'VikaToken',
label: 'token',
bottomHelpMessage: 'token 填写后请重启',
component: 'Input',
required: false,
componentProps: {
placeholder: '请输入token',
},
},
],
// 获取配置数据方法(用于前端填充显示数据)
getConfigData() {
const defset = Config.getdefSet('config')
let config = {}
for (var i in defset) {
config[i] = Config.getDefOrConfig('config', i)
}
return config
},
// 设置配置的方法(前端点确定后调用的方法)
setConfigData(data, { Result }) {
if (data.isGuild) {
data.WordB19Img = false
data.WordSuggImg = false
}
var vis = false
if (data.VikaToken.length != 23) {
data.VikaToken = ''
vis = true
}
for (let [keyPath, value] of Object.entries(data)) {
Config.modify('config', keyPath, value)
}
if (vis) {
return Result.ok({}, 'VikaToken非法')
} else {
return Result.ok({}, '保存成功~')
}
},
},
}
}