koishi-plugin-bilibili-notify 3.2.5-alpha.0 → 3.2.5-alpha.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/biliAPI-BB6Ih4EM.mjs +659 -0
- package/lib/biliAPI-GF2e2-2V.js +664 -0
- package/lib/biliAPI.d.mts +82 -0
- package/lib/biliAPI.d.ts +75 -72
- package/lib/biliAPI.js +5 -811
- package/lib/biliAPI.mjs +4 -0
- package/lib/blive-BBVUYbxX.js +43 -0
- package/lib/blive-CyC_0-9A.mjs +37 -0
- package/lib/blive.d.mts +19 -0
- package/lib/blive.d.ts +15 -12
- package/lib/blive.js +4 -59
- package/lib/blive.mjs +3 -0
- package/lib/chunk-CrFLpmCJ.js +67 -0
- package/lib/chunk-DBmNgn_A.mjs +40 -0
- package/lib/comRegister-CcqOpkwB.mjs +1421 -0
- package/lib/comRegister-t7UnYFig.js +1426 -0
- package/lib/comRegister.d.mts +109 -0
- package/lib/comRegister.d.ts +103 -100
- package/lib/comRegister.js +6 -1896
- package/lib/comRegister.mjs +5 -0
- package/lib/database-4f9U--Ji.mjs +20 -0
- package/lib/database-Ct2yIdxk.js +37 -0
- package/lib/database-Do3O9MDA.d.mts +18 -0
- package/lib/database-KWDs372o.d.ts +18 -0
- package/lib/database.d.mts +2 -0
- package/lib/database.d.ts +2 -14
- package/lib/database.js +5 -14
- package/lib/database.mjs +3 -0
- package/lib/font/HYZhengYuan-75W.js +5 -0
- package/lib/font/HYZhengYuan-75W.mjs +5 -0
- package/lib/generateImg-E9JeFpQX.js +92628 -0
- package/lib/generateImg-zwzMYjw6.mjs +92623 -0
- package/lib/generateImg.d.mts +65 -0
- package/lib/generateImg.d.ts +59 -46
- package/lib/generateImg.js +4 -1504
- package/lib/generateImg.mjs +4 -0
- package/lib/img/arrow.js +5 -0
- package/lib/img/arrow.mjs +5 -0
- package/lib/index-DeGUe4jM.d.mts +265 -0
- package/lib/index-MJKYbMf7.d.ts +265 -0
- package/lib/index.d.mts +73 -0
- package/lib/index.d.ts +65 -62
- package/lib/index.js +296 -394
- package/lib/index.mjs +300 -0
- package/lib/page/0.mjs +0 -0
- package/lib/type/index.d.mts +2 -0
- package/lib/type/index.d.ts +2 -262
- package/lib/type/index.js +5 -18
- package/lib/type/index.mjs +3 -0
- package/lib/type-C5ZxPrgY.mjs +19 -0
- package/lib/type-WjCy4YMc.js +31 -0
- package/lib/utils/index.d.mts +15 -0
- package/lib/utils/index.d.ts +8 -6
- package/lib/utils/index.js +6 -102
- package/lib/utils/index.mjs +3 -0
- package/lib/utils-BoaYrSvG.js +79 -0
- package/lib/utils-C95cnBJG.mjs +61 -0
- package/package.json +7 -4
- package/readme.md +10 -1
- package/lib/img/arrow.png +0 -0
- /package/lib/{font/HYZhengYuan-75W.ttf → assets/HYZhengYuan-75W-CAgMN3FH.ttf} +0 -0
- /package/lib/page/{0.html → 0.js} +0 -0
package/lib/index.js
CHANGED
|
@@ -1,403 +1,305 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
const require_chunk = require('./chunk-CrFLpmCJ.js');
|
|
2
|
+
require('./utils-BoaYrSvG.js');
|
|
3
|
+
const require_biliAPI = require('./biliAPI-GF2e2-2V.js');
|
|
4
|
+
const require_blive = require('./blive-BBVUYbxX.js');
|
|
5
|
+
const require_comRegister = require('./comRegister-t7UnYFig.js');
|
|
6
|
+
require('./type-WjCy4YMc.js');
|
|
7
|
+
const require_database = require('./database-Ct2yIdxk.js');
|
|
8
|
+
const require_generateImg = require('./generateImg-E9JeFpQX.js');
|
|
9
|
+
const koishi = require_chunk.__toESM(require("koishi"));
|
|
10
|
+
const path = require_chunk.__toESM(require("path"));
|
|
11
|
+
|
|
12
|
+
//#region node_modules/@koishijs/plugin-notifier/lib/index.mjs
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
15
|
+
value,
|
|
16
|
+
configurable: true
|
|
17
17
|
});
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
var Notifier = class {
|
|
19
|
+
constructor(ctx, options) {
|
|
20
|
+
this.ctx = ctx;
|
|
21
|
+
this.options = {
|
|
22
|
+
type: "primary",
|
|
23
|
+
content: []
|
|
24
|
+
};
|
|
25
|
+
ctx.notifier.store.push(this);
|
|
26
|
+
this.update(options);
|
|
27
|
+
ctx.notifier.entry?.refresh();
|
|
28
|
+
this.dispose = ctx.collect("entry", () => {
|
|
29
|
+
this.clearActions();
|
|
30
|
+
(0, koishi.remove)(ctx.notifier.store, this);
|
|
31
|
+
ctx.notifier.entry?.refresh();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
static {
|
|
35
|
+
__name(this, "Notifier");
|
|
36
|
+
}
|
|
37
|
+
options;
|
|
38
|
+
dispose;
|
|
39
|
+
actionKeys = [];
|
|
40
|
+
clearActions() {
|
|
41
|
+
for (const key of this.actionKeys) delete this.ctx.notifier.actions[key];
|
|
42
|
+
this.actionKeys = [];
|
|
43
|
+
}
|
|
44
|
+
update(options) {
|
|
45
|
+
if (typeof options === "string" || koishi.h.isElement(options) || Array.isArray(options)) options = { content: options };
|
|
46
|
+
if (!(0, koishi.isNullable)(options?.content)) {
|
|
47
|
+
this.clearActions();
|
|
48
|
+
const content = typeof options.content === "string" ? [(0, koishi.h)("p", options.content)] : koishi.h.toElementArray(options.content);
|
|
49
|
+
options.content = koishi.h.transform(content, ({ type, attrs }) => {
|
|
50
|
+
if (type === "button" && typeof attrs.onClick === "function") {
|
|
51
|
+
const key = Math.random().toString(36).slice(2);
|
|
52
|
+
this.ctx.notifier.actions[key] = attrs.onClick;
|
|
53
|
+
this.actionKeys.push(key);
|
|
54
|
+
attrs.onClick = key;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
Object.assign(this.options, options);
|
|
60
|
+
this.ctx.notifier.entry?.refresh();
|
|
61
|
+
}
|
|
62
|
+
toJSON() {
|
|
63
|
+
return {
|
|
64
|
+
...this.options,
|
|
65
|
+
content: this.options.content.join(""),
|
|
66
|
+
paths: this.ctx.get("loader")?.paths(this.ctx.scope)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
37
69
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
var NotifierService = class extends koishi.Service {
|
|
71
|
+
constructor(ctx, config) {
|
|
72
|
+
super(ctx, "notifier", true);
|
|
73
|
+
this.config = config;
|
|
74
|
+
ctx.inject(["console"], (ctx2) => {
|
|
75
|
+
ctx2.on("dispose", () => this.entry = void 0);
|
|
76
|
+
this.entry = ctx2.console.addEntry(process.env.KOISHI_BASE ? [process.env.KOISHI_BASE + "/dist/index.js", process.env.KOISHI_BASE + "/dist/style.css"] : process.env.KOISHI_ENV === "browser" ? [require("url").pathToFileURL(__filename).href.replace(/\/src\/[^/]+$/, "/client/index.ts")] : {
|
|
77
|
+
dev: (0, path.resolve)(__dirname, "../client/index.ts"),
|
|
78
|
+
prod: (0, path.resolve)(__dirname, "../dist")
|
|
79
|
+
}, () => ({ notifiers: this.store.map((notifier) => notifier.toJSON()) }));
|
|
80
|
+
ctx2.console.addListener("notifier/button", (id) => {
|
|
81
|
+
return this.actions[id]();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
static {
|
|
86
|
+
__name(this, "NotifierService");
|
|
87
|
+
}
|
|
88
|
+
static inject = { optional: ["notifier"] };
|
|
89
|
+
store = [];
|
|
90
|
+
actions = /* @__PURE__ */ Object.create(null);
|
|
91
|
+
entry;
|
|
92
|
+
message(options) {
|
|
93
|
+
if (typeof options === "string") options = { content: options };
|
|
94
|
+
options.type ||= "primary";
|
|
95
|
+
this.ctx.get("console").broadcast("notifier/message", options);
|
|
96
|
+
}
|
|
97
|
+
create(options) {
|
|
98
|
+
return new Notifier(this.ctx, options);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
((NotifierService2) => {
|
|
102
|
+
NotifierService2.Config = koishi.Schema.object({});
|
|
103
|
+
})(NotifierService || (NotifierService = {}));
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/index.ts
|
|
107
|
+
const inject = [
|
|
108
|
+
"puppeteer",
|
|
109
|
+
"database",
|
|
110
|
+
"notifier"
|
|
111
|
+
];
|
|
112
|
+
const name = "bilibili-notify";
|
|
113
|
+
const usage = `
|
|
52
114
|
Bilibili-Notify
|
|
53
115
|
如遇到使用问题或bug,请加群咨询 801338523
|
|
54
116
|
`;
|
|
55
117
|
let globalConfig;
|
|
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
|
-
this.servers.push(gi);
|
|
151
|
-
this.servers.push(cr);
|
|
152
|
-
}
|
|
153
|
-
catch (e) {
|
|
154
|
-
this.logger.error("插件注册失败", e);
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
// 成功返回true
|
|
158
|
-
return true;
|
|
159
|
-
};
|
|
160
|
-
disposePlugin = async () => {
|
|
161
|
-
// 如果没有服务则返回false
|
|
162
|
-
if (this.servers.length === 0)
|
|
163
|
-
return false;
|
|
164
|
-
// 遍历服务
|
|
165
|
-
await new Promise((resolve) => {
|
|
166
|
-
for (const fork of this.servers) {
|
|
167
|
-
fork.dispose();
|
|
168
|
-
}
|
|
169
|
-
// 清空服务
|
|
170
|
-
this.servers = [];
|
|
171
|
-
resolve("ok");
|
|
172
|
-
});
|
|
173
|
-
// 成功返回true
|
|
174
|
-
return true;
|
|
175
|
-
};
|
|
176
|
-
restartPlugin = async () => {
|
|
177
|
-
// 如果没有服务则返回false
|
|
178
|
-
if (this.servers.length === 0)
|
|
179
|
-
return false;
|
|
180
|
-
// 停用插件
|
|
181
|
-
await this.disposePlugin();
|
|
182
|
-
// 隔一秒启动插件
|
|
183
|
-
return new Promise((resolve) => {
|
|
184
|
-
this.ctx.setTimeout(() => {
|
|
185
|
-
try {
|
|
186
|
-
this.registerPlugin();
|
|
187
|
-
}
|
|
188
|
-
catch (e) {
|
|
189
|
-
this.logger.error("重启插件失败", e);
|
|
190
|
-
resolve(false);
|
|
191
|
-
}
|
|
192
|
-
resolve(true);
|
|
193
|
-
}, 1000);
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
}
|
|
118
|
+
var ServerManager = class extends koishi.Service {
|
|
119
|
+
servers = [];
|
|
120
|
+
constructor(ctx) {
|
|
121
|
+
super(ctx, "sm");
|
|
122
|
+
const sysCom = ctx.command("sys", "bili-notify插件运行相关指令", { permissions: ["authority:5"] });
|
|
123
|
+
sysCom.subcommand(".restart", "重启插件").usage("重启插件").example("sys restart").action(async () => {
|
|
124
|
+
this.logger.info("调用sys restart指令");
|
|
125
|
+
if (await this.restartPlugin()) return "插件重启成功";
|
|
126
|
+
return "插件重启失败";
|
|
127
|
+
});
|
|
128
|
+
sysCom.subcommand(".stop", "停止插件").usage("停止插件").example("sys stop").action(async () => {
|
|
129
|
+
this.logger.info("调用sys stop指令");
|
|
130
|
+
if (await this.disposePlugin()) return "插件已停止";
|
|
131
|
+
return "停止插件失败";
|
|
132
|
+
});
|
|
133
|
+
sysCom.subcommand(".start", "启动插件").usage("启动插件").example("sys start").action(async () => {
|
|
134
|
+
this.logger.info("调用sys start指令");
|
|
135
|
+
if (await this.registerPlugin()) return "插件启动成功";
|
|
136
|
+
return "插件启动失败";
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
start() {
|
|
140
|
+
if (!this.registerPlugin()) this.logger.error("插件启动失败");
|
|
141
|
+
}
|
|
142
|
+
registerPlugin = () => {
|
|
143
|
+
if (this.servers.length !== 0) return false;
|
|
144
|
+
try {
|
|
145
|
+
const ba = this.ctx.plugin(require_biliAPI.biliAPI_default, {
|
|
146
|
+
userAgent: globalConfig.userAgent,
|
|
147
|
+
key: globalConfig.key
|
|
148
|
+
});
|
|
149
|
+
const gi = this.ctx.plugin(require_generateImg.generateImg_default, {
|
|
150
|
+
filter: globalConfig.filter,
|
|
151
|
+
removeBorder: globalConfig.removeBorder,
|
|
152
|
+
cardColorStart: globalConfig.cardColorStart,
|
|
153
|
+
cardColorEnd: globalConfig.cardColorEnd,
|
|
154
|
+
cardBasePlateColor: globalConfig.cardBasePlateColor,
|
|
155
|
+
cardBasePlateBorder: globalConfig.cardBasePlateBorder,
|
|
156
|
+
hideDesc: globalConfig.hideDesc,
|
|
157
|
+
enableLargeFont: globalConfig.enableLargeFont,
|
|
158
|
+
font: globalConfig.font,
|
|
159
|
+
followerDisplay: globalConfig.followerDisplay
|
|
160
|
+
});
|
|
161
|
+
const cr = this.ctx.plugin(require_comRegister.comRegister_default, {
|
|
162
|
+
sub: globalConfig.sub,
|
|
163
|
+
master: globalConfig.master,
|
|
164
|
+
liveDetectType: globalConfig.liveDetectType,
|
|
165
|
+
restartPush: globalConfig.restartPush,
|
|
166
|
+
pushTime: globalConfig.pushTime,
|
|
167
|
+
pushImgsInDynamic: globalConfig.pushImgsInDynamic,
|
|
168
|
+
customLiveStart: globalConfig.customLiveStart,
|
|
169
|
+
customLive: globalConfig.customLive,
|
|
170
|
+
customLiveEnd: globalConfig.customLiveEnd,
|
|
171
|
+
dynamicUrl: globalConfig.dynamicUrl,
|
|
172
|
+
dynamicVideoUrlToBV: globalConfig.dynamicVideoUrlToBV,
|
|
173
|
+
filter: globalConfig.filter,
|
|
174
|
+
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
175
|
+
});
|
|
176
|
+
const bl = this.ctx.plugin(require_blive.blive_default);
|
|
177
|
+
this.servers.push(ba);
|
|
178
|
+
this.servers.push(bl);
|
|
179
|
+
this.servers.push(gi);
|
|
180
|
+
this.servers.push(cr);
|
|
181
|
+
} catch (e) {
|
|
182
|
+
this.logger.error("插件注册失败", e);
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
};
|
|
187
|
+
disposePlugin = async () => {
|
|
188
|
+
if (this.servers.length === 0) return false;
|
|
189
|
+
await new Promise((resolve$1) => {
|
|
190
|
+
for (const fork of this.servers) fork.dispose();
|
|
191
|
+
this.servers = [];
|
|
192
|
+
resolve$1("ok");
|
|
193
|
+
});
|
|
194
|
+
return true;
|
|
195
|
+
};
|
|
196
|
+
restartPlugin = async () => {
|
|
197
|
+
if (this.servers.length === 0) return false;
|
|
198
|
+
await this.disposePlugin();
|
|
199
|
+
return new Promise((resolve$1) => {
|
|
200
|
+
this.ctx.setTimeout(() => {
|
|
201
|
+
try {
|
|
202
|
+
this.registerPlugin();
|
|
203
|
+
} catch (e) {
|
|
204
|
+
this.logger.error("重启插件失败", e);
|
|
205
|
+
resolve$1(false);
|
|
206
|
+
}
|
|
207
|
+
resolve$1(true);
|
|
208
|
+
}, 1e3);
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
};
|
|
197
212
|
function apply(ctx, config) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
ctx.middleware((session, next) => {
|
|
206
|
-
if (session.content === "恶魔兔,启动!") {
|
|
207
|
-
return session.send("启动不了一点");
|
|
208
|
-
}
|
|
209
|
-
return next();
|
|
210
|
-
});
|
|
213
|
+
globalConfig = config;
|
|
214
|
+
ctx.plugin(require_database.database_exports);
|
|
215
|
+
ctx.plugin(ServerManager);
|
|
216
|
+
ctx.middleware((session, next) => {
|
|
217
|
+
if (session.content === "恶魔兔,启动!") return session.send("启动不了一点");
|
|
218
|
+
return next();
|
|
219
|
+
});
|
|
211
220
|
}
|
|
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
|
-
.description("是否开启自定义卡片颜色"),
|
|
290
|
-
}),
|
|
291
|
-
koishi_1.Schema.union([
|
|
292
|
-
koishi_1.Schema.object({
|
|
293
|
-
enable: koishi_1.Schema.const(true).required(),
|
|
294
|
-
cardColorStart: koishi_1.Schema.string()
|
|
295
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
296
|
-
.description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"),
|
|
297
|
-
cardColorEnd: koishi_1.Schema.string()
|
|
298
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
299
|
-
.description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"),
|
|
300
|
-
cardBasePlateColor: koishi_1.Schema.string()
|
|
301
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
302
|
-
.description("推送卡片底板颜色,请填入16进制颜色代码"),
|
|
303
|
-
cardBasePlateBorder: koishi_1.Schema.string()
|
|
304
|
-
.pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/)
|
|
305
|
-
.description("推送卡片底板边框宽度,请填入css单位,例如1px,12.5rem,100%"),
|
|
306
|
-
}),
|
|
307
|
-
koishi_1.Schema.object({}),
|
|
308
|
-
]),
|
|
309
|
-
]),
|
|
310
|
-
}).collapse())
|
|
311
|
-
.collapse()
|
|
312
|
-
.description("输入订阅信息,自定义订阅内容; uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播"),
|
|
313
|
-
dynamic: koishi_1.Schema.object({}).description("动态推送设置"),
|
|
314
|
-
dynamicUrl: koishi_1.Schema.boolean()
|
|
315
|
-
.default(false)
|
|
316
|
-
.description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
|
|
317
|
-
dynamicVideoUrlToBV: koishi_1.Schema.boolean()
|
|
318
|
-
.default(false)
|
|
319
|
-
.description("如果推送的动态是视频动态,且开启了发送链接选项,开启此选项则会将链接转换为BV号以便其他用途"),
|
|
320
|
-
pushImgsInDynamic: koishi_1.Schema.boolean()
|
|
321
|
-
.default(false)
|
|
322
|
-
.description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
|
|
323
|
-
live: koishi_1.Schema.object({}).description("直播推送设置"),
|
|
324
|
-
liveDetectType: koishi_1.Schema.union([
|
|
325
|
-
koishi_1.Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"),
|
|
326
|
-
koishi_1.Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental(),
|
|
327
|
-
])
|
|
328
|
-
.role("radio")
|
|
329
|
-
.default("WS")
|
|
330
|
-
.description("直播检测方式,WS为连接到B站消息服务器,API为通过轮询发送请求监测,默认使用WS检测"),
|
|
331
|
-
restartPush: koishi_1.Schema.boolean()
|
|
332
|
-
.default(true)
|
|
333
|
-
.description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
|
|
334
|
-
pushTime: koishi_1.Schema.number()
|
|
335
|
-
.min(0)
|
|
336
|
-
.max(12)
|
|
337
|
-
.step(0.5)
|
|
338
|
-
.default(1)
|
|
339
|
-
.description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
|
|
340
|
-
customLiveStart: koishi_1.Schema.string()
|
|
341
|
-
.default("-name开播啦,当前粉丝数:-follower\\n-link")
|
|
342
|
-
.description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"),
|
|
343
|
-
customLive: koishi_1.Schema.string()
|
|
344
|
-
.default("-name正在直播,目前已播-time,累计观看人数:-watched\\n-link")
|
|
345
|
-
.description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计观看人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name正在直播,会发送为xxxUP正在直播xxx"),
|
|
346
|
-
customLiveEnd: koishi_1.Schema.string()
|
|
347
|
-
.default("-name下播啦,本次直播了-time,粉丝数变化-follower_change")
|
|
348
|
-
.description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长,\\n为换行。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
|
|
349
|
-
followerDisplay: koishi_1.Schema.boolean()
|
|
350
|
-
.default(true)
|
|
351
|
-
.description("粉丝数变化和累积观看本场直播的人数是否显示在推送卡片中"),
|
|
352
|
-
hideDesc: koishi_1.Schema.boolean()
|
|
353
|
-
.default(false)
|
|
354
|
-
.description("是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介"),
|
|
355
|
-
style: koishi_1.Schema.object({}).description("美化设置"),
|
|
356
|
-
removeBorder: koishi_1.Schema.boolean().default(false).description("移除推送卡片边框"),
|
|
357
|
-
cardColorStart: koishi_1.Schema.string()
|
|
358
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
359
|
-
.default("#F38AB5")
|
|
360
|
-
.description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"),
|
|
361
|
-
cardColorEnd: koishi_1.Schema.string()
|
|
362
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
363
|
-
.default("#F9CCDF")
|
|
364
|
-
.description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"),
|
|
365
|
-
cardBasePlateColor: koishi_1.Schema.string()
|
|
366
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
367
|
-
.default("#FFF5EE")
|
|
368
|
-
.description("推送卡片底板颜色,请填入16进制颜色代码"),
|
|
369
|
-
cardBasePlateBorder: koishi_1.Schema.string()
|
|
370
|
-
.pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/)
|
|
371
|
-
.default("15px")
|
|
372
|
-
.description("推送卡片底板边框宽度,请填入css单位,例如1px,12.5rem,100%"),
|
|
373
|
-
enableLargeFont: koishi_1.Schema.boolean()
|
|
374
|
-
.default(false)
|
|
375
|
-
.description("是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看"),
|
|
376
|
-
font: koishi_1.Schema.string().description("推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei"),
|
|
377
|
-
filter: koishi_1.Schema.intersect([
|
|
378
|
-
koishi_1.Schema.object({
|
|
379
|
-
enable: koishi_1.Schema.boolean()
|
|
380
|
-
.default(false)
|
|
381
|
-
.description("是否开启动态屏蔽功能"),
|
|
382
|
-
}).description("屏蔽设置"),
|
|
383
|
-
koishi_1.Schema.union([
|
|
384
|
-
koishi_1.Schema.object({
|
|
385
|
-
enable: koishi_1.Schema.const(true).required().experimental(),
|
|
386
|
-
notify: koishi_1.Schema.boolean()
|
|
387
|
-
.default(false)
|
|
388
|
-
.description("动态被屏蔽是否发送提示"),
|
|
389
|
-
regex: koishi_1.Schema.string().description("正则表达式屏蔽"),
|
|
390
|
-
keywords: koishi_1.Schema.array(String).description("关键字屏蔽,一个关键字为一项"),
|
|
391
|
-
forward: koishi_1.Schema.boolean()
|
|
392
|
-
.default(false)
|
|
393
|
-
.description("是否屏蔽转发动态"),
|
|
394
|
-
article: koishi_1.Schema.boolean().default(false).description("是否屏蔽专栏"),
|
|
395
|
-
}),
|
|
396
|
-
koishi_1.Schema.object({}),
|
|
397
|
-
]),
|
|
398
|
-
]),
|
|
399
|
-
debug: koishi_1.Schema.object({}).description("调试设置"),
|
|
400
|
-
dynamicDebugMode: koishi_1.Schema.boolean()
|
|
401
|
-
.default(false)
|
|
402
|
-
.description("动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试"),
|
|
221
|
+
const Config = koishi.Schema.object({
|
|
222
|
+
require: koishi.Schema.object({}).description("必填设置"),
|
|
223
|
+
key: koishi.Schema.string().pattern(/^[0-9a-f]{32}$/).role("secret").required().description("请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/"),
|
|
224
|
+
master: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告") }).description("主人账号"), koishi.Schema.union([koishi.Schema.object({
|
|
225
|
+
enable: koishi.Schema.const(true).required(),
|
|
226
|
+
platform: koishi.Schema.union([
|
|
227
|
+
"qq",
|
|
228
|
+
"qqguild",
|
|
229
|
+
"onebot",
|
|
230
|
+
"discord",
|
|
231
|
+
"red",
|
|
232
|
+
"telegram",
|
|
233
|
+
"satori",
|
|
234
|
+
"chronocat",
|
|
235
|
+
"lark"
|
|
236
|
+
]).description("请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件"),
|
|
237
|
+
masterAccount: koishi.Schema.string().role("secret").required().description("主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID"),
|
|
238
|
+
masterAccountGuildId: koishi.Schema.string().role("secret").description("主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID")
|
|
239
|
+
}), koishi.Schema.object({})])]),
|
|
240
|
+
basicSettings: koishi.Schema.object({}).description("基本设置"),
|
|
241
|
+
userAgent: koishi.Schema.string().required().description("设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111"),
|
|
242
|
+
subTitle: koishi.Schema.object({}).description("订阅配置"),
|
|
243
|
+
sub: koishi.Schema.array(koishi.Schema.object({
|
|
244
|
+
name: koishi.Schema.string().description("订阅用户昵称,只是给你自己看的(相当于备注),可填可不填"),
|
|
245
|
+
uid: koishi.Schema.string().required().description("订阅用户UID"),
|
|
246
|
+
dynamic: koishi.Schema.boolean().default(false).description("是否订阅用户动态"),
|
|
247
|
+
live: koishi.Schema.boolean().default(false).description("是否订阅用户直播"),
|
|
248
|
+
target: koishi.Schema.array(koishi.Schema.object({
|
|
249
|
+
platform: koishi.Schema.string().required().description("推送平台,例如onebot、qq、discord"),
|
|
250
|
+
channelArr: koishi.Schema.array(koishi.Schema.object({
|
|
251
|
+
channelId: koishi.Schema.string().required().description("频道/群组号"),
|
|
252
|
+
dynamic: koishi.Schema.boolean().default(false).description("该频道/群组是否推送动态信息"),
|
|
253
|
+
live: koishi.Schema.boolean().default(false).description("该频道/群组是否推送直播通知"),
|
|
254
|
+
liveGuardBuy: koishi.Schema.boolean().default(false).description("该频道/群组是否推送上舰消息"),
|
|
255
|
+
atAll: koishi.Schema.boolean().default(false).description("推送开播通知时是否艾特全体成员"),
|
|
256
|
+
bot: koishi.Schema.string().description("若您有多个相同平台机器人,可在此填写当前群聊执行推送的机器人账号。不填则默认第一个")
|
|
257
|
+
})).role("table").required().description("需推送的频道/群组详细设置")
|
|
258
|
+
})).description("订阅用户需要发送的平台和频道/群组信息(一个平台下可以推送多个频道/群组)"),
|
|
259
|
+
card: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启自定义卡片颜色") }), koishi.Schema.union([koishi.Schema.object({
|
|
260
|
+
enable: koishi.Schema.const(true).required(),
|
|
261
|
+
cardColorStart: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"),
|
|
262
|
+
cardColorEnd: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"),
|
|
263
|
+
cardBasePlateColor: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).description("推送卡片底板颜色,请填入16进制颜色代码"),
|
|
264
|
+
cardBasePlateBorder: koishi.Schema.string().pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/).description("推送卡片底板边框宽度,请填入css单位,例如1px,12.5rem,100%")
|
|
265
|
+
}), koishi.Schema.object({})])])
|
|
266
|
+
}).collapse()).collapse().description("输入订阅信息,自定义订阅内容; uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播"),
|
|
267
|
+
dynamic: koishi.Schema.object({}).description("动态推送设置"),
|
|
268
|
+
dynamicUrl: koishi.Schema.boolean().default(false).description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
|
|
269
|
+
dynamicVideoUrlToBV: koishi.Schema.boolean().default(false).description("如果推送的动态是视频动态,且开启了发送链接选项,开启此选项则会将链接转换为BV号以便其他用途"),
|
|
270
|
+
pushImgsInDynamic: koishi.Schema.boolean().default(false).description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
|
|
271
|
+
live: koishi.Schema.object({}).description("直播推送设置"),
|
|
272
|
+
liveDetectType: koishi.Schema.union([koishi.Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"), koishi.Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental()]).role("radio").default("WS").description("直播检测方式,WS为连接到B站消息服务器,API为通过轮询发送请求监测,默认使用WS检测"),
|
|
273
|
+
restartPush: koishi.Schema.boolean().default(true).description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
|
|
274
|
+
pushTime: koishi.Schema.number().min(0).max(12).step(.5).default(1).description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
|
|
275
|
+
customLiveStart: koishi.Schema.string().default("-name开播啦,当前粉丝数:-follower\\n-link").description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"),
|
|
276
|
+
customLive: koishi.Schema.string().default("-name正在直播,目前已播-time,累计观看人数:-watched\\n-link").description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计观看人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name正在直播,会发送为xxxUP正在直播xxx"),
|
|
277
|
+
customLiveEnd: koishi.Schema.string().default("-name下播啦,本次直播了-time,粉丝数变化-follower_change").description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长,\\n为换行。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
|
|
278
|
+
followerDisplay: koishi.Schema.boolean().default(true).description("粉丝数变化和累积观看本场直播的人数是否显示在推送卡片中"),
|
|
279
|
+
hideDesc: koishi.Schema.boolean().default(false).description("是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介"),
|
|
280
|
+
style: koishi.Schema.object({}).description("美化设置"),
|
|
281
|
+
removeBorder: koishi.Schema.boolean().default(false).description("移除推送卡片边框"),
|
|
282
|
+
cardColorStart: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#F38AB5").description("推送卡片的开始渐变背景色,请填入16进制颜色代码,参考网站:https://webkul.github.io/coolhue/"),
|
|
283
|
+
cardColorEnd: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#F9CCDF").description("推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/"),
|
|
284
|
+
cardBasePlateColor: koishi.Schema.string().pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).default("#FFF5EE").description("推送卡片底板颜色,请填入16进制颜色代码"),
|
|
285
|
+
cardBasePlateBorder: koishi.Schema.string().pattern(/\d*\.?\d+(?:px|em|rem|%|vh|vw|vmin|vmax)/).default("15px").description("推送卡片底板边框宽度,请填入css单位,例如1px,12.5rem,100%"),
|
|
286
|
+
enableLargeFont: koishi.Schema.boolean().default(false).description("是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看"),
|
|
287
|
+
font: koishi.Schema.string().description("推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei"),
|
|
288
|
+
filter: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启动态屏蔽功能") }).description("屏蔽设置"), koishi.Schema.union([koishi.Schema.object({
|
|
289
|
+
enable: koishi.Schema.const(true).required().experimental(),
|
|
290
|
+
notify: koishi.Schema.boolean().default(false).description("动态被屏蔽是否发送提示"),
|
|
291
|
+
regex: koishi.Schema.string().description("正则表达式屏蔽"),
|
|
292
|
+
keywords: koishi.Schema.array(String).description("关键字屏蔽,一个关键字为一项"),
|
|
293
|
+
forward: koishi.Schema.boolean().default(false).description("是否屏蔽转发动态"),
|
|
294
|
+
article: koishi.Schema.boolean().default(false).description("是否屏蔽专栏")
|
|
295
|
+
}), koishi.Schema.object({})])]),
|
|
296
|
+
debug: koishi.Schema.object({}).description("调试设置"),
|
|
297
|
+
dynamicDebugMode: koishi.Schema.boolean().default(false).description("动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试")
|
|
403
298
|
});
|
|
299
|
+
|
|
300
|
+
//#endregion
|
|
301
|
+
exports.Config = Config;
|
|
302
|
+
exports.apply = apply;
|
|
303
|
+
exports.inject = inject;
|
|
304
|
+
exports.name = name;
|
|
305
|
+
exports.usage = usage;
|