koishi-plugin-bilibili-notify 3.2.5-alpha.0 → 3.2.5-alpha.10
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.mts +73 -0
- package/lib/index.d.ts +65 -62
- package/lib/index.js +95166 -395
- package/lib/index.mjs +95172 -0
- package/package.json +11 -8
- package/readme.md +19 -1
- package/lib/biliAPI.d.ts +0 -79
- package/lib/biliAPI.js +0 -811
- package/lib/blive.d.ts +0 -16
- package/lib/blive.js +0 -59
- package/lib/comRegister.d.ts +0 -106
- package/lib/comRegister.js +0 -1896
- package/lib/database.d.ts +0 -14
- package/lib/database.js +0 -14
- package/lib/font/HYZhengYuan-75W.ttf +0 -0
- package/lib/generateImg.d.ts +0 -52
- package/lib/generateImg.js +0 -1505
- package/lib/img/arrow.png +0 -0
- package/lib/type/index.d.ts +0 -262
- package/lib/type/index.js +0 -18
- package/lib/utils/index.d.ts +0 -13
- package/lib/utils/index.js +0 -102
package/lib/blive.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type Awaitable, type Context, Service } from "koishi";
|
|
2
|
-
import { type MsgHandler } from "@akokko/blive-message-listener";
|
|
3
|
-
declare module "koishi" {
|
|
4
|
-
interface Context {
|
|
5
|
-
bl: BLive;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
declare class BLive extends Service {
|
|
9
|
-
static inject: string[];
|
|
10
|
-
private listenerRecord;
|
|
11
|
-
constructor(ctx: Context);
|
|
12
|
-
protected stop(): Awaitable<void>;
|
|
13
|
-
startLiveRoomListener(roomId: string, handler: MsgHandler): Promise<void>;
|
|
14
|
-
closeListener(roomId: string): void;
|
|
15
|
-
}
|
|
16
|
-
export default BLive;
|
package/lib/blive.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const koishi_1 = require("koishi");
|
|
4
|
-
const blive_message_listener_1 = require("@akokko/blive-message-listener");
|
|
5
|
-
class BLive extends koishi_1.Service {
|
|
6
|
-
// 必要服务
|
|
7
|
-
static inject = ["ba"];
|
|
8
|
-
// 定义类属性
|
|
9
|
-
listenerRecord = {};
|
|
10
|
-
constructor(ctx) {
|
|
11
|
-
// Extends super
|
|
12
|
-
super(ctx, "bl");
|
|
13
|
-
}
|
|
14
|
-
// 注册插件dispose逻辑
|
|
15
|
-
stop() {
|
|
16
|
-
// 清除所有监听器
|
|
17
|
-
for (const key of Object.keys(this.listenerRecord)) {
|
|
18
|
-
this.closeListener(key);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async startLiveRoomListener(roomId, handler) {
|
|
22
|
-
// 获取cookieStr
|
|
23
|
-
const cookiesStr = await this.ctx.ba.getCookiesForHeader();
|
|
24
|
-
// 获取自身信息
|
|
25
|
-
const mySelfInfo = await this.ctx.ba.getMyselfInfo();
|
|
26
|
-
// 创建实例并保存到Record中
|
|
27
|
-
this.listenerRecord[roomId] = (0, blive_message_listener_1.startListen)(Number.parseInt(roomId), handler, {
|
|
28
|
-
ws: {
|
|
29
|
-
headers: {
|
|
30
|
-
Cookie: cookiesStr,
|
|
31
|
-
},
|
|
32
|
-
uid: mySelfInfo.data.mid,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
this.logger.info(`[${roomId}]直播间连接已建立!`);
|
|
36
|
-
}
|
|
37
|
-
closeListener(roomId) {
|
|
38
|
-
// 判断直播间监听器是否关闭
|
|
39
|
-
if (!this.listenerRecord ||
|
|
40
|
-
!this.listenerRecord[roomId]?.closed) {
|
|
41
|
-
// 输出logger
|
|
42
|
-
this.logger.info(`${roomId}直播间连接无需关闭`);
|
|
43
|
-
}
|
|
44
|
-
// 关闭直播间监听器
|
|
45
|
-
this.listenerRecord[roomId].close();
|
|
46
|
-
// 判断是否关闭成功
|
|
47
|
-
if (this.listenerRecord[roomId].closed) {
|
|
48
|
-
// 删除直播间监听器
|
|
49
|
-
delete this.listenerRecord[roomId];
|
|
50
|
-
// 输出logger
|
|
51
|
-
this.logger.info(`${roomId}直播间连接已关闭`);
|
|
52
|
-
// 直接返回
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
// 未关闭成功
|
|
56
|
-
this.logger.warn(`${roomId}直播间连接未成功关闭`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.default = BLive;
|
package/lib/comRegister.d.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { type Bot, type Context, type FlatPick, type Logger, Schema } from "koishi";
|
|
2
|
-
import type { Notifier } from "@koishijs/plugin-notifier";
|
|
3
|
-
import type { LoginBili } from "./database";
|
|
4
|
-
import { CronJob } from "cron";
|
|
5
|
-
import { type LiveStatus, LiveType, type MasterInfo, PushType, type Result, type SubItem, type SubManager, type Target } from "./type";
|
|
6
|
-
declare class ComRegister {
|
|
7
|
-
static inject: string[];
|
|
8
|
-
qqRelatedBotList: Array<string>;
|
|
9
|
-
logger: Logger;
|
|
10
|
-
config: ComRegister.Config;
|
|
11
|
-
loginTimer: () => void;
|
|
12
|
-
num: number;
|
|
13
|
-
rebootCount: number;
|
|
14
|
-
subNotifier: Notifier;
|
|
15
|
-
ctx: Context;
|
|
16
|
-
subManager: SubManager;
|
|
17
|
-
dynamicTimelineManager: Map<string, number>;
|
|
18
|
-
liveStatusManager: Map<string, LiveStatus>;
|
|
19
|
-
loginDBData: FlatPick<LoginBili, "dynamic_group_id">;
|
|
20
|
-
privateBot: Bot<Context>;
|
|
21
|
-
dynamicJob: CronJob;
|
|
22
|
-
liveJob: CronJob;
|
|
23
|
-
constructor(ctx: Context, config: ComRegister.Config);
|
|
24
|
-
init(config: ComRegister.Config): Promise<void>;
|
|
25
|
-
initManager(): void;
|
|
26
|
-
getBot(pf: string, selfId?: string): Bot<Context, any>;
|
|
27
|
-
sendPrivateMsg(content: string): Promise<void>;
|
|
28
|
-
sendPrivateMsgAndRebootService(): Promise<void>;
|
|
29
|
-
sendPrivateMsgAndStopService(): Promise<void>;
|
|
30
|
-
sendMessageWithRetry(bot: Bot<Context>, channelId: string, content: any): Promise<void>;
|
|
31
|
-
getGroupsThatMeetCriteria(targets: Target, type: PushType): string[];
|
|
32
|
-
broadcastToTargets(targets: Target, content: any, type: PushType): Promise<void>;
|
|
33
|
-
dynamicDetect(): (...args: any[]) => void;
|
|
34
|
-
debug_dynamicDetect(): (...args: any[]) => void;
|
|
35
|
-
useMasterInfo(uid: string, masterInfo: MasterInfo, liveType: LiveType): Promise<MasterInfo>;
|
|
36
|
-
useLiveRoomInfo(roomId: string): Promise<any>;
|
|
37
|
-
sendLiveNotifyCard(liveType: LiveType, followerDisplay: string, liveInfo: {
|
|
38
|
-
liveRoomInfo: any;
|
|
39
|
-
masterInfo: MasterInfo;
|
|
40
|
-
cardStyle: SubItem["card"];
|
|
41
|
-
}, target: Target, liveNotifyMsg: string): Promise<void>;
|
|
42
|
-
liveDetectWithListener(roomId: string, target: Target, cardStyle: SubItem["card"]): Promise<void>;
|
|
43
|
-
liveDetectWithAPI(): Promise<(...args: any[]) => void>;
|
|
44
|
-
subShow(): string;
|
|
45
|
-
updateSubNotifier(): void;
|
|
46
|
-
checkIfLoginInfoIsLoaded(): Promise<unknown>;
|
|
47
|
-
subUserInBili(mid: string): Promise<Result>;
|
|
48
|
-
loadSubFromConfig(subs: ComRegister.Config["sub"]): Promise<Result>;
|
|
49
|
-
checkIfDynamicDetectIsNeeded(): void;
|
|
50
|
-
checkIfLiveDetectIsNeeded(): void;
|
|
51
|
-
enableDynamicDetect(): void;
|
|
52
|
-
enableLiveDetect(): Promise<void>;
|
|
53
|
-
checkIfIsLogin(): Promise<boolean>;
|
|
54
|
-
}
|
|
55
|
-
declare namespace ComRegister {
|
|
56
|
-
interface Config {
|
|
57
|
-
sub: Array<{
|
|
58
|
-
uid: string;
|
|
59
|
-
dynamic: boolean;
|
|
60
|
-
live: boolean;
|
|
61
|
-
target: Array<{
|
|
62
|
-
channelArr: Array<{
|
|
63
|
-
channelId: string;
|
|
64
|
-
dynamic: boolean;
|
|
65
|
-
live: boolean;
|
|
66
|
-
liveGuardBuy: boolean;
|
|
67
|
-
atAll: boolean;
|
|
68
|
-
bot: string;
|
|
69
|
-
}>;
|
|
70
|
-
platform: string;
|
|
71
|
-
}>;
|
|
72
|
-
card: {
|
|
73
|
-
enable: boolean;
|
|
74
|
-
cardColorStart: string;
|
|
75
|
-
cardColorEnd: string;
|
|
76
|
-
cardBasePlateColor: string;
|
|
77
|
-
cardBasePlateBorder: string;
|
|
78
|
-
};
|
|
79
|
-
}>;
|
|
80
|
-
master: {
|
|
81
|
-
enable: boolean;
|
|
82
|
-
platform: string;
|
|
83
|
-
masterAccount: string;
|
|
84
|
-
masterAccountGuildId: string;
|
|
85
|
-
};
|
|
86
|
-
liveDetectType: string;
|
|
87
|
-
restartPush: boolean;
|
|
88
|
-
pushTime: number;
|
|
89
|
-
pushImgsInDynamic: boolean;
|
|
90
|
-
liveLoopTime: number;
|
|
91
|
-
customLiveStart: string;
|
|
92
|
-
customLive: string;
|
|
93
|
-
customLiveEnd: string;
|
|
94
|
-
dynamicUrl: boolean;
|
|
95
|
-
dynamicVideoUrlToBV: boolean;
|
|
96
|
-
filter: {
|
|
97
|
-
enable: boolean;
|
|
98
|
-
notify: boolean;
|
|
99
|
-
regex: string;
|
|
100
|
-
keywords: Array<string>;
|
|
101
|
-
};
|
|
102
|
-
dynamicDebugMode: boolean;
|
|
103
|
-
}
|
|
104
|
-
const Config: Schema<Config>;
|
|
105
|
-
}
|
|
106
|
-
export default ComRegister;
|