koishi-plugin-bilibili-notify 3.0.0-alpha.9 → 3.0.0-beta.1

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