yz-yuki-plugin 2.0.7-8 → 2.0.8-0
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/CHANGELOG.md +10 -1
- package/README.md +28 -27
- package/defaultConfig/bilibili/config.yaml +8 -3
- package/defaultConfig/weibo/config.yaml +8 -3
- package/lib/apps/bilibili.js +61 -29
- package/lib/apps/weibo.js +42 -14
- package/lib/components/dynamic/Content.js +2 -2
- package/lib/components/dynamic/Footer.js +2 -2
- package/lib/components/help/Help.js +2 -2
- package/lib/components/version/Version.js +2 -2
- package/lib/models/bilibili/bilibili.main.models.js +3 -0
- package/lib/models/bilibili/bilibili.main.query.js +154 -92
- package/lib/models/bilibili/bilibili.main.task.js +153 -73
- package/lib/models/weibo/weibo.main.query.js +84 -37
- package/lib/models/weibo/weibo.main.task.js +135 -56
- package/package.json +6 -6
- package/resources/css/dynamic/Content.css +108 -0
- package/resources/img/icon/dynamic/bili-dyn-card-vote__cover.svg +1 -0
- package/resources/img/icon/dynamic/bili-rich-text-link-video.svg +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
# 2.0.8
|
|
2
|
+
* 合并分支dev与dev3,减少维护成本
|
|
3
|
+
|
|
1
4
|
# 2.0.7
|
|
5
|
+
* 新增动态内容过多时转发发送功能,默认开启
|
|
6
|
+
* 优化动态检查日志
|
|
7
|
+
* 优化文字动态内容及排版,修复微博视频图片混合的动态显示缺失问题
|
|
8
|
+
* 优化获取B站文章动态内容
|
|
9
|
+
* 优化订阅数据展示
|
|
10
|
+
* 修复同一up订阅多个群聊订阅,推送类型合并的问题
|
|
2
11
|
* 添加白名单关键词过滤功能
|
|
3
12
|
* 新增B站视频解析
|
|
4
13
|
|
|
@@ -21,7 +30,7 @@
|
|
|
21
30
|
# 2.0.4
|
|
22
31
|
* 增加splitHeight配置项,其他优化
|
|
23
32
|
* 优化B站风控相关,新增bili_tiket参数
|
|
24
|
-
* fix Repeated Instantiation
|
|
33
|
+
* fix Repeated Instantiation puppeteer
|
|
25
34
|
* 优化获取B站登录ck
|
|
26
35
|
* 添加截图列队,优化配置文件注释
|
|
27
36
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# YUKI-PLUGIN
|
|
4
4
|
|
|
5
|
-
- 一个适用于 `Yunzai 系列机器人框架` 的B
|
|
5
|
+
- 一个适用于 `Yunzai 系列机器人框架` 的B站动态、微博动态订阅推送和B站视频链接解析的插件
|
|
6
6
|
|
|
7
7
|
- 支持 群聊/私聊 订阅B站动态和微博动态,支持定时推送,支持手动触发推送,支持简单查询B站/微博用户信息。
|
|
8
8
|
|
|
@@ -36,7 +36,27 @@ chromium-browser --version
|
|
|
36
36
|
## 选择安装方式
|
|
37
37
|
按照网络情况以及使用的bot框架是`Yunzaijs`还是`Yunzai-V3`,选择对应的安装方式。
|
|
38
38
|
|
|
39
|
-
### ***(一)
|
|
39
|
+
### ***(一)Yunzai-V3***
|
|
40
|
+
|
|
41
|
+
> 仅支持Yunzai-V3(TRSS/Miao)的分支,选择仓库,安装到 `yunzai/plugins`:
|
|
42
|
+
|
|
43
|
+
gitee仓库:
|
|
44
|
+
```
|
|
45
|
+
git clone --branch main3 https://gitee.com/snowtafir/yuki-plugin.git ./plugins/yuki-plugin
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
github仓库:
|
|
49
|
+
```
|
|
50
|
+
git clone --branch main3 https://github.com/snowtafir/yuki-plugin.git ./plugins/yuki-plugin
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
* 安装依赖
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
pnpm install --filter=yuki-plugin
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### ***(二)YunzaiJS***
|
|
40
60
|
> 选择其中一种方式安装插件:
|
|
41
61
|
|
|
42
62
|
1. npm包安装到`yunzaijs/node_modules`的方式,仅YunzaiJS支持:
|
|
@@ -73,12 +93,12 @@ export default defineConfig({
|
|
|
73
93
|
|
|
74
94
|
gitee仓库:
|
|
75
95
|
```shell
|
|
76
|
-
git clone --branch
|
|
96
|
+
git clone --branch main3 https://gitee.com/snowtafir/yuki-plugin.git ./plugins/yuki-plugin
|
|
77
97
|
```
|
|
78
98
|
|
|
79
99
|
github仓库:
|
|
80
100
|
```shell
|
|
81
|
-
git clone --branch
|
|
101
|
+
git clone --branch main3 https://github.com/snowtafir/yuki-plugin.git ./plugins/yuki-plugin
|
|
82
102
|
```
|
|
83
103
|
|
|
84
104
|
* 依赖安装:
|
|
@@ -86,26 +106,6 @@ git clone --branch main https://github.com/snowtafir/yuki-plugin.git ./plugins/y
|
|
|
86
106
|
yarn install
|
|
87
107
|
```
|
|
88
108
|
|
|
89
|
-
### ***(二)Yunzai-V3***
|
|
90
|
-
|
|
91
|
-
> 仅支持Yunzai-V3(TRSS/Miao)的分支,选择仓库,安装到 `yunzai/plugins`:
|
|
92
|
-
|
|
93
|
-
gitee仓库:
|
|
94
|
-
```
|
|
95
|
-
git clone --branch main3 https://gitee.com/snowtafir/yuki-plugin.git ./plugins/yuki-plugin
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
github仓库:
|
|
99
|
-
```
|
|
100
|
-
git clone --branch main3 https://github.com/snowtafir/yuki-plugin.git ./plugins/yuki-plugin
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
* 安装依赖
|
|
104
|
-
|
|
105
|
-
```shell
|
|
106
|
-
pnpm install --filter=yuki-plugin
|
|
107
|
-
```
|
|
108
|
-
|
|
109
109
|
# 📦二、插件配置
|
|
110
110
|
|
|
111
111
|
> [!IMPORTANT]
|
|
@@ -218,13 +218,13 @@ https://m.weibo.cn/u/7643376782 # 7643376782 为崩坏星穹铁道博主uid
|
|
|
218
218
|
<details><summary>参与开发,点击展开</summary>
|
|
219
219
|
|
|
220
220
|
> [!TIP]
|
|
221
|
-
> *
|
|
222
|
-
> * 提交PR后由管理员审核,审核成功并合并后会自动进行github actions编译,最终提交编译好的代码到
|
|
221
|
+
> * main3分支为编译分支,请勿直接在该分支上进行开发,请使用dev3、npm分支进行同步开发,并提交Pull requests。
|
|
222
|
+
> * 提交PR后由管理员审核,审核成功并合并后会自动进行github actions编译,最终提交编译好的代码到main3分支以及发布到npm。
|
|
223
223
|
> * 根据喜好,可使用 [vscode编辑器](https://code.visualstudio.com/) 或其他 IDE 辅助开发
|
|
224
224
|
|
|
225
225
|
1. Fork 项目到自己的仓库。
|
|
226
226
|
2. clone Fork 后的项目到本地。
|
|
227
|
-
3. 进入clone后的项目目录,打开终端或 git bash 执行 `git checkout xxx` 切换到xxx分支(请依次切换到dev3、
|
|
227
|
+
3. 进入clone后的项目目录,打开终端或 git bash 执行 `git checkout xxx` 切换到xxx分支(请依次切换到dev3、npm分支进行同步开发)。
|
|
228
228
|
4. 准备环境:
|
|
229
229
|
```sh
|
|
230
230
|
npm config set registry https://registry.npmmirror.com
|
|
@@ -255,3 +255,4 @@ yarn install
|
|
|
255
255
|
| [TRSS-Yunzai](https://gitee.com/TimeRainStarSky/Yunzai) | 时雨🌌星空的 TRSS-Yunzai |
|
|
256
256
|
| [Miao-Yunzai](https://gitee.com/yoimiya-kokomi/Miao-Yunzai) | 喵喵的 Miao-Yunzai |
|
|
257
257
|
| [Yunzai-Bot](https://gitee.com/Le-niao/Yunzai-Bot) | 乐神的 Yunzai-Bot |
|
|
258
|
+
|[jsxp](https://github.com/lemonade-lab/lvyjs/tree/main/packages/jsxp) | 一个可以在 tsx 环境中,使用 puppeteer 对 tsx 组件进行截图的库 |
|
|
@@ -32,13 +32,13 @@ getDataRandomDelay: 8000
|
|
|
32
32
|
pushTransmit: 1
|
|
33
33
|
|
|
34
34
|
# 推送文字和图文动态时,限制发送多少张图片
|
|
35
|
-
pushPicCountLimit:
|
|
35
|
+
pushPicCountLimit: 9
|
|
36
36
|
|
|
37
37
|
# 推送文字和图文动态时,限制字数是多少
|
|
38
|
-
pushContentLenLimit:
|
|
38
|
+
pushContentLenLimit: 1000
|
|
39
39
|
|
|
40
40
|
# 推送文字和图文动态时,限制多少行文本
|
|
41
|
-
pushContentLineLimit:
|
|
41
|
+
pushContentLineLimit: 100
|
|
42
42
|
|
|
43
43
|
# 是否展示定时任务的日志,0 不显示 1 显示
|
|
44
44
|
pushTaskLog: 1
|
|
@@ -60,6 +60,11 @@ banWords:
|
|
|
60
60
|
# 设置B站动态消息模式 0 文字模式 1 图片模式
|
|
61
61
|
pushMsgMode: 1
|
|
62
62
|
|
|
63
|
+
# 动态过长或条图片数过多时是否以转发形式发送动态,默认 1 开启,0 关闭。
|
|
64
|
+
forwardSendDynamic: 1
|
|
65
|
+
maxPicsForSingleMsg: 2 # 阈值>2张图片时
|
|
66
|
+
maxTextLengthForSingleMsg: 300 # 或阈值>300字时
|
|
67
|
+
|
|
63
68
|
# 文字模式时,文字消息与图片附件是否合并在一起发送,默认 1 合并,0 不合并。
|
|
64
69
|
# 如果合并时图片过多导致发送失败,可设置为 0 单独发送图片。
|
|
65
70
|
mergeTextPic: 1
|
|
@@ -27,13 +27,13 @@ dynamicTimeRange: 7200
|
|
|
27
27
|
pushTransmit: 1
|
|
28
28
|
|
|
29
29
|
# 推送动态时,限制发送多少张图片
|
|
30
|
-
pushPicCountLimit:
|
|
30
|
+
pushPicCountLimit: 9
|
|
31
31
|
|
|
32
32
|
# 推送文字和图文动态时,限制字数是多少
|
|
33
|
-
pushContentLenLimit:
|
|
33
|
+
pushContentLenLimit: 1000
|
|
34
34
|
|
|
35
35
|
# 推送文字和图文动态时,限制多少行文本
|
|
36
|
-
pushContentLineLimit:
|
|
36
|
+
pushContentLineLimit: 100
|
|
37
37
|
|
|
38
38
|
# 是否展示定时任务的日志,0 不显示 1 显示
|
|
39
39
|
pushTaskLog: 1
|
|
@@ -55,6 +55,11 @@ banWords:
|
|
|
55
55
|
# 设置微博动态消息模式 0 文字模式 1 图片模式
|
|
56
56
|
pushMsgMode: 1
|
|
57
57
|
|
|
58
|
+
# 动态过长或条图片数过多时是否以转发形式发送动态,默认 1 开启,0 关闭。
|
|
59
|
+
forwardSendDynamic: 1
|
|
60
|
+
maxPicsForSingleMsg: 2 # 阈值>2张图片时
|
|
61
|
+
maxTextLengthForSingleMsg: 300 # 或阈值>300字时
|
|
62
|
+
|
|
58
63
|
# 文字模式时,文字消息与图片附件是否合并在一起发送,默认 1 合并,0 不合并。
|
|
59
64
|
# 如果合并时图片过多导致发送失败,可设置为 0 单独发送图片。
|
|
60
65
|
mergeTextPic: 1
|
package/lib/apps/bilibili.js
CHANGED
|
@@ -358,6 +358,17 @@ message.use(async (e) => {
|
|
|
358
358
|
}
|
|
359
359
|
else {
|
|
360
360
|
let subData = Config.getConfigData('config', 'bilibili', 'push') || { group: {}, private: {} };
|
|
361
|
+
// 如果聊天ID没有订阅数据,则删除该聊天ID
|
|
362
|
+
for (let chatType in subData) {
|
|
363
|
+
if (subData.hasOwnProperty(chatType)) {
|
|
364
|
+
subData[chatType] = Object.keys(subData[chatType]).reduce((nonEmptyData, chatId) => {
|
|
365
|
+
if (subData[chatType][chatId].length > 0) {
|
|
366
|
+
nonEmptyData[chatId] = subData[chatType][chatId];
|
|
367
|
+
}
|
|
368
|
+
return nonEmptyData;
|
|
369
|
+
}, {});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
361
372
|
const messages = [];
|
|
362
373
|
const typeMap = {
|
|
363
374
|
DYNAMIC_TYPE_AV: '视频',
|
|
@@ -369,46 +380,67 @@ message.use(async (e) => {
|
|
|
369
380
|
};
|
|
370
381
|
// 处理群组订阅
|
|
371
382
|
if (subData.group && Object.keys(subData.group).length > 0) {
|
|
372
|
-
messages.push('
|
|
383
|
+
messages.push('\n>>>>>>群组B站订阅<<<<<<');
|
|
373
384
|
Object.keys(subData.group).forEach(groupId => {
|
|
374
|
-
messages.push(
|
|
375
|
-
subData.group
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
item.type.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
messages.push(`\n<群组${groupId}>:`);
|
|
386
|
+
if (subData.group) {
|
|
387
|
+
subData.group[groupId].forEach((item) => {
|
|
388
|
+
const types = new Set();
|
|
389
|
+
if (item.type && item.type.length) {
|
|
390
|
+
item.type.forEach((typeItem) => {
|
|
391
|
+
if (typeMap[typeItem]) {
|
|
392
|
+
types.add(typeMap[typeItem]);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
messages.push(`${item.uid}:${item.name} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
386
399
|
});
|
|
387
400
|
}
|
|
401
|
+
else {
|
|
402
|
+
messages.push('\n>>>>>>群组B站订阅<<<<<<\n当前没有任何群组订阅数据~');
|
|
403
|
+
}
|
|
388
404
|
// 处理私聊订阅
|
|
389
405
|
if (subData.private && Object.keys(subData.private).length > 0) {
|
|
390
|
-
messages.push('\n
|
|
406
|
+
messages.push('\n>>>>>>私聊B站订阅<<<<<<');
|
|
391
407
|
Object.keys(subData.private).forEach(userId => {
|
|
392
|
-
messages.push(
|
|
393
|
-
subData.private
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
item.type.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
408
|
+
messages.push(`\n<用户${userId}>:`);
|
|
409
|
+
if (subData.private) {
|
|
410
|
+
subData.private[userId].forEach((item) => {
|
|
411
|
+
const types = new Set();
|
|
412
|
+
if (item.type && item.type.length) {
|
|
413
|
+
item.type.forEach((typeItem) => {
|
|
414
|
+
if (typeMap[typeItem]) {
|
|
415
|
+
types.add(typeMap[typeItem]);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
messages.push(`${item.uid}:${item.name} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
404
422
|
});
|
|
405
423
|
}
|
|
424
|
+
else {
|
|
425
|
+
messages.push('\n>>>>>>私聊B站订阅<<<<<<\n当前没有任何私聊订阅数据~');
|
|
426
|
+
}
|
|
406
427
|
e.reply(`推送列表如下:\n${messages.join('\n')}`);
|
|
407
428
|
}
|
|
408
429
|
}, [/^(#|\/)(yuki|优纪)?(b站|B站|bili|bilibili|哔哩|哔哩哔哩)全部(推送|动态|订阅)列表$/]);
|
|
409
430
|
/** 单独群聊或私聊的订阅的b站推送列表 */
|
|
410
431
|
message.use(async (e) => {
|
|
411
432
|
let subData = Config.getConfigData('config', 'bilibili', 'push') || { group: {}, private: {} };
|
|
433
|
+
// 如果聊天ID没有订阅数据,则删除该聊天ID
|
|
434
|
+
for (let chatType in subData) {
|
|
435
|
+
if (subData.hasOwnProperty(chatType)) {
|
|
436
|
+
subData[chatType] = Object.keys(subData[chatType]).reduce((nonEmptyData, chatId) => {
|
|
437
|
+
if (subData[chatType][chatId].length > 0) {
|
|
438
|
+
nonEmptyData[chatId] = subData[chatType][chatId];
|
|
439
|
+
}
|
|
440
|
+
return nonEmptyData;
|
|
441
|
+
}, {});
|
|
442
|
+
}
|
|
443
|
+
}
|
|
412
444
|
const messages = [];
|
|
413
445
|
const typeMap = {
|
|
414
446
|
DYNAMIC_TYPE_AV: '视频',
|
|
@@ -433,7 +465,7 @@ message.use(async (e) => {
|
|
|
433
465
|
}
|
|
434
466
|
});
|
|
435
467
|
}
|
|
436
|
-
messages.push(`${item.
|
|
468
|
+
messages.push(`${item.uid}:${item.name} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
437
469
|
});
|
|
438
470
|
e.reply(`推送列表如下:\n${messages.join('\n')}`);
|
|
439
471
|
}, [/^(#|\/)(yuki|优纪)?(b站|B站|bili|bilibili|哔哩|哔哩哔哩)(推送|动态|订阅)列表$/]);
|
|
@@ -458,9 +490,9 @@ message.use(async (e) => {
|
|
|
458
490
|
e.reply('用户不存在,输入的uid无效。');
|
|
459
491
|
return;
|
|
460
492
|
}
|
|
461
|
-
const message = [
|
|
493
|
+
const message = [`--------------------`, `\n昵称:${data?.name}`, `\n性别:${data?.sex}`, `\n等级:${data?.level}`, `\n--------------------`];
|
|
462
494
|
if (data.live_room) {
|
|
463
|
-
message.push(`\n
|
|
495
|
+
message.push(`\n>>>>>直播间信息<<<<<`, `\n标题:${data?.live_room?.title}`, `\n房间:${data?.live_room?.roomid}`, `\n状态:${data?.live_room?.liveStatus ? '直播中' : '未开播'}`, `\n观看人数:${data?.live_room?.watched_show?.num}`);
|
|
464
496
|
e.reply(`直播链接:${data?.live_room?.url}`);
|
|
465
497
|
}
|
|
466
498
|
e.reply(message);
|
package/lib/apps/weibo.js
CHANGED
|
@@ -86,16 +86,16 @@ message.use(async (e) => {
|
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
// 获取或初始化微博推送数据
|
|
89
|
-
let
|
|
89
|
+
let subData = weiboPushData || { group: {}, private: {} };
|
|
90
90
|
// 根据聊天类型初始化数据
|
|
91
91
|
let chatType = e.isGroup ? 'group' : 'private';
|
|
92
92
|
let chatId = e.isGroup ? e.group_id : e.user_id;
|
|
93
93
|
// 初始化群组或私聊数据
|
|
94
|
-
if (!
|
|
95
|
-
|
|
94
|
+
if (!subData[chatType][chatId]) {
|
|
95
|
+
subData[chatType][chatId] = [];
|
|
96
96
|
}
|
|
97
97
|
// 查找指定UID的订阅数据
|
|
98
|
-
const upData =
|
|
98
|
+
const upData = subData[chatType][chatId].find((item) => item.uid == uid);
|
|
99
99
|
if (!upData) {
|
|
100
100
|
e.reply(`订阅列表中没有找到该UID~\n${uid}可能是无效的`);
|
|
101
101
|
return;
|
|
@@ -105,7 +105,7 @@ message.use(async (e) => {
|
|
|
105
105
|
let isDel = false;
|
|
106
106
|
if (newType.length) {
|
|
107
107
|
// 更新订阅类型
|
|
108
|
-
|
|
108
|
+
subData[chatType][chatId] = subData[chatType][chatId].map(item => {
|
|
109
109
|
if (item.uid == uid) {
|
|
110
110
|
item.type = newType;
|
|
111
111
|
}
|
|
@@ -115,11 +115,11 @@ message.use(async (e) => {
|
|
|
115
115
|
else {
|
|
116
116
|
// 删除订阅
|
|
117
117
|
isDel = true;
|
|
118
|
-
|
|
118
|
+
subData[chatType][chatId] = subData[chatType][chatId].filter((item) => item.uid !== uid);
|
|
119
119
|
}
|
|
120
120
|
// 保存更新后的数据
|
|
121
121
|
//weiboPushData = data;
|
|
122
|
-
Config.saveConfig('config', 'weibo', 'push',
|
|
122
|
+
Config.saveConfig('config', 'weibo', 'push', subData);
|
|
123
123
|
// 回复用户操作结果
|
|
124
124
|
e.reply(`${isDel ? '删除' : '修改'}微博推送成功~\n${uid}`);
|
|
125
125
|
}
|
|
@@ -131,6 +131,17 @@ message.use(async (e) => {
|
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
133
|
let subData = weiboPushData || { group: {}, private: {} };
|
|
134
|
+
// 如果聊天ID没有订阅数据,则删除该聊天ID
|
|
135
|
+
for (let chatType in subData) {
|
|
136
|
+
if (subData.hasOwnProperty(chatType)) {
|
|
137
|
+
subData[chatType] = Object.keys(subData[chatType]).reduce((nonEmptyData, chatId) => {
|
|
138
|
+
if (subData[chatType][chatId].length > 0) {
|
|
139
|
+
nonEmptyData[chatId] = subData[chatType][chatId];
|
|
140
|
+
}
|
|
141
|
+
return nonEmptyData;
|
|
142
|
+
}, {});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
134
145
|
const messages = [];
|
|
135
146
|
const typeMap = {
|
|
136
147
|
DYNAMIC_TYPE_AV: '视频',
|
|
@@ -141,9 +152,9 @@ message.use(async (e) => {
|
|
|
141
152
|
};
|
|
142
153
|
// 处理群组订阅
|
|
143
154
|
if (subData.group && Object.keys(subData.group).length > 0) {
|
|
144
|
-
messages.push('
|
|
155
|
+
messages.push('\n>>>>>>群组微博订阅<<<<<<');
|
|
145
156
|
Object.keys(subData.group).forEach(groupId => {
|
|
146
|
-
messages.push(
|
|
157
|
+
messages.push(`\n<群组${groupId}>:`);
|
|
147
158
|
subData.group[groupId].forEach((item) => {
|
|
148
159
|
const types = new Set();
|
|
149
160
|
if (item.type && item.type.length) {
|
|
@@ -153,15 +164,18 @@ message.use(async (e) => {
|
|
|
153
164
|
}
|
|
154
165
|
});
|
|
155
166
|
}
|
|
156
|
-
messages.push(`${item.
|
|
167
|
+
messages.push(`${item.uid}:${item.name} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
157
168
|
});
|
|
158
169
|
});
|
|
159
170
|
}
|
|
171
|
+
else {
|
|
172
|
+
messages.push('\n>>>>>>群组微博订阅<<<<<<\n当前没有任何群组订阅数据~');
|
|
173
|
+
}
|
|
160
174
|
// 处理私聊订阅
|
|
161
175
|
if (subData.private && Object.keys(subData.private).length > 0) {
|
|
162
|
-
messages.push('
|
|
176
|
+
messages.push('\n>>>>>>私聊微博订阅<<<<<<');
|
|
163
177
|
Object.keys(subData.private).forEach(userId => {
|
|
164
|
-
messages.push(
|
|
178
|
+
messages.push(`\n<用户${userId}>:`);
|
|
165
179
|
subData.private[userId].forEach((item) => {
|
|
166
180
|
const types = new Set();
|
|
167
181
|
if (item.type && item.type.length) {
|
|
@@ -171,16 +185,30 @@ message.use(async (e) => {
|
|
|
171
185
|
}
|
|
172
186
|
});
|
|
173
187
|
}
|
|
174
|
-
messages.push(`${item.
|
|
188
|
+
messages.push(`${item.uid}:${item.name} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
175
189
|
});
|
|
176
190
|
});
|
|
177
191
|
}
|
|
192
|
+
else {
|
|
193
|
+
messages.push('\n>>>>>>私聊微博订阅<<<<<<\n当前没有任何私聊订阅数据~');
|
|
194
|
+
}
|
|
178
195
|
e.reply(`推送列表如下:\n${messages.join('\n')}`);
|
|
179
196
|
}
|
|
180
197
|
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)全部(推送|动态|订阅)列表$/]);
|
|
181
198
|
/** 单独群聊或私聊的订阅的b站推送列表 */
|
|
182
199
|
message.use(async (e) => {
|
|
183
200
|
let subData = weiboPushData || { group: {}, private: {} };
|
|
201
|
+
// 如果聊天ID没有订阅数据,则删除该聊天ID
|
|
202
|
+
for (let chatType in subData) {
|
|
203
|
+
if (subData.hasOwnProperty(chatType)) {
|
|
204
|
+
subData[chatType] = Object.keys(subData[chatType]).reduce((nonEmptyData, chatId) => {
|
|
205
|
+
if (subData[chatType][chatId].length > 0) {
|
|
206
|
+
nonEmptyData[chatId] = subData[chatType][chatId];
|
|
207
|
+
}
|
|
208
|
+
return nonEmptyData;
|
|
209
|
+
}, {});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
184
212
|
const messages = [];
|
|
185
213
|
const typeMap = {
|
|
186
214
|
DYNAMIC_TYPE_AV: '视频',
|
|
@@ -204,7 +232,7 @@ message.use(async (e) => {
|
|
|
204
232
|
}
|
|
205
233
|
});
|
|
206
234
|
}
|
|
207
|
-
messages.push(`${item.
|
|
235
|
+
messages.push(`${item.uid}:${item.name} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
208
236
|
});
|
|
209
237
|
e.reply(`推送列表如下:\n${messages.join('\n')}`);
|
|
210
238
|
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(推送|动态|订阅)列表$/]);
|
|
@@ -83,9 +83,9 @@ const Content = ({ data }) => {
|
|
|
83
83
|
contentCss,
|
|
84
84
|
boxGrid,
|
|
85
85
|
React.createElement("div", { className: "content" },
|
|
86
|
-
picItems,
|
|
87
86
|
React.createElement("div", { className: "content-text-title", style: { marginBottom: '10px' } }, data.title && React.createElement("h1", null, data.title)),
|
|
88
|
-
React.createElement("div", { className: "content-text", dangerouslySetInnerHTML: { __html: data.content || '' } })
|
|
87
|
+
React.createElement("div", { className: "content-text", dangerouslySetInnerHTML: { __html: data.content || '' } }),
|
|
88
|
+
picItems)));
|
|
89
89
|
case 'DYNAMIC_TYPE_WORD':
|
|
90
90
|
return (React.createElement(React.Fragment, null,
|
|
91
91
|
contentCss,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigController, BOT_NAME } from 'yunzaijs';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import {
|
|
5
|
+
import { _paths, createRequire } from '../../utils/paths.js';
|
|
6
6
|
|
|
7
7
|
// Footer.tsx
|
|
8
8
|
const require = createRequire(import.meta.url);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigController, BOT_NAME } from 'yunzaijs';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import {
|
|
5
|
+
import { _paths, createRequire } from '../../utils/paths.js';
|
|
6
6
|
|
|
7
7
|
//help.tsx
|
|
8
8
|
const require = createRequire(import.meta.url);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigController, BOT_NAME } from 'yunzaijs';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import {
|
|
5
|
+
import { _paths, createRequire } from '../../utils/paths.js';
|
|
6
6
|
|
|
7
7
|
const require = createRequire(import.meta.url);
|
|
8
8
|
const botVersion = ConfigController.package?.version;
|
|
@@ -148,6 +148,9 @@ async function checkBiliLogin(e) {
|
|
|
148
148
|
const LoginCookieTTLStr = LoginCookieTTL === -1 ? '永久' : LoginCookieTTL === -2 ? '-' : `${new Date(Date.now() + LoginCookieTTL * 1000).toLocaleString()}`;
|
|
149
149
|
e.reply(`~B站账号已登陆~\n有效期至:${LoginCookieTTLStr}。\n昵称:${uname}\nuid:${mid}\n硬币:${money}\n经验等级:${current_level}\n当前经验值exp:${current_exp}\n下一等级所需exp:${next_exp}`);
|
|
150
150
|
}
|
|
151
|
+
else if (resData.code === -101) {
|
|
152
|
+
e.reply('B站登录CK已失效,请重新扫码登录');
|
|
153
|
+
}
|
|
151
154
|
else {
|
|
152
155
|
// 处理其他情况
|
|
153
156
|
e.reply('意外情况,未能成功获取登录ck的有效状态');
|