koishi-plugin-bilibili-notify 3.0.0-alpha.22 → 3.0.0-alpha.23
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 +1 -15
- package/lib/biliAPI.js +2 -2
- package/lib/blive.js +1 -1
- package/lib/comRegister.js +35 -0
- package/lib/type/index.d.ts +15 -0
- package/package.json +1 -1
- package/readme.md +5 -0
package/lib/biliAPI.d.ts
CHANGED
|
@@ -26,21 +26,7 @@ declare class BiliAPI extends Service {
|
|
|
26
26
|
}): Promise<string>;
|
|
27
27
|
encrypt(text: string): string;
|
|
28
28
|
decrypt(text: string): string;
|
|
29
|
-
getTheUserWhoIsLiveStreaming(): Promise<
|
|
30
|
-
count: number;
|
|
31
|
-
group: string;
|
|
32
|
-
items: [
|
|
33
|
-
{
|
|
34
|
-
face: string;
|
|
35
|
-
is_reserve_recall: boolean;
|
|
36
|
-
jump_url: string;
|
|
37
|
-
mid: number;
|
|
38
|
-
room_id: number;
|
|
39
|
-
title: string;
|
|
40
|
-
uname: string;
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
}>;
|
|
29
|
+
getTheUserWhoIsLiveStreaming(): Promise<any>;
|
|
44
30
|
getLiveRoomInfoStreamKey(roomId: string): Promise<any>;
|
|
45
31
|
getServerUTCTime(): Promise<number>;
|
|
46
32
|
getTimeNow(): Promise<any>;
|
package/lib/biliAPI.js
CHANGED
|
@@ -120,9 +120,9 @@ class BiliAPI extends koishi_1.Service {
|
|
|
120
120
|
// BA API
|
|
121
121
|
async getTheUserWhoIsLiveStreaming() {
|
|
122
122
|
// 获取直播间信息流密钥
|
|
123
|
-
const { data
|
|
123
|
+
const { data } = await this.client.get(GET_LATEST_UPDATED_UPS);
|
|
124
124
|
// 返回data
|
|
125
|
-
return
|
|
125
|
+
return data;
|
|
126
126
|
}
|
|
127
127
|
async getLiveRoomInfoStreamKey(roomId) {
|
|
128
128
|
// 获取直播间信息流密钥
|
package/lib/blive.js
CHANGED
package/lib/comRegister.js
CHANGED
|
@@ -213,6 +213,40 @@ class ComRegister {
|
|
|
213
213
|
// 发送提示
|
|
214
214
|
await session.send("已发送消息,如未收到则说明您的机器人不支持发送私聊消息或您的信息填写有误");
|
|
215
215
|
});
|
|
216
|
+
biliCom
|
|
217
|
+
.subcommand(".ll")
|
|
218
|
+
.usage("展示当前正在直播的订阅对象")
|
|
219
|
+
.example("bili ll")
|
|
220
|
+
.action(async () => {
|
|
221
|
+
// 获取liveUsers
|
|
222
|
+
const { data: { live_users }, } = (await ctx.ba.getTheUserWhoIsLiveStreaming());
|
|
223
|
+
// 定义当前正在直播且订阅的UP主列表
|
|
224
|
+
const subLiveUsers = [];
|
|
225
|
+
// 获取当前订阅的UP主
|
|
226
|
+
for (const sub of this.subManager) {
|
|
227
|
+
// 定义开播标志位
|
|
228
|
+
let onLive = false;
|
|
229
|
+
// 遍历liveUsers
|
|
230
|
+
for (const user of live_users.items) {
|
|
231
|
+
// 判断是否是订阅直播的UP
|
|
232
|
+
if (user.mid.toString() === sub.uid && sub.live) {
|
|
233
|
+
// 设置标志位为true
|
|
234
|
+
onLive = true;
|
|
235
|
+
// break
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// 判断是否未开播
|
|
240
|
+
subLiveUsers.push({ uid: Number.parseInt(sub.uid), uname: sub.uname, onLive });
|
|
241
|
+
}
|
|
242
|
+
// 定义table字符串
|
|
243
|
+
let table = "";
|
|
244
|
+
// 遍历liveUsers
|
|
245
|
+
for (const user of subLiveUsers) {
|
|
246
|
+
table += `[UID:${user.uid}] 「${user.uname}」 ${user.onLive ? '正在直播' : '未开播'}\n`;
|
|
247
|
+
}
|
|
248
|
+
return table;
|
|
249
|
+
});
|
|
216
250
|
}
|
|
217
251
|
async init(config) {
|
|
218
252
|
// 设置logger
|
|
@@ -1372,6 +1406,7 @@ class ComRegister {
|
|
|
1372
1406
|
this.subManager.push({
|
|
1373
1407
|
id: +sub.uid,
|
|
1374
1408
|
uid: sub.uid,
|
|
1409
|
+
uname: data.name,
|
|
1375
1410
|
roomId: sub.live ? data.live_room.roomid : "",
|
|
1376
1411
|
target: sub.target,
|
|
1377
1412
|
platform: "",
|
package/lib/type/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type Target = Array<TargetItem>;
|
|
|
20
20
|
export type SubItem = {
|
|
21
21
|
id: number;
|
|
22
22
|
uid: string;
|
|
23
|
+
uname: string;
|
|
23
24
|
roomId: string;
|
|
24
25
|
target: Target;
|
|
25
26
|
platform: string;
|
|
@@ -35,3 +36,17 @@ export type MasterInfo = {
|
|
|
35
36
|
liveEndFollowerNum: number;
|
|
36
37
|
liveFollowerChange: number;
|
|
37
38
|
};
|
|
39
|
+
export type LiveUsersItem = {
|
|
40
|
+
face: string;
|
|
41
|
+
is_reserve_recall: boolean;
|
|
42
|
+
jump_url: string;
|
|
43
|
+
mid: number;
|
|
44
|
+
room_id: number;
|
|
45
|
+
title: string;
|
|
46
|
+
uname: string;
|
|
47
|
+
};
|
|
48
|
+
export type LiveUsers = {
|
|
49
|
+
count: number;
|
|
50
|
+
group: string;
|
|
51
|
+
items: Array<LiveUsersItem>;
|
|
52
|
+
};
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -59,6 +59,10 @@
|
|
|
59
59
|
|
|
60
60
|
- 使用指令 `bili list`
|
|
61
61
|
|
|
62
|
+
查看目前订阅直播的UP主们的直播情况:
|
|
63
|
+
|
|
64
|
+
- 使用指令 `bili ll`
|
|
65
|
+
|
|
62
66
|
插件的启动、停止和重启
|
|
63
67
|
|
|
64
68
|
- 使用指令 `sys`
|
|
@@ -202,6 +206,7 @@
|
|
|
202
206
|
- ver 3.0.0-alpha.20 优化:订阅配置中开关选项默认为关闭
|
|
203
207
|
- ver 3.0.0-alpha.21 优化:部分代码; 新增:更新插件后,由于机器人还未启动,已开始发送消息报错 `this._request is not a function` ,新增报错后自动重新发送消息的功能
|
|
204
208
|
- ver 3.0.0-alpha.22 优化:订阅配置展示优化
|
|
209
|
+
- ver 3.0.0-alpha.23 新增:指令 `bili ll` 可以查看当前订阅直播的UP主们的开播情况
|
|
205
210
|
|
|
206
211
|
## 交流群
|
|
207
212
|
|