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/img/arrow.png
DELETED
|
Binary file
|
package/lib/type/index.d.ts
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
export declare enum LiveType {
|
|
2
|
-
NotLiveBroadcast = 0,
|
|
3
|
-
StartBroadcasting = 1,
|
|
4
|
-
LiveBroadcast = 2,
|
|
5
|
-
StopBroadcast = 3,
|
|
6
|
-
FirstLiveBroadcast = 4
|
|
7
|
-
}
|
|
8
|
-
export type Channel = {
|
|
9
|
-
channelId: string;
|
|
10
|
-
dynamic: boolean;
|
|
11
|
-
live: boolean;
|
|
12
|
-
liveGuardBuy: boolean;
|
|
13
|
-
atAll: boolean;
|
|
14
|
-
bot: string;
|
|
15
|
-
};
|
|
16
|
-
export type ChannelArr = Array<Channel>;
|
|
17
|
-
export type TargetItem = {
|
|
18
|
-
channelArr: ChannelArr;
|
|
19
|
-
platform: string;
|
|
20
|
-
};
|
|
21
|
-
export type Target = Array<TargetItem>;
|
|
22
|
-
export type SubItem = {
|
|
23
|
-
id: number;
|
|
24
|
-
uid: string;
|
|
25
|
-
uname: string;
|
|
26
|
-
roomId: string;
|
|
27
|
-
target: Target;
|
|
28
|
-
platform: string;
|
|
29
|
-
live: boolean;
|
|
30
|
-
dynamic: boolean;
|
|
31
|
-
card: {
|
|
32
|
-
enable: boolean;
|
|
33
|
-
cardColorStart: string;
|
|
34
|
-
cardColorEnd: string;
|
|
35
|
-
cardBasePlateColor: string;
|
|
36
|
-
cardBasePlateBorder: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export type SubManager = Array<SubItem>;
|
|
40
|
-
export type MasterInfo = {
|
|
41
|
-
username: string;
|
|
42
|
-
userface: string;
|
|
43
|
-
roomId: number;
|
|
44
|
-
liveOpenFollowerNum: number;
|
|
45
|
-
liveEndFollowerNum: number;
|
|
46
|
-
liveFollowerChange: number;
|
|
47
|
-
};
|
|
48
|
-
export type LiveUsersItem = {
|
|
49
|
-
face: string;
|
|
50
|
-
is_reserve_recall: boolean;
|
|
51
|
-
jump_url: string;
|
|
52
|
-
mid: number;
|
|
53
|
-
room_id: number;
|
|
54
|
-
title: string;
|
|
55
|
-
uname: string;
|
|
56
|
-
};
|
|
57
|
-
export type LiveUsers = {
|
|
58
|
-
count: number;
|
|
59
|
-
group: string;
|
|
60
|
-
items: Array<LiveUsersItem>;
|
|
61
|
-
};
|
|
62
|
-
export type RichTextNode = Array<{
|
|
63
|
-
emoji?: {
|
|
64
|
-
icon_url: string;
|
|
65
|
-
size: number;
|
|
66
|
-
text: string;
|
|
67
|
-
type: number;
|
|
68
|
-
};
|
|
69
|
-
orig_text: string;
|
|
70
|
-
text: string;
|
|
71
|
-
type: string;
|
|
72
|
-
}>;
|
|
73
|
-
export type Dynamic = {
|
|
74
|
-
basic: Object;
|
|
75
|
-
id_str: string;
|
|
76
|
-
modules: {
|
|
77
|
-
module_author: {
|
|
78
|
-
avatar: Object;
|
|
79
|
-
decorate: {
|
|
80
|
-
card_url: string;
|
|
81
|
-
fan: {
|
|
82
|
-
num_str: number;
|
|
83
|
-
color: string;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
face: string;
|
|
87
|
-
face_nft: boolean;
|
|
88
|
-
following: boolean;
|
|
89
|
-
jump_url: string;
|
|
90
|
-
label: string;
|
|
91
|
-
mid: number;
|
|
92
|
-
name: string;
|
|
93
|
-
official_verify: Object;
|
|
94
|
-
pendant: Object;
|
|
95
|
-
pub_action: string;
|
|
96
|
-
pub_action_text: string;
|
|
97
|
-
pub_location_text: string;
|
|
98
|
-
pub_time: string;
|
|
99
|
-
pub_ts: number;
|
|
100
|
-
type: string;
|
|
101
|
-
vip: {
|
|
102
|
-
type: number;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
module_dynamic: {
|
|
106
|
-
additional: any;
|
|
107
|
-
desc: {
|
|
108
|
-
rich_text_nodes: Array<{
|
|
109
|
-
orig_text: string;
|
|
110
|
-
text: string;
|
|
111
|
-
type: string;
|
|
112
|
-
emoji: {
|
|
113
|
-
icon_url: string;
|
|
114
|
-
size: number;
|
|
115
|
-
text: string;
|
|
116
|
-
type: number;
|
|
117
|
-
};
|
|
118
|
-
jump_url: string;
|
|
119
|
-
rid: string;
|
|
120
|
-
goods: {
|
|
121
|
-
jump_url: string;
|
|
122
|
-
type: number;
|
|
123
|
-
};
|
|
124
|
-
icon_name: string;
|
|
125
|
-
}>;
|
|
126
|
-
text: string;
|
|
127
|
-
};
|
|
128
|
-
major: {
|
|
129
|
-
opus: {
|
|
130
|
-
fold_action: Array<string>;
|
|
131
|
-
jump_url: string;
|
|
132
|
-
pics: Array<{
|
|
133
|
-
height: number;
|
|
134
|
-
live_url: string;
|
|
135
|
-
size: number;
|
|
136
|
-
url: string;
|
|
137
|
-
width: number;
|
|
138
|
-
}>;
|
|
139
|
-
summary: {
|
|
140
|
-
rich_text_nodes: RichTextNode;
|
|
141
|
-
text: string;
|
|
142
|
-
};
|
|
143
|
-
title: string;
|
|
144
|
-
};
|
|
145
|
-
archive: {
|
|
146
|
-
jump_url: string;
|
|
147
|
-
badge: {
|
|
148
|
-
text: string;
|
|
149
|
-
};
|
|
150
|
-
cover: string;
|
|
151
|
-
duration_text: string;
|
|
152
|
-
title: string;
|
|
153
|
-
desc: string;
|
|
154
|
-
stat: {
|
|
155
|
-
play: number;
|
|
156
|
-
danmaku: number;
|
|
157
|
-
};
|
|
158
|
-
bvid: string;
|
|
159
|
-
};
|
|
160
|
-
draw: any;
|
|
161
|
-
type: string;
|
|
162
|
-
};
|
|
163
|
-
topic: any;
|
|
164
|
-
};
|
|
165
|
-
module_stat: {
|
|
166
|
-
comment: {
|
|
167
|
-
count: number;
|
|
168
|
-
};
|
|
169
|
-
forward: {
|
|
170
|
-
count: number;
|
|
171
|
-
};
|
|
172
|
-
like: {
|
|
173
|
-
count: number;
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
orig?: Dynamic;
|
|
178
|
-
type: string;
|
|
179
|
-
visible: boolean;
|
|
180
|
-
};
|
|
181
|
-
export type Live = {
|
|
182
|
-
code: number;
|
|
183
|
-
message: string;
|
|
184
|
-
msg: string;
|
|
185
|
-
data: {
|
|
186
|
-
[key: string]: {
|
|
187
|
-
title: string;
|
|
188
|
-
room_id: number;
|
|
189
|
-
uid: number;
|
|
190
|
-
online: number;
|
|
191
|
-
live_time: number;
|
|
192
|
-
live_status: number;
|
|
193
|
-
short_id: number;
|
|
194
|
-
area: number;
|
|
195
|
-
area_name: string;
|
|
196
|
-
area_v2_id: number;
|
|
197
|
-
area_v2_name: string;
|
|
198
|
-
area_v2_parent_name: string;
|
|
199
|
-
area_v2_parent_id: number;
|
|
200
|
-
uname: string;
|
|
201
|
-
face: string;
|
|
202
|
-
tag_name: string;
|
|
203
|
-
tags: string;
|
|
204
|
-
cover_from_user: string;
|
|
205
|
-
keyframe: string;
|
|
206
|
-
lock_till: string;
|
|
207
|
-
hidden_till: string;
|
|
208
|
-
broadcast_type: number;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
export type LiveStatus = {
|
|
213
|
-
live: boolean;
|
|
214
|
-
roomId: string;
|
|
215
|
-
liveRoomInfo: any;
|
|
216
|
-
masterInfo: MasterInfo;
|
|
217
|
-
watchedNum: string;
|
|
218
|
-
liveStartTimeInit: boolean;
|
|
219
|
-
liveStartTime: string;
|
|
220
|
-
push: number;
|
|
221
|
-
};
|
|
222
|
-
export type AllDynamicInfo = {
|
|
223
|
-
code: number;
|
|
224
|
-
message: string;
|
|
225
|
-
data: {
|
|
226
|
-
has_more: boolean;
|
|
227
|
-
items: Array<Dynamic>;
|
|
228
|
-
offset: string;
|
|
229
|
-
update_baseline: string;
|
|
230
|
-
update_num: number;
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
export declare enum PushType {
|
|
234
|
-
Live = 0,
|
|
235
|
-
Dynamic = 1,
|
|
236
|
-
StartBroadcasting = 2,
|
|
237
|
-
LiveGuardBuy = 3
|
|
238
|
-
}
|
|
239
|
-
export type Result = {
|
|
240
|
-
code: number;
|
|
241
|
-
msg?: string;
|
|
242
|
-
data?: any;
|
|
243
|
-
};
|
|
244
|
-
export type CreateGroup = {
|
|
245
|
-
code: number;
|
|
246
|
-
message: string;
|
|
247
|
-
ttl: number;
|
|
248
|
-
data: {
|
|
249
|
-
tagid: number;
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
export type GroupList = {
|
|
253
|
-
code: number;
|
|
254
|
-
message: string;
|
|
255
|
-
ttl: number;
|
|
256
|
-
data: Array<{
|
|
257
|
-
tagid: number;
|
|
258
|
-
name: string;
|
|
259
|
-
count: number;
|
|
260
|
-
tip: string;
|
|
261
|
-
}>;
|
|
262
|
-
};
|
package/lib/type/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PushType = exports.LiveType = void 0;
|
|
4
|
-
var LiveType;
|
|
5
|
-
(function (LiveType) {
|
|
6
|
-
LiveType[LiveType["NotLiveBroadcast"] = 0] = "NotLiveBroadcast";
|
|
7
|
-
LiveType[LiveType["StartBroadcasting"] = 1] = "StartBroadcasting";
|
|
8
|
-
LiveType[LiveType["LiveBroadcast"] = 2] = "LiveBroadcast";
|
|
9
|
-
LiveType[LiveType["StopBroadcast"] = 3] = "StopBroadcast";
|
|
10
|
-
LiveType[LiveType["FirstLiveBroadcast"] = 4] = "FirstLiveBroadcast";
|
|
11
|
-
})(LiveType || (exports.LiveType = LiveType = {}));
|
|
12
|
-
var PushType;
|
|
13
|
-
(function (PushType) {
|
|
14
|
-
PushType[PushType["Live"] = 0] = "Live";
|
|
15
|
-
PushType[PushType["Dynamic"] = 1] = "Dynamic";
|
|
16
|
-
PushType[PushType["StartBroadcasting"] = 2] = "StartBroadcasting";
|
|
17
|
-
PushType[PushType["LiveGuardBuy"] = 3] = "LiveGuardBuy";
|
|
18
|
-
})(PushType || (exports.PushType = PushType = {}));
|
package/lib/utils/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface RetryOptions {
|
|
2
|
-
attempts: number;
|
|
3
|
-
onFailure?: (error: Error, attempts: number) => Promise<void> | void;
|
|
4
|
-
}
|
|
5
|
-
export declare function Retry(options?: RetryOptions): MethodDecorator;
|
|
6
|
-
/**
|
|
7
|
-
* 高阶函数:为函数添加锁机制
|
|
8
|
-
* @param {Function} fn - 需要包装的原始函数
|
|
9
|
-
* @returns {Function} 带锁功能的函数
|
|
10
|
-
*/
|
|
11
|
-
export declare function withLock(fn: any): (...args: any[]) => void;
|
|
12
|
-
export declare function withRetry<T>(fn: (...args: unknown[]) => T | Promise<T>, maxAttempts?: number, delayMs?: number): Promise<T>;
|
|
13
|
-
export {};
|
package/lib/utils/index.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Retry = Retry;
|
|
4
|
-
exports.withLock = withLock;
|
|
5
|
-
exports.withRetry = withRetry;
|
|
6
|
-
function Retry(options = { attempts: 3 }) {
|
|
7
|
-
return (
|
|
8
|
-
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
9
|
-
target, propertyKey,
|
|
10
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
11
|
-
descriptor) => {
|
|
12
|
-
const originalMethod = descriptor.value;
|
|
13
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
14
|
-
descriptor.value = async function (...args) {
|
|
15
|
-
let lastError;
|
|
16
|
-
for (let i = 0; i < options.attempts; i++) {
|
|
17
|
-
try {
|
|
18
|
-
return await originalMethod.apply(this, args);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
lastError = error;
|
|
22
|
-
if (options.onFailure) {
|
|
23
|
-
await options.onFailure.call(this, lastError, i + 1);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
28
|
-
throw lastError;
|
|
29
|
-
};
|
|
30
|
-
return descriptor;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* 高阶函数:为函数添加锁机制
|
|
35
|
-
* @param {Function} fn - 需要包装的原始函数
|
|
36
|
-
* @returns {Function} 带锁功能的函数
|
|
37
|
-
*/
|
|
38
|
-
function withLock(fn) {
|
|
39
|
-
// 判断是否是异步函数
|
|
40
|
-
const isAsync = fn.constructor.name === "AsyncFunction";
|
|
41
|
-
// 定义锁标志
|
|
42
|
-
let locked = false;
|
|
43
|
-
// 判断是否为异步函数
|
|
44
|
-
if (isAsync) {
|
|
45
|
-
// 变为Promise
|
|
46
|
-
return (...args) => {
|
|
47
|
-
// 已加锁则跳过执行
|
|
48
|
-
if (locked)
|
|
49
|
-
return;
|
|
50
|
-
// 获取锁
|
|
51
|
-
locked = true;
|
|
52
|
-
// 将异步函数转为Promise链
|
|
53
|
-
Promise.resolve(fn(...args))
|
|
54
|
-
.catch((err) => {
|
|
55
|
-
// 打印错误
|
|
56
|
-
console.error("Execution error:", err);
|
|
57
|
-
// 重新抛出错误
|
|
58
|
-
throw err;
|
|
59
|
-
})
|
|
60
|
-
.finally(() => {
|
|
61
|
-
// 确保释放锁
|
|
62
|
-
locked = false;
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
// 不是异步函数
|
|
67
|
-
return (...args) => {
|
|
68
|
-
// 已加锁则跳过执行
|
|
69
|
-
if (locked)
|
|
70
|
-
return;
|
|
71
|
-
// 获取锁
|
|
72
|
-
locked = true;
|
|
73
|
-
try {
|
|
74
|
-
// 执行函数
|
|
75
|
-
fn(...args);
|
|
76
|
-
}
|
|
77
|
-
catch (err) {
|
|
78
|
-
// 打印错误
|
|
79
|
-
console.error("Execution error:", err);
|
|
80
|
-
// 重新抛出错误
|
|
81
|
-
throw err;
|
|
82
|
-
}
|
|
83
|
-
finally {
|
|
84
|
-
// 无论成功失败都释放锁
|
|
85
|
-
locked = false;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
async function withRetry(fn, maxAttempts = 3, delayMs = 1000) {
|
|
90
|
-
let attempt = 0;
|
|
91
|
-
while (attempt < maxAttempts) {
|
|
92
|
-
try {
|
|
93
|
-
return await fn();
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
attempt++;
|
|
97
|
-
if (attempt >= maxAttempts)
|
|
98
|
-
throw error;
|
|
99
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs * attempt)); // 指数退避
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|