koishi-plugin-bilibili-notify 2.0.0-alpha.2 → 2.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/biliAPI.d.ts +3 -0
- package/lib/biliAPI.js +38 -0
- package/lib/blive.d.ts +9 -0
- package/lib/blive.js +51 -0
- package/lib/comRegister.d.ts +49 -12
- package/lib/comRegister.js +559 -406
- package/lib/database.d.ts +1 -2
- package/lib/database.js +1 -2
- package/lib/generateImg.js +1 -1
- package/lib/index.d.ts +16 -2
- package/lib/index.js +30 -11
- package/package.json +2 -1
- package/{README.md → readme.md} +39 -11
package/lib/database.d.ts
CHANGED
package/lib/database.js
CHANGED
package/lib/generateImg.js
CHANGED
|
@@ -176,7 +176,7 @@ class GenerateImg extends koishi_1.Service {
|
|
|
176
176
|
</div>
|
|
177
177
|
${this.giConfig.hideDesc ? '' : `<p class="card-text">${data.description ? data.description : '这个主播很懒,什么都简介都没写'}</p>`}
|
|
178
178
|
<p class="card-link">
|
|
179
|
-
|
|
179
|
+
${liveStatus !== 3 ? `<span>人气:${data.online > 10000 ? `${(data.online / 10000).toFixed(1)}万` : data.online}</span>` : ''}
|
|
180
180
|
<span>分区名称:${data.area_name}</span>
|
|
181
181
|
</p>
|
|
182
182
|
<p class="card-link">
|
package/lib/index.d.ts
CHANGED
|
@@ -9,13 +9,27 @@ declare module 'koishi' {
|
|
|
9
9
|
export interface Config {
|
|
10
10
|
require: {};
|
|
11
11
|
key: string;
|
|
12
|
-
platform: 'qq' | 'qqguild' | 'onebot' | 'discord' | 'red' | 'telegram' | 'satori' | 'chronocat' | 'lark';
|
|
13
12
|
master: {};
|
|
14
13
|
basicSettings: {};
|
|
15
14
|
unlockSubLimits: boolean;
|
|
16
15
|
automaticResend: boolean;
|
|
17
16
|
renderType: 'render' | 'page';
|
|
18
17
|
userAgent: string;
|
|
18
|
+
subTitle: {};
|
|
19
|
+
sub: Array<{
|
|
20
|
+
uid: string;
|
|
21
|
+
dynamic: boolean;
|
|
22
|
+
live: boolean;
|
|
23
|
+
target: Array<{
|
|
24
|
+
channelIdArr: Array<{
|
|
25
|
+
channelId: string;
|
|
26
|
+
dynamic: boolean;
|
|
27
|
+
live: boolean;
|
|
28
|
+
atAll: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
platform: string;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
19
33
|
dynamic: {};
|
|
20
34
|
dynamicUrl: boolean;
|
|
21
35
|
dynamicCheckNumber: number;
|
|
@@ -24,9 +38,9 @@ export interface Config {
|
|
|
24
38
|
changeMasterInfoApi: boolean;
|
|
25
39
|
liveStartAtAll: boolean;
|
|
26
40
|
restartPush: boolean;
|
|
27
|
-
pushUrl: boolean;
|
|
28
41
|
pushTime: number;
|
|
29
42
|
customLiveStart: string;
|
|
43
|
+
customLive: string;
|
|
30
44
|
customLiveEnd: string;
|
|
31
45
|
hideDesc: boolean;
|
|
32
46
|
style: {};
|
package/lib/index.js
CHANGED
|
@@ -47,6 +47,7 @@ const Database = __importStar(require("./database"));
|
|
|
47
47
|
// import Service
|
|
48
48
|
const generateImg_1 = __importDefault(require("./generateImg"));
|
|
49
49
|
const biliAPI_1 = __importDefault(require("./biliAPI"));
|
|
50
|
+
const blive_1 = __importDefault(require("./blive"));
|
|
50
51
|
exports.inject = ['puppeteer', 'database', 'notifier'];
|
|
51
52
|
exports.name = 'bilibili-notify';
|
|
52
53
|
let globalConfig;
|
|
@@ -57,10 +58,6 @@ exports.Config = koishi_1.Schema.object({
|
|
|
57
58
|
.role('secret')
|
|
58
59
|
.required()
|
|
59
60
|
.description('请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/'),
|
|
60
|
-
platform: koishi_1.Schema.union(['qq', 'qqguild', 'onebot', 'discord', 'red', 'telegram', 'satori', 'chronocat', 'lark'])
|
|
61
|
-
.role('')
|
|
62
|
-
.required()
|
|
63
|
-
.description('请选择你的机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件'),
|
|
64
61
|
master: koishi_1.Schema.intersect([
|
|
65
62
|
koishi_1.Schema.object({
|
|
66
63
|
enable: koishi_1.Schema.boolean()
|
|
@@ -70,6 +67,8 @@ exports.Config = koishi_1.Schema.object({
|
|
|
70
67
|
koishi_1.Schema.union([
|
|
71
68
|
koishi_1.Schema.object({
|
|
72
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版本开始,只能在一个平台下使用本插件'),
|
|
73
72
|
masterAccount: koishi_1.Schema.string()
|
|
74
73
|
.role('secret')
|
|
75
74
|
.required()
|
|
@@ -95,6 +94,21 @@ exports.Config = koishi_1.Schema.object({
|
|
|
95
94
|
userAgent: koishi_1.Schema.string()
|
|
96
95
|
.required()
|
|
97
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
|
+
atAll: koishi_1.Schema.boolean().description('推送开播通知时是否艾特全体成员')
|
|
108
|
+
})).description('频道/群组信息'),
|
|
109
|
+
platform: koishi_1.Schema.string().description('推送平台')
|
|
110
|
+
})).description('订阅用户需要发送的频道/群组信息')
|
|
111
|
+
})).role('table').description('手动输入订阅信息,方便自定义订阅内容,这里的订阅内容不会存入数据库。uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播'),
|
|
98
112
|
dynamic: koishi_1.Schema.object({}).description('动态推送设置'),
|
|
99
113
|
dynamicUrl: koishi_1.Schema.boolean()
|
|
100
114
|
.default(false)
|
|
@@ -120,9 +134,6 @@ exports.Config = koishi_1.Schema.object({
|
|
|
120
134
|
restartPush: koishi_1.Schema.boolean()
|
|
121
135
|
.default(true)
|
|
122
136
|
.description('插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启'),
|
|
123
|
-
pushUrl: koishi_1.Schema.boolean()
|
|
124
|
-
.default(false)
|
|
125
|
-
.description('推送直播状态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!'),
|
|
126
137
|
pushTime: koishi_1.Schema.number()
|
|
127
138
|
.min(0)
|
|
128
139
|
.max(12)
|
|
@@ -132,6 +143,8 @@ exports.Config = koishi_1.Schema.object({
|
|
|
132
143
|
customLiveStart: koishi_1.Schema.string()
|
|
133
144
|
.default('-name开播啦 -link')
|
|
134
145
|
.description('自定义开播提示语,-name代表UP昵称,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦'),
|
|
146
|
+
customLive: koishi_1.Schema.string()
|
|
147
|
+
.description('自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx'),
|
|
135
148
|
customLiveEnd: koishi_1.Schema.string()
|
|
136
149
|
.default('-name下播啦,本次直播了-time')
|
|
137
150
|
.description('自定义下播提示语,-name代表UP昵称,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒'),
|
|
@@ -293,16 +306,16 @@ class ServerManager extends koishi_1.Service {
|
|
|
293
306
|
});
|
|
294
307
|
// CR = ComRegister
|
|
295
308
|
const cr = this.ctx.plugin(comRegister_1.default, {
|
|
296
|
-
|
|
309
|
+
sub: globalConfig.sub,
|
|
297
310
|
master: globalConfig.master,
|
|
298
311
|
unlockSubLimits: globalConfig.unlockSubLimits,
|
|
299
312
|
automaticResend: globalConfig.automaticResend,
|
|
300
313
|
changeMasterInfoApi: globalConfig.changeMasterInfoApi,
|
|
301
314
|
liveStartAtAll: globalConfig.liveStartAtAll,
|
|
302
315
|
restartPush: globalConfig.restartPush,
|
|
303
|
-
pushUrl: globalConfig.pushUrl,
|
|
304
316
|
pushTime: globalConfig.pushTime,
|
|
305
317
|
customLiveStart: globalConfig.customLiveStart,
|
|
318
|
+
customLive: globalConfig.customLive,
|
|
306
319
|
customLiveEnd: globalConfig.customLiveEnd,
|
|
307
320
|
dynamicCheckNumber: globalConfig.dynamicCheckNumber,
|
|
308
321
|
dynamicLoopTime: this.dynamicLoopTime,
|
|
@@ -310,10 +323,13 @@ class ServerManager extends koishi_1.Service {
|
|
|
310
323
|
filter: globalConfig.filter,
|
|
311
324
|
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
312
325
|
});
|
|
326
|
+
// BL = BLive
|
|
327
|
+
const bl = this.ctx.plugin(blive_1.default, {});
|
|
313
328
|
// 添加服务
|
|
314
329
|
this.servers.push(ba);
|
|
315
330
|
this.servers.push(gi);
|
|
316
331
|
this.servers.push(cr);
|
|
332
|
+
this.servers.push(bl);
|
|
317
333
|
}
|
|
318
334
|
catch (e) {
|
|
319
335
|
this.logger.error('插件注册失败', e);
|
|
@@ -346,9 +362,9 @@ class ServerManager extends koishi_1.Service {
|
|
|
346
362
|
await this.disposePlugin();
|
|
347
363
|
// 隔一秒启动插件
|
|
348
364
|
return new Promise(resolve => {
|
|
349
|
-
this.ctx.setTimeout(
|
|
365
|
+
this.ctx.setTimeout(() => {
|
|
350
366
|
try {
|
|
351
|
-
|
|
367
|
+
this.registerPlugin();
|
|
352
368
|
}
|
|
353
369
|
catch (e) {
|
|
354
370
|
this.logger.error('重启插件失败', e);
|
|
@@ -363,6 +379,9 @@ function apply(ctx, config) {
|
|
|
363
379
|
// 设置config
|
|
364
380
|
globalConfig = config;
|
|
365
381
|
// 设置提示
|
|
382
|
+
ctx.notifier.create({
|
|
383
|
+
content: '从2.0.0-alpha.9以前版本更新需重新订阅'
|
|
384
|
+
});
|
|
366
385
|
ctx.notifier.create({
|
|
367
386
|
content: '请使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。'
|
|
368
387
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-bilibili-notify",
|
|
3
3
|
"description": "Koishi bilibili notify plugin",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.21",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Akokko <admin@akokko.com>"
|
|
7
7
|
],
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"axios": "^1.7.9",
|
|
31
31
|
"axios-cookiejar-support": "^5.0.5",
|
|
32
|
+
"blive-message-listener": "^0.5.0",
|
|
32
33
|
"jsdom": "^24.1.3",
|
|
33
34
|
"luxon": "^3.5.0",
|
|
34
35
|
"md5": "^2.3.0",
|
package/{README.md → readme.md}
RENAMED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
- koishi-plugin-bilibili-notify [](https://www.npmjs.com/package/koishi-plugin-bilibili-notify)
|
|
8
|
+
- [重新订阅](#重新订阅)
|
|
8
9
|
- [功能](#功能)
|
|
9
10
|
- [注意事项](#注意事项)
|
|
10
11
|
- [安装](#安装)
|
|
@@ -14,6 +15,10 @@
|
|
|
14
15
|
- [感谢](#感谢)
|
|
15
16
|
- [License](#License)
|
|
16
17
|
|
|
18
|
+
## 重新订阅
|
|
19
|
+
|
|
20
|
+
由于版本 `2.0.0-alpha.7` 重构了订阅功能,从 `2.0.0-alpha.7` 以前版本升级到以后版本的需重新订阅
|
|
21
|
+
|
|
17
22
|
## 功能
|
|
18
23
|
|
|
19
24
|
订阅B站UP主动态
|
|
@@ -48,23 +53,27 @@
|
|
|
48
53
|
|
|
49
54
|
订阅UP主:订阅你想要推送的UP主
|
|
50
55
|
|
|
51
|
-
- 使用指令 `bili sub <uid> [
|
|
56
|
+
- 使用指令 `bili sub <uid> [...groupId]` 订阅需要订阅的UP主
|
|
52
57
|
- 参数说明:
|
|
53
58
|
- `uid` 为必填参数,为 `up主` 的 `uid`
|
|
54
|
-
- `
|
|
55
|
-
- 选项说明:`bili sub <uid>`
|
|
59
|
+
- `groupId` 为可选参数,为需要推送的群号/频道号,可输入多个群号
|
|
60
|
+
- 选项说明:`bili sub <uid>` 有四个选项:-l -d -m -a
|
|
56
61
|
- `-l` 为订阅UP主直播间,包括直播开播通知,定时推送直播内容,下播通知
|
|
57
62
|
- `-d` 为订阅UP主动态推送,目前实现推送的动态类型有:普通图文动态,转发动态,直播预约动态
|
|
63
|
+
- `-m` 为多平台动态推送,格式为:群号/频道号,群号/频道号,群号/频道号.平台名;群号/频道号,群号/频道号.平台号。如果群号/频道号为 `all` 代表推送该平台下的所有群聊或/频道。在群号/频道号后加 `@` 则代表这个群聊/频道需要@全体成员。订阅TG群组时请使用 `bili sub xxx -m "xxxxxxx"` 这样的格式
|
|
64
|
+
- `-a` 为是否艾特全体成员,对 `-m` 参数不生效
|
|
65
|
+
|
|
66
|
+
例如:
|
|
67
|
+
`-m 3247293,324389,89874324.qq;EDBWIUBIU.qqguild;79324792,3247892.onebot` 代表推送QQ下3247293,324389,89874324这三个群聊,QQ频道下EDBWIUBIU这个频道,Onebot平台下79324792,3247892这两个群聊
|
|
68
|
+
`-m 3247293,324389@,89874324.qq` 代表推送QQ下3247293,324389,89874324这三个群聊,其中群聊324389需要艾特全体成员
|
|
69
|
+
所有分隔符均为英文符号
|
|
58
70
|
|
|
59
71
|
- 例如:
|
|
60
|
-
- `bili sub 1194210119 ` 订阅UID为1194210119的UP
|
|
72
|
+
- `bili sub 1194210119 ` 订阅UID为1194210119的UP主动态推送和直播间
|
|
61
73
|
- `bili sub 1194210119 -d` 订阅UID为1194210119的UP主动态推送
|
|
62
|
-
- `bili sub 1194210119 -
|
|
63
|
-
- `bili sub 1194210119
|
|
64
|
-
- `bili sub 1194210119
|
|
65
|
-
- Tips:
|
|
66
|
-
- 除非使用指令 `bili sub 1194210119 -ld` ,没有加选项或只加了一个选项的指令都会再次询问是否需要订阅另一项。例如:使用指令 `bili sub 1194210119 -d` 机器人会询问是否需要订阅直播间
|
|
67
|
-
- `[Q群号]` 这个可选参数仅支持Q群
|
|
74
|
+
- `bili sub 1194210119 -l` 订阅UID为1194210119的UP主直播间
|
|
75
|
+
- `bili sub 1194210119 -m 3247293,324389,89874324.qq;all.onebot;EHUIWDBUAWD.qqguild` 订阅UID为1194210119的UP主,向群号为3247293,324389,89874324的QQ群,所有onebot平台下的群聊,频道号为EHUIWDBUAWD的QQ频道平台进行推送
|
|
76
|
+
- `bili sub 1194210119 -a` 订阅UID为1194210119的UP主动态推送和直播间并艾特全体成员
|
|
68
77
|
|
|
69
78
|
取消订阅UP主:取消订阅不需要推送的UP主
|
|
70
79
|
|
|
@@ -178,8 +187,27 @@
|
|
|
178
187
|
- ver 1.3.7 新增设置项:插件重启后是否进行直播推送。优化直播人气显示
|
|
179
188
|
|
|
180
189
|
- ver 2.0.0-alpha.0 重构:对动态订阅进行了重构,优化了订阅流程
|
|
181
|
-
- ver 2.0.0-alpha.1
|
|
190
|
+
- ver 2.0.0-alpha.1 修复:无法成功取消订阅自己、用户没有直播间订阅直播出错。对直播订阅进行了限制,继承自以前的unlockSubLimits配置项。优化了一些配置项
|
|
182
191
|
- ver 2.0.0-alpha.2 新增:支持Discord平台。优化了下播通知
|
|
192
|
+
- ver 2.0.0-alpha.3 修复:订阅和取消订阅的bug,下播通知的bug
|
|
193
|
+
- ver 2.0.0-alpha.4 修复:初次订阅后不推送动态的bug 优化:下播不再发送链接
|
|
194
|
+
- ver 2.0.0-alpha.5 移除:选项pushUrl,选项platform 新增:选项customLive,主人账号中platform选项。支持多平台,且可同时推送不同平台,单个UP主只能推送一个平台
|
|
195
|
+
- ver 2.0.0-alpha.6 修复:直播推送发送失败的bug
|
|
196
|
+
- ver 2.0.0-alpha.7 重构:现已支持同一UP多平台推送
|
|
197
|
+
- ver 2.0.0-alpha.8 新增:重新订阅提示
|
|
198
|
+
- ver 2.0.0-alpha.9 修复:订阅反复提示未加入群组的bug,实际已加入
|
|
199
|
+
- ver 2.0.0-alpha.10 新增:可对每个群聊针对性设置是否艾特全体成员 优化:直播下播通知
|
|
200
|
+
- ver 2.0.0-alpha.11 回档:订阅时可直接接收群号/频道号 修复:直播过程推送消息不成功的bug
|
|
201
|
+
- ver 2.0.0-alpha.12 更改:开启艾特全体成员后,只有在开播时才艾特全体成员
|
|
202
|
+
- ver 2.0.0-alpha.13 修复:无法对TG群组的特殊频道号进行订阅处理;提示 `您未配置对应平台的机器人,不能在该平台进行订阅操作` 仍进行订阅操作
|
|
203
|
+
- ver 2.0.0-alpha.14 修复:订阅TG群组时提示输入无效
|
|
204
|
+
- ver 2.0.0-alpha.15 新增:手动订阅功能 修复:一些潜在的bug
|
|
205
|
+
- ver 2.0.0-alpha.16 优化:手动订阅功能
|
|
206
|
+
- ver 2.0.0-alpha.17 修复:直接订阅当前环境不会推送
|
|
207
|
+
- ver 2.0.0-alpha.18 修复:手动订阅无法推送直播通知;自定义直播中通知语不会发送
|
|
208
|
+
- ver 2.0.0-alpha.19 修复:开播通知后带false;下播通知卡片人气位置显示false
|
|
209
|
+
- ver 2.0.0-alpha.20 修复:直播推送失败 `Error with request send_group_msg`
|
|
210
|
+
- ver 2.0.0-alpha.21 修复:在某些场景下仍会出现 `2.0.0-alpha.19` 和 `2.0.0-alpha.20` 版本已修复的问题
|
|
183
211
|
|
|
184
212
|
## 交流群
|
|
185
213
|
|