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