koishi-plugin-bilibili-notify 3.0.0-alpha.2 → 3.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,19 +1,29 @@
1
- import { Context, ForkScope, Schema, Service } from 'koishi';
1
+ import { type Context, type ForkScope, Schema, Service } from "koishi";
2
2
  export declare const inject: string[];
3
3
  export declare const name = "bilibili-notify";
4
- declare module 'koishi' {
4
+ declare module "koishi" {
5
5
  interface Context {
6
6
  sm: ServerManager;
7
7
  }
8
8
  }
9
+ declare class ServerManager extends Service {
10
+ servers: ForkScope[];
11
+ renderType: number;
12
+ dynamicLoopTime: number;
13
+ constructor(ctx: Context);
14
+ protected start(): void | Promise<void>;
15
+ registerPlugin: () => boolean;
16
+ disposePlugin: () => Promise<boolean>;
17
+ restartPlugin: () => Promise<boolean>;
18
+ }
19
+ export declare function apply(ctx: Context, config: Config): void;
9
20
  export interface Config {
10
21
  require: {};
11
22
  key: string;
12
23
  master: {};
13
24
  basicSettings: {};
14
- unlockSubLimits: boolean;
15
25
  automaticResend: boolean;
16
- renderType: 'render' | 'page';
26
+ renderType: "render" | "page";
17
27
  userAgent: string;
18
28
  subTitle: {};
19
29
  sub: Array<{
@@ -25,7 +35,7 @@ export interface Config {
25
35
  channelId: string;
26
36
  dynamic: boolean;
27
37
  live: boolean;
28
- liveDanmaku: boolean;
38
+ liveGuardBuy: boolean;
29
39
  atAll: boolean;
30
40
  }>;
31
41
  platform: string;
@@ -33,15 +43,15 @@ export interface Config {
33
43
  }>;
34
44
  dynamic: {};
35
45
  dynamicUrl: boolean;
36
- dynamicCheckNumber: number;
37
- dynamicLoopTime: '1分钟' | '2分钟' | '3分钟' | '5分钟' | '10分钟' | '20分钟';
46
+ dynamicLoopTime: "1分钟" | "2分钟" | "3分钟" | "5分钟" | "10分钟" | "20分钟";
38
47
  live: {};
48
+ liveDetectMode: "API" | "WS";
39
49
  restartPush: boolean;
40
50
  pushTime: number;
41
- danmakuPushTime: number;
42
51
  customLiveStart: string;
43
52
  customLive: string;
44
53
  customLiveEnd: string;
54
+ followerDisplay: boolean;
45
55
  hideDesc: boolean;
46
56
  style: {};
47
57
  removeBorder: boolean;
@@ -54,15 +64,4 @@ export interface Config {
54
64
  dynamicDebugMode: boolean;
55
65
  }
56
66
  export declare const Config: Schema<Config>;
57
- declare class ServerManager extends Service {
58
- servers: ForkScope[];
59
- renderType: number;
60
- dynamicLoopTime: number;
61
- constructor(ctx: Context);
62
- protected start(): void | Promise<void>;
63
- registerPlugin: () => boolean;
64
- disposePlugin: () => Promise<boolean>;
65
- restartPlugin: () => Promise<boolean>;
66
- }
67
- export declare function apply(ctx: Context, config: Config): void;
68
67
  export {};
package/lib/index.js CHANGED
@@ -38,166 +38,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Config = exports.name = exports.inject = void 0;
40
40
  exports.apply = apply;
41
- /* eslint-disable @typescript-eslint/ban-types */
42
41
  const koishi_1 = require("koishi");
43
42
  // import plugins
44
- // import Authority from './authority'
45
43
  const comRegister_1 = __importDefault(require("./comRegister"));
46
44
  const Database = __importStar(require("./database"));
47
45
  // import Service
48
46
  const generateImg_1 = __importDefault(require("./generateImg"));
49
47
  const biliAPI_1 = __importDefault(require("./biliAPI"));
50
48
  const blive_1 = __importDefault(require("./blive"));
51
- exports.inject = ['puppeteer', 'database', 'notifier'];
52
- exports.name = 'bilibili-notify';
49
+ exports.inject = ["puppeteer", "database", "notifier"];
50
+ exports.name = "bilibili-notify";
53
51
  let globalConfig;
54
- exports.Config = koishi_1.Schema.object({
55
- require: koishi_1.Schema.object({}).description('必填设置'),
56
- key: koishi_1.Schema.string()
57
- .pattern(/^[0-9a-f]{32}$/)
58
- .role('secret')
59
- .required()
60
- .description('请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/'),
61
- master: koishi_1.Schema.intersect([
62
- koishi_1.Schema.object({
63
- enable: koishi_1.Schema.boolean()
64
- .default(false)
65
- .description('是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告')
66
- }).description('主人账号'),
67
- koishi_1.Schema.union([
68
- koishi_1.Schema.object({
69
- enable: koishi_1.Schema.const(true).required(),
70
- platform: koishi_1.Schema.union(['qq', 'qqguild', 'onebot', 'discord', 'red', 'telegram', 'satori', 'chronocat', 'lark'])
71
- .description('请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件'),
72
- masterAccount: koishi_1.Schema.string()
73
- .role('secret')
74
- .required()
75
- .description('主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID'),
76
- masterAccountGuildId: koishi_1.Schema.string()
77
- .role('secret')
78
- .description('主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID'),
79
- }),
80
- koishi_1.Schema.object({})
81
- ])
82
- ]),
83
- basicSettings: koishi_1.Schema.object({}).description('基本设置'),
84
- unlockSubLimits: koishi_1.Schema.boolean()
85
- .default(false)
86
- .description('解锁3个直播订阅限制,默认只允许订阅3位UP主。订阅过多用户可能有导致IP暂时被封禁的风险'),
87
- automaticResend: koishi_1.Schema.boolean()
88
- .default(true)
89
- .description('是否开启自动重发功能,默认开启。开启后,如果推送失败,将会自动重发,尝试三次。关闭后,推送失败将不会再重发,直到下一次推送'),
90
- renderType: koishi_1.Schema.union(['render', 'page'])
91
- .role('')
92
- .default('render')
93
- .description('渲染类型,默认为render模式,渲染速度更快,但会出现乱码问题,若出现乱码问题,请切换到page模式。若使用自定义字体,建议选择render模式'),
94
- userAgent: koishi_1.Schema.string()
95
- .required()
96
- .description('设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111'),
97
- subTitle: koishi_1.Schema.object({}).description('手动订阅'),
98
- sub: koishi_1.Schema.array(koishi_1.Schema.object({
99
- uid: koishi_1.Schema.string().description('订阅用户UID'),
100
- dynamic: koishi_1.Schema.boolean().description('是否订阅用户动态'),
101
- live: koishi_1.Schema.boolean().description('是否订阅用户直播'),
102
- target: koishi_1.Schema.array(koishi_1.Schema.object({
103
- channelIdArr: koishi_1.Schema.array(koishi_1.Schema.object({
104
- channelId: koishi_1.Schema.string().description('频道/群组号'),
105
- dynamic: koishi_1.Schema.boolean().description('该频道/群组是否推送动态信息'),
106
- live: koishi_1.Schema.boolean().description('该频道/群组是否推送直播通知'),
107
- liveDanmaku: koishi_1.Schema.boolean().description('该频道/群组是否推送弹幕消息'),
108
- atAll: koishi_1.Schema.boolean().description('推送开播通知时是否艾特全体成员')
109
- })).description('频道/群组信息'),
110
- platform: koishi_1.Schema.string().description('推送平台')
111
- })).description('订阅用户需要发送的频道/群组信息')
112
- })).role('table').description('手动输入订阅信息,方便自定义订阅内容,这里的订阅内容不会存入数据库。uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播'),
113
- dynamic: koishi_1.Schema.object({}).description('动态推送设置'),
114
- dynamicUrl: koishi_1.Schema.boolean()
115
- .default(false)
116
- .description('发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!'),
117
- dynamicCheckNumber: koishi_1.Schema.number()
118
- .min(2)
119
- .max(10)
120
- .role('slider')
121
- .step(1)
122
- .default(5)
123
- .description('设定每次检查动态的数量。若订阅的UP主经常在短时间内连着发多条动态可以将该值提高,若订阅的UP主有置顶动态,在计算该值时应+1。默认值为5条'),
124
- dynamicLoopTime: koishi_1.Schema.union(['1分钟', '2分钟', '3分钟', '5分钟', '10分钟', '20分钟'])
125
- .role('')
126
- .default('2分钟')
127
- .description('设定多久检测一次动态。若需动态的时效性,可以设置为1分钟。若订阅的UP主经常在短时间内连着发多条动态应该将该值提高,否则会出现动态漏推送和晚推送的问题,默认值为2分钟'),
128
- live: koishi_1.Schema.object({}).description('直播推送设置'),
129
- restartPush: koishi_1.Schema.boolean()
130
- .default(true)
131
- .description('插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启'),
132
- pushTime: koishi_1.Schema.number()
133
- .min(0)
134
- .max(12)
135
- .step(0.5)
136
- .default(1)
137
- .description('设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时'),
138
- danmakuPushTime: koishi_1.Schema.number()
139
- .min(0)
140
- .max(10)
141
- .step(0.5)
142
- .default(0.5)
143
- .description('设定间隔多长时间推送一次弹幕消息,单位为分钟,默认为半分钟'),
144
- customLiveStart: koishi_1.Schema.string()
145
- .default('-name开播啦 -link')
146
- .description('自定义开播提示语,-name代表UP昵称,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦'),
147
- customLive: koishi_1.Schema.string()
148
- .description('自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx'),
149
- customLiveEnd: koishi_1.Schema.string()
150
- .default('-name下播啦,本次直播了-time')
151
- .description('自定义下播提示语,-name代表UP昵称,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒'),
152
- hideDesc: koishi_1.Schema.boolean()
153
- .default(false)
154
- .description('是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介'),
155
- style: koishi_1.Schema.object({}).description('美化设置'),
156
- removeBorder: koishi_1.Schema.boolean()
157
- .default(false)
158
- .description('移除推送卡片边框'),
159
- cardColorStart: koishi_1.Schema.string()
160
- .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
161
- .default('#F38AB5')
162
- .description('推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/'),
163
- cardColorEnd: koishi_1.Schema.string()
164
- .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
165
- .default('#F9CCDF')
166
- .description('推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/'),
167
- enableLargeFont: koishi_1.Schema.boolean()
168
- .default(false)
169
- .description('是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看'),
170
- font: koishi_1.Schema.string()
171
- .description('推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei'),
172
- filter: koishi_1.Schema.intersect([
173
- koishi_1.Schema.object({
174
- enable: koishi_1.Schema.boolean()
175
- .default(false)
176
- .description('是否开启动态屏蔽功能')
177
- }).description('屏蔽设置'),
178
- koishi_1.Schema.union([
179
- koishi_1.Schema.object({
180
- enable: koishi_1.Schema.const(true).required().experimental(),
181
- notify: koishi_1.Schema.boolean()
182
- .default(false)
183
- .description('动态被屏蔽是否发送提示'),
184
- regex: koishi_1.Schema.string()
185
- .description('正则表达式屏蔽'),
186
- keywords: koishi_1.Schema.array(String)
187
- .description('关键字屏蔽,一个关键字为一项'),
188
- forward: koishi_1.Schema.boolean()
189
- .default(false)
190
- .description("是否屏蔽转发动态"),
191
- }),
192
- koishi_1.Schema.object({})
193
- ])
194
- ]),
195
- debug: koishi_1.Schema.object({}).description('调试设置'),
196
- dynamicDebugMode: koishi_1.Schema.boolean()
197
- .default(false)
198
- .description('动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试')
199
- .experimental()
200
- });
201
52
  class ServerManager extends koishi_1.Service {
202
53
  // 服务
203
54
  servers = [];
@@ -206,81 +57,80 @@ class ServerManager extends koishi_1.Service {
206
57
  // 动态循环时间
207
58
  dynamicLoopTime;
208
59
  constructor(ctx) {
209
- super(ctx, 'sm');
60
+ super(ctx, "sm");
210
61
  // 插件运行相关指令
211
- const sysCom = ctx.command('sys', 'bili-notify插件运行相关指令', { permissions: ['authority:5'] });
62
+ const sysCom = ctx.command("sys", "bili-notify插件运行相关指令", {
63
+ permissions: ["authority:5"],
64
+ });
212
65
  sysCom
213
- .subcommand('.restart', '重启插件')
214
- .usage('重启插件')
215
- .example('sys restart')
66
+ .subcommand(".restart", "重启插件")
67
+ .usage("重启插件")
68
+ .example("sys restart")
216
69
  .action(async () => {
217
- this.logger.info('调用sys restart指令');
70
+ this.logger.info("调用sys restart指令");
218
71
  if (await this.restartPlugin()) {
219
- return '插件重启成功';
72
+ return "插件重启成功";
220
73
  }
221
- return '插件重启失败';
74
+ return "插件重启失败";
222
75
  });
223
76
  sysCom
224
- .subcommand('.stop', '停止插件')
225
- .usage('停止插件')
226
- .example('sys stop')
77
+ .subcommand(".stop", "停止插件")
78
+ .usage("停止插件")
79
+ .example("sys stop")
227
80
  .action(async () => {
228
- this.logger.info('调用sys stop指令');
81
+ this.logger.info("调用sys stop指令");
229
82
  if (await this.disposePlugin()) {
230
- return '插件已停止';
83
+ return "插件已停止";
231
84
  }
232
- return '停止插件失败';
85
+ return "停止插件失败";
233
86
  });
234
87
  sysCom
235
- .subcommand('.start', '启动插件')
236
- .usage('启动插件')
237
- .example('sys start')
88
+ .subcommand(".start", "启动插件")
89
+ .usage("启动插件")
90
+ .example("sys start")
238
91
  .action(async () => {
239
- this.logger.info('调用sys start指令');
92
+ this.logger.info("调用sys start指令");
240
93
  if (await this.registerPlugin()) {
241
- return '插件启动成功';
94
+ return "插件启动成功";
242
95
  }
243
- return '插件启动失败';
96
+ return "插件启动失败";
244
97
  });
245
98
  }
246
99
  start() {
247
100
  // 加载配置
248
101
  // 根据用户设置的渲染模式设置
249
102
  switch (globalConfig.renderType) {
250
- case 'render':
103
+ case "render":
251
104
  this.renderType = 0;
252
105
  break;
253
- case 'page':
106
+ case "page":
254
107
  this.renderType = 1;
255
108
  break;
256
109
  }
257
110
  // 转换为具体时间
258
111
  switch (globalConfig.dynamicLoopTime) {
259
- case '1分钟':
112
+ case "1分钟":
260
113
  this.dynamicLoopTime = 60;
261
114
  break;
262
- case '2分钟':
115
+ case "2分钟":
263
116
  this.dynamicLoopTime = 120;
264
117
  break;
265
- case '3分钟':
118
+ case "3分钟":
266
119
  this.dynamicLoopTime = 180;
267
120
  break;
268
- case '5分钟':
121
+ case "5分钟":
269
122
  this.dynamicLoopTime = 300;
270
123
  break;
271
- case '10分钟':
124
+ case "10分钟":
272
125
  this.dynamicLoopTime = 600;
273
126
  break;
274
- case '20分钟':
127
+ case "20分钟":
275
128
  this.dynamicLoopTime = 1200;
276
129
  break;
277
130
  }
278
131
  // 注册插件
279
- if (this.registerPlugin()) {
280
- this.logger.info('插件启动成功');
281
- }
282
- else {
283
- this.logger.error('插件启动失败');
132
+ if (!this.registerPlugin()) {
133
+ this.logger.error("插件启动失败");
284
134
  }
285
135
  }
286
136
  registerPlugin = () => {
@@ -292,7 +142,7 @@ class ServerManager extends koishi_1.Service {
292
142
  // BA = BiliAPI
293
143
  const ba = this.ctx.plugin(biliAPI_1.default, {
294
144
  userAgent: globalConfig.userAgent,
295
- key: globalConfig.key
145
+ key: globalConfig.key,
296
146
  });
297
147
  // GI = GenerateImg
298
148
  const gi = this.ctx.plugin(generateImg_1.default, {
@@ -303,29 +153,27 @@ class ServerManager extends koishi_1.Service {
303
153
  cardColorEnd: globalConfig.cardColorEnd,
304
154
  hideDesc: globalConfig.hideDesc,
305
155
  enableLargeFont: globalConfig.enableLargeFont,
306
- font: globalConfig.font
156
+ font: globalConfig.font,
157
+ followerDisplay: globalConfig.followerDisplay
307
158
  });
308
159
  // CR = ComRegister
309
160
  const cr = this.ctx.plugin(comRegister_1.default, {
310
161
  sub: globalConfig.sub,
311
162
  master: globalConfig.master,
312
- unlockSubLimits: globalConfig.unlockSubLimits,
313
163
  automaticResend: globalConfig.automaticResend,
164
+ liveDetectMode: globalConfig.liveDetectMode,
314
165
  restartPush: globalConfig.restartPush,
315
166
  pushTime: globalConfig.pushTime,
316
167
  customLiveStart: globalConfig.customLiveStart,
317
168
  customLive: globalConfig.customLive,
318
169
  customLiveEnd: globalConfig.customLiveEnd,
319
- dynamicCheckNumber: globalConfig.dynamicCheckNumber,
320
170
  dynamicLoopTime: this.dynamicLoopTime,
321
171
  dynamicUrl: globalConfig.dynamicUrl,
322
172
  filter: globalConfig.filter,
323
- dynamicDebugMode: globalConfig.dynamicDebugMode
173
+ dynamicDebugMode: globalConfig.dynamicDebugMode,
324
174
  });
325
175
  // BL = BLive
326
- const bl = this.ctx.plugin(blive_1.default, {
327
- danmakuPushTime: globalConfig.danmakuPushTime
328
- });
176
+ const bl = this.ctx.plugin(blive_1.default);
329
177
  // 添加服务
330
178
  this.servers.push(ba);
331
179
  this.servers.push(bl);
@@ -333,10 +181,10 @@ class ServerManager extends koishi_1.Service {
333
181
  this.servers.push(cr);
334
182
  }
335
183
  catch (e) {
336
- this.logger.error('插件注册失败', e);
184
+ this.logger.error("插件注册失败", e);
337
185
  return false;
338
186
  }
339
- // 成功返回true
187
+ // 成功返回true
340
188
  return true;
341
189
  };
342
190
  disposePlugin = async () => {
@@ -344,13 +192,13 @@ class ServerManager extends koishi_1.Service {
344
192
  if (this.servers.length === 0)
345
193
  return false;
346
194
  // 遍历服务
347
- await new Promise(resolve => {
348
- this.servers.forEach(fork => {
195
+ await new Promise((resolve) => {
196
+ for (const fork of this.servers) {
349
197
  fork.dispose();
350
- });
198
+ }
351
199
  // 清空服务
352
200
  this.servers = [];
353
- resolve('ok');
201
+ resolve("ok");
354
202
  });
355
203
  // 成功返回true
356
204
  return true;
@@ -362,13 +210,13 @@ class ServerManager extends koishi_1.Service {
362
210
  // 停用插件
363
211
  await this.disposePlugin();
364
212
  // 隔一秒启动插件
365
- return new Promise(resolve => {
213
+ return new Promise((resolve) => {
366
214
  this.ctx.setTimeout(() => {
367
215
  try {
368
216
  this.registerPlugin();
369
217
  }
370
218
  catch (e) {
371
- this.logger.error('重启插件失败', e);
219
+ this.logger.error("重启插件失败", e);
372
220
  resolve(false);
373
221
  }
374
222
  resolve(true);
@@ -381,29 +229,179 @@ function apply(ctx, config) {
381
229
  globalConfig = config;
382
230
  // 设置提示
383
231
  ctx.notifier.create({
384
- content: '从2.0.0-alpha.9以前版本更新需重新订阅'
232
+ type: "danger",
233
+ content: "3.0.0-alpha.16 全面从指令订阅迁移到配置订阅,以前使用指令的订阅需要全部重新填写到订阅配置中",
385
234
  });
386
235
  ctx.notifier.create({
387
- content: '请使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。'
236
+ type: "warning",
237
+ content: "请使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令",
388
238
  });
389
- if (config.unlockSubLimits) { // 用户允许订阅超过三个用户
390
- // 设置警告
391
- ctx.notifier.create({
392
- type: 'danger',
393
- content: '过多的订阅可能会导致IP暂时被封禁!'
394
- });
395
- }
396
239
  // load database
397
240
  ctx.plugin(Database);
398
241
  // Register ServerManager
399
242
  ctx.plugin(ServerManager);
400
243
  // 当用户输入“恶魔兔,启动!”时,执行 help 指令
401
244
  ctx.middleware((session, next) => {
402
- if (session.content === '恶魔兔,启动!') {
403
- return session.send('启动不了一点');
404
- }
405
- else {
406
- return next();
245
+ if (session.content === "恶魔兔,启动!") {
246
+ return session.send("启动不了一点");
407
247
  }
248
+ return next();
408
249
  });
409
250
  }
251
+ exports.Config = koishi_1.Schema.object({
252
+ require: koishi_1.Schema.object({}).description("必填设置"),
253
+ key: koishi_1.Schema.string()
254
+ .pattern(/^[0-9a-f]{32}$/)
255
+ .role("secret")
256
+ .required()
257
+ .description("请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/"),
258
+ master: koishi_1.Schema.intersect([
259
+ koishi_1.Schema.object({
260
+ enable: koishi_1.Schema.boolean()
261
+ .default(false)
262
+ .description("是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告"),
263
+ }).description("主人账号"),
264
+ koishi_1.Schema.union([
265
+ koishi_1.Schema.object({
266
+ enable: koishi_1.Schema.const(true).required(),
267
+ platform: koishi_1.Schema.union([
268
+ "qq",
269
+ "qqguild",
270
+ "onebot",
271
+ "discord",
272
+ "red",
273
+ "telegram",
274
+ "satori",
275
+ "chronocat",
276
+ "lark",
277
+ ]).description("请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件"),
278
+ masterAccount: koishi_1.Schema.string()
279
+ .role("secret")
280
+ .required()
281
+ .description("主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID"),
282
+ masterAccountGuildId: koishi_1.Schema.string()
283
+ .role("secret")
284
+ .description("主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID"),
285
+ }),
286
+ koishi_1.Schema.object({}),
287
+ ]),
288
+ ]),
289
+ basicSettings: koishi_1.Schema.object({}).description("基本设置"),
290
+ automaticResend: koishi_1.Schema.boolean()
291
+ .default(true)
292
+ .description("是否开启自动重发功能,默认开启。开启后,如果推送失败,将会自动重发,尝试三次。关闭后,推送失败将不会再重发,直到下一次推送"),
293
+ renderType: koishi_1.Schema.union(["render", "page"])
294
+ .role("")
295
+ .default("render")
296
+ .description("渲染类型,默认为render模式,渲染速度更快,但会出现乱码问题,若出现乱码问题,请切换到page模式。若使用自定义字体,建议选择render模式"),
297
+ userAgent: koishi_1.Schema.string()
298
+ .required()
299
+ .description("设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111"),
300
+ subTitle: koishi_1.Schema.object({}).description("订阅配置"),
301
+ sub: koishi_1.Schema.array(koishi_1.Schema.object({
302
+ uid: koishi_1.Schema.string().required().description("订阅用户UID"),
303
+ dynamic: koishi_1.Schema.boolean().default(false).description("是否订阅用户动态"),
304
+ live: koishi_1.Schema.boolean().default(false).description("是否订阅用户直播"),
305
+ target: koishi_1.Schema.array(koishi_1.Schema.object({
306
+ channelIdArr: koishi_1.Schema.array(koishi_1.Schema.object({
307
+ channelId: koishi_1.Schema.string().required().description("频道/群组号"),
308
+ dynamic: koishi_1.Schema.boolean().default(false).description("该频道/群组是否推送动态信息"),
309
+ live: koishi_1.Schema.boolean().default(false).description("该频道/群组是否推送直播通知"),
310
+ liveGuardBuy: koishi_1.Schema.boolean().default(false).description("该频道/群组是否推送上舰消息"),
311
+ atAll: koishi_1.Schema.boolean().default(false).description("推送开播通知时是否艾特全体成员"),
312
+ })).description("需推送的频道/群组详细设置"),
313
+ platform: koishi_1.Schema.string().required().description("推送平台,例如onebot、qq、discord"),
314
+ })).description("订阅用户需要发送的平台和频道/群组信息(一个平台下可以推送多个频道/群组)"),
315
+ }))
316
+ .role("table")
317
+ .description("输入订阅信息,自定义订阅内容; uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播"),
318
+ dynamic: koishi_1.Schema.object({}).description("动态推送设置"),
319
+ dynamicUrl: koishi_1.Schema.boolean()
320
+ .default(false)
321
+ .description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
322
+ dynamicLoopTime: koishi_1.Schema.union([
323
+ "1分钟",
324
+ "2分钟",
325
+ "3分钟",
326
+ "5分钟",
327
+ "10分钟",
328
+ "20分钟",
329
+ ])
330
+ .role("")
331
+ .default("2分钟")
332
+ .description("设定多久检测一次动态。若需动态的时效性,可以设置为1分钟。若订阅的UP主经常在短时间内连着发多条动态应该将该值提高,否则会出现动态漏推送和晚推送的问题,默认值为2分钟"),
333
+ live: koishi_1.Schema.object({}).description("直播推送设置"),
334
+ liveDetectMode: koishi_1.Schema.union([
335
+ koishi_1.Schema.const("WS").description("WebSocket模式:连接到对应的直播间,可推送弹幕消息,开播下播响应最快,但对订阅数有限制"),
336
+ koishi_1.Schema.const("API")
337
+ .description("API模式:请求对应直播间API,无法获取弹幕消息,开播下播响应慢,理论可无限订阅")
338
+ .deprecated(),
339
+ ])
340
+ .role("radio")
341
+ .description("直播检测模式")
342
+ .default("WS"),
343
+ restartPush: koishi_1.Schema.boolean()
344
+ .default(true)
345
+ .description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
346
+ pushTime: koishi_1.Schema.number()
347
+ .min(0)
348
+ .max(12)
349
+ .step(0.5)
350
+ .default(1)
351
+ .description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
352
+ customLiveStart: koishi_1.Schema.string()
353
+ .default("-name开播啦,当前粉丝数为-follower -link")
354
+ .description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦"),
355
+ customLive: koishi_1.Schema.string()
356
+ .default("-name正在直播,目前已播-time。累计看过人数:-watched,-link")
357
+ .description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计看过人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx"),
358
+ customLiveEnd: koishi_1.Schema.string()
359
+ .default("-name下播啦,本次直播了-time。粉丝数变化-follower_change")
360
+ .description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
361
+ followerDisplay: koishi_1.Schema.boolean()
362
+ .default(true)
363
+ .description("粉丝数变化和看过本场直播的人数是否显示在推送卡片中"),
364
+ hideDesc: koishi_1.Schema.boolean()
365
+ .default(false)
366
+ .description("是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介"),
367
+ style: koishi_1.Schema.object({}).description("美化设置"),
368
+ removeBorder: koishi_1.Schema.boolean().default(false).description("移除推送卡片边框"),
369
+ cardColorStart: koishi_1.Schema.string()
370
+ .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
371
+ .default("#F38AB5")
372
+ .description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"),
373
+ cardColorEnd: koishi_1.Schema.string()
374
+ .pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
375
+ .default("#F9CCDF")
376
+ .description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"),
377
+ enableLargeFont: koishi_1.Schema.boolean()
378
+ .default(false)
379
+ .description("是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看"),
380
+ font: koishi_1.Schema.string().description("推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei"),
381
+ filter: koishi_1.Schema.intersect([
382
+ koishi_1.Schema.object({
383
+ enable: koishi_1.Schema.boolean()
384
+ .default(false)
385
+ .description("是否开启动态屏蔽功能"),
386
+ }).description("屏蔽设置"),
387
+ koishi_1.Schema.union([
388
+ koishi_1.Schema.object({
389
+ enable: koishi_1.Schema.const(true).required().experimental(),
390
+ notify: koishi_1.Schema.boolean()
391
+ .default(false)
392
+ .description("动态被屏蔽是否发送提示"),
393
+ regex: koishi_1.Schema.string().description("正则表达式屏蔽"),
394
+ keywords: koishi_1.Schema.array(String).description("关键字屏蔽,一个关键字为一项"),
395
+ forward: koishi_1.Schema.boolean()
396
+ .default(false)
397
+ .description("是否屏蔽转发动态"),
398
+ }),
399
+ koishi_1.Schema.object({}),
400
+ ]),
401
+ ]),
402
+ debug: koishi_1.Schema.object({}).description("调试设置"),
403
+ dynamicDebugMode: koishi_1.Schema.boolean()
404
+ .default(false)
405
+ .description("动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试")
406
+ .experimental(),
407
+ });