@bilibili-notify/dynamic 0.0.1-alpha.0 → 0.0.1-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/index.cjs +10 -6
- package/lib/index.d.cts +20 -2
- package/lib/index.d.mts +20 -2
- package/lib/index.mjs +10 -6
- package/package.json +4 -4
package/lib/index.cjs
CHANGED
|
@@ -471,16 +471,20 @@ var DynamicEngine = class {
|
|
|
471
471
|
text: aiComment ?? `${name}发布了一条动态${dUrl ? `:${dUrl}` : ""}`
|
|
472
472
|
}];
|
|
473
473
|
await this.push.broadcastDynamic(uid, segments, "dynamic");
|
|
474
|
-
|
|
474
|
+
const subForImgs = this.dynamicSubManager.get(uid);
|
|
475
|
+
if ((subForImgs?.imageGroupEnable ?? this.config.imageGroup.enable) && item.type === "DYNAMIC_TYPE_DRAW") {
|
|
475
476
|
const major = item.modules?.module_dynamic?.major;
|
|
476
477
|
const urls = [];
|
|
477
478
|
for (const it of major?.draw?.items ?? []) if (it.src) urls.push(it.src);
|
|
478
479
|
for (const pic of major?.opus?.pics ?? []) if (pic.url) urls.push(pic.url);
|
|
479
|
-
if (urls.length)
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
480
|
+
if (urls.length) {
|
|
481
|
+
const forward = (subForImgs?.imageGroupForward ?? this.config.imageGroup.forward) && urls.length > 1;
|
|
482
|
+
await this.push.broadcastDynamic(uid, [{
|
|
483
|
+
type: "image-group",
|
|
484
|
+
forward,
|
|
485
|
+
urls
|
|
486
|
+
}], "dynamic-images");
|
|
487
|
+
}
|
|
484
488
|
}
|
|
485
489
|
markOk(uid, postTime);
|
|
486
490
|
} catch (e) {
|
package/lib/index.d.cts
CHANGED
|
@@ -164,6 +164,16 @@ interface SubItemView {
|
|
|
164
164
|
};
|
|
165
165
|
/** Per-UP AI 覆盖;undefined 时使用 CommentaryGenerator 的全局 config。 */
|
|
166
166
|
aiOverride?: CommentaryCallOverride;
|
|
167
|
+
/**
|
|
168
|
+
* Per-UP 是否推送动态图集图片;undefined 继承 engine config `imageGroup.enable`。
|
|
169
|
+
* Adapter 折叠 `Subscription.overrides.imageGroup.enable` 后填入。
|
|
170
|
+
*/
|
|
171
|
+
imageGroupEnable?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Per-UP 图集合并转发开关;undefined 继承 engine config `imageGroup.forward`。
|
|
174
|
+
* 单图永远不走合并转发(在 engine 内已守卫)。
|
|
175
|
+
*/
|
|
176
|
+
imageGroupForward?: boolean;
|
|
167
177
|
}
|
|
168
178
|
type SubscriptionsView = Record<string, SubItemView>;
|
|
169
179
|
type SubManagerView = Map<string, SubItemView>;
|
|
@@ -202,8 +212,16 @@ interface DynamicEngineConfig {
|
|
|
202
212
|
dynamicCron: string;
|
|
203
213
|
/** 视频动态时是否将 URL 替换为 BV 号。 */
|
|
204
214
|
dynamicVideoUrlToBV: boolean;
|
|
205
|
-
/**
|
|
206
|
-
|
|
215
|
+
/**
|
|
216
|
+
* DYNAMIC_TYPE_DRAW 图集图片推送行为。enable=false 时跳过图集广播,
|
|
217
|
+
* 只发文本/卡片。forward=true 时走合并转发(聊天记录卡片,走 OneBot
|
|
218
|
+
* send_group_forward_msg,部分 OneBot 实现/NapCat 长消息通道不稳);
|
|
219
|
+
* forward=false 多图合并到一条普通 send_group_msg。单图永远不走合并转发。
|
|
220
|
+
*/
|
|
221
|
+
imageGroup: {
|
|
222
|
+
enable: boolean;
|
|
223
|
+
forward: boolean;
|
|
224
|
+
};
|
|
207
225
|
/** 内容过滤配置(含 notify:被屏蔽时是否通知)。 */
|
|
208
226
|
filter: DynamicFilterConfig & {
|
|
209
227
|
notify?: boolean;
|
package/lib/index.d.mts
CHANGED
|
@@ -164,6 +164,16 @@ interface SubItemView {
|
|
|
164
164
|
};
|
|
165
165
|
/** Per-UP AI 覆盖;undefined 时使用 CommentaryGenerator 的全局 config。 */
|
|
166
166
|
aiOverride?: CommentaryCallOverride;
|
|
167
|
+
/**
|
|
168
|
+
* Per-UP 是否推送动态图集图片;undefined 继承 engine config `imageGroup.enable`。
|
|
169
|
+
* Adapter 折叠 `Subscription.overrides.imageGroup.enable` 后填入。
|
|
170
|
+
*/
|
|
171
|
+
imageGroupEnable?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Per-UP 图集合并转发开关;undefined 继承 engine config `imageGroup.forward`。
|
|
174
|
+
* 单图永远不走合并转发(在 engine 内已守卫)。
|
|
175
|
+
*/
|
|
176
|
+
imageGroupForward?: boolean;
|
|
167
177
|
}
|
|
168
178
|
type SubscriptionsView = Record<string, SubItemView>;
|
|
169
179
|
type SubManagerView = Map<string, SubItemView>;
|
|
@@ -202,8 +212,16 @@ interface DynamicEngineConfig {
|
|
|
202
212
|
dynamicCron: string;
|
|
203
213
|
/** 视频动态时是否将 URL 替换为 BV 号。 */
|
|
204
214
|
dynamicVideoUrlToBV: boolean;
|
|
205
|
-
/**
|
|
206
|
-
|
|
215
|
+
/**
|
|
216
|
+
* DYNAMIC_TYPE_DRAW 图集图片推送行为。enable=false 时跳过图集广播,
|
|
217
|
+
* 只发文本/卡片。forward=true 时走合并转发(聊天记录卡片,走 OneBot
|
|
218
|
+
* send_group_forward_msg,部分 OneBot 实现/NapCat 长消息通道不稳);
|
|
219
|
+
* forward=false 多图合并到一条普通 send_group_msg。单图永远不走合并转发。
|
|
220
|
+
*/
|
|
221
|
+
imageGroup: {
|
|
222
|
+
enable: boolean;
|
|
223
|
+
forward: boolean;
|
|
224
|
+
};
|
|
207
225
|
/** 内容过滤配置(含 notify:被屏蔽时是否通知)。 */
|
|
208
226
|
filter: DynamicFilterConfig & {
|
|
209
227
|
notify?: boolean;
|
package/lib/index.mjs
CHANGED
|
@@ -470,16 +470,20 @@ var DynamicEngine = class {
|
|
|
470
470
|
text: aiComment ?? `${name}发布了一条动态${dUrl ? `:${dUrl}` : ""}`
|
|
471
471
|
}];
|
|
472
472
|
await this.push.broadcastDynamic(uid, segments, "dynamic");
|
|
473
|
-
|
|
473
|
+
const subForImgs = this.dynamicSubManager.get(uid);
|
|
474
|
+
if ((subForImgs?.imageGroupEnable ?? this.config.imageGroup.enable) && item.type === "DYNAMIC_TYPE_DRAW") {
|
|
474
475
|
const major = item.modules?.module_dynamic?.major;
|
|
475
476
|
const urls = [];
|
|
476
477
|
for (const it of major?.draw?.items ?? []) if (it.src) urls.push(it.src);
|
|
477
478
|
for (const pic of major?.opus?.pics ?? []) if (pic.url) urls.push(pic.url);
|
|
478
|
-
if (urls.length)
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
if (urls.length) {
|
|
480
|
+
const forward = (subForImgs?.imageGroupForward ?? this.config.imageGroup.forward) && urls.length > 1;
|
|
481
|
+
await this.push.broadcastDynamic(uid, [{
|
|
482
|
+
type: "image-group",
|
|
483
|
+
forward,
|
|
484
|
+
urls
|
|
485
|
+
}], "dynamic-images");
|
|
486
|
+
}
|
|
483
487
|
}
|
|
484
488
|
markOk(uid, postTime);
|
|
485
489
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bilibili-notify/dynamic",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/Akokk0/bilibili-notify"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"cron": "^3.1.7",
|
|
30
30
|
"luxon": "^3.5.0",
|
|
31
31
|
"@bilibili-notify/ai": "^0.0.1-alpha.0",
|
|
32
|
-
"@bilibili-notify/api": "^0.2.0-alpha.
|
|
33
|
-
"@bilibili-notify/internal": "^0.1.0-alpha.
|
|
34
|
-
"@bilibili-notify/image": "^0.0.1-alpha.
|
|
32
|
+
"@bilibili-notify/api": "^0.2.0-alpha.1",
|
|
33
|
+
"@bilibili-notify/internal": "^0.1.0-alpha.1",
|
|
34
|
+
"@bilibili-notify/image": "^0.0.1-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/luxon": "^3.4.2"
|