yz-yuki-plugin 2.0.6-6 → 2.0.6-7
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/apps/weibo.js +3 -3
- package/lib/index.js +1 -1
- package/lib/models/bilibili/bilibili.main.task.js +8 -6
- package/lib/models/weibo/{weibo.get.web.data.js → weibo.main.get.web.data.js} +2 -2
- package/lib/models/weibo/{weibo.query.js → weibo.main.query.js} +1 -1
- package/lib/models/weibo/{weibo.task.js → weibo.main.task.js} +3 -2
- package/package.json +1 -1
- /package/lib/models/weibo/{weibo.api.js → weibo.main.api.js} +0 -0
package/lib/apps/weibo.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Messages } from 'yunzaijs';
|
|
2
|
-
import { WeiboQuery } from '../models/weibo/weibo.query.js';
|
|
3
|
-
import { WeiboTask } from '../models/weibo/weibo.task.js';
|
|
2
|
+
import { WeiboQuery } from '../models/weibo/weibo.main.query.js';
|
|
3
|
+
import { WeiboTask } from '../models/weibo/weibo.main.task.js';
|
|
4
4
|
import Config from '../utils/config.js';
|
|
5
|
-
import { WeiboGetWebData } from '../models/weibo/weibo.get.web.data.js';
|
|
5
|
+
import { WeiboGetWebData } from '../models/weibo/weibo.main.get.web.data.js';
|
|
6
6
|
|
|
7
7
|
const message = new Messages('message');
|
|
8
8
|
let weiboPushData = Config.getConfigData('config', 'weibo', 'push');
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import path from 'path';
|
|
|
5
5
|
import { _paths } from './utils/paths.js';
|
|
6
6
|
import * as index$1 from './apps/index.js';
|
|
7
7
|
import { BiliTask } from './models/bilibili/bilibili.main.task.js';
|
|
8
|
-
import { WeiboTask } from './models/weibo/weibo.task.js';
|
|
8
|
+
import { WeiboTask } from './models/weibo/weibo.main.task.js';
|
|
9
9
|
|
|
10
10
|
const yukiPluginVersion = Config.getPackageJsonKey('version', path.join(_paths.pluginPath, 'package.json'));
|
|
11
11
|
let biliConfigData = Config.getConfigData('config', 'bilibili', 'config');
|
|
@@ -37,6 +37,7 @@ class BiliTask {
|
|
|
37
37
|
let biliConfigData = await Config.getUserConfig('bilibili', 'config');
|
|
38
38
|
let biliPushData = await Config.getUserConfig('bilibili', 'push');
|
|
39
39
|
let interval = biliConfigData?.interval || 7200;
|
|
40
|
+
logger.debug(`当前B站功能配置:${JSON.stringify(biliConfigData)}`);
|
|
40
41
|
const uidMap = new Map(); // 存放group 和 private 对应所属 uid 与推送信息的映射
|
|
41
42
|
const dynamicList = {}; // 存放获取的所有动态,键为 uid,值为动态数组
|
|
42
43
|
await this.processBiliData(biliPushData, biliConfigData, uidMap, dynamicList);
|
|
@@ -172,10 +173,11 @@ class BiliTask {
|
|
|
172
173
|
}
|
|
173
174
|
if (sended)
|
|
174
175
|
return; // 如果已经发送过,则直接返回
|
|
175
|
-
let liveAtAll = biliConfigData.liveAtAll === true ? true : false; // 直播动态是否@全体成员,默认false
|
|
176
|
+
let liveAtAll = !!biliConfigData.liveAtAll === true ? true : false; // 直播动态是否@全体成员,默认false
|
|
176
177
|
let liveAtAllCD = biliConfigData.liveAtAllCD || 1800; // 直播动态@全体成员 冷却时间CD,默认 30 分钟
|
|
177
178
|
let liveAtAllMark = await Redis.get(`${markKey}${chatId}:liveAtAllMark`); // 直播动态@全体成员标记,默认 0
|
|
178
|
-
|
|
179
|
+
// 直播动态@全体成员的群组列表,默认空数组,为空则不进行@全体成员操作
|
|
180
|
+
let liveAtAllGroupList = new Set(Array.isArray(biliConfigData?.liveAtAllGroupList) ? Array.from(biliConfigData.liveAtAllGroupList).map(item => String(item)) : []);
|
|
179
181
|
if (!!biliConfigData.pushMsgMode) {
|
|
180
182
|
const { data, uid } = await BiliQuery.formatDynamicData(pushDynamicData); // 处理动态数据
|
|
181
183
|
const extentData = { ...data };
|
|
@@ -207,7 +209,7 @@ class BiliTask {
|
|
|
207
209
|
return;
|
|
208
210
|
Redis.set(`${markKey}${chatId}:${id_str}`, '1', { EX: 3600 * 72 }); // 设置已发送标记
|
|
209
211
|
global?.logger?.mark('优纪插件:B站动态执行推送');
|
|
210
|
-
if (liveAtAll && liveAtAllMark && extentData?.type === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList.has(chatId)) {
|
|
212
|
+
if (liveAtAll && !liveAtAllMark && extentData?.type === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList.has(String(chatId))) {
|
|
211
213
|
try {
|
|
212
214
|
await this.sendMessage(chatId, bot_id, chatType, Segment.at('all'));
|
|
213
215
|
await Redis.set(`${markKey}${chatId}:liveAtAllMark`, 1, { EX: liveAtAllCD }); // 设置直播动态@全体成员标记为 1
|
|
@@ -238,9 +240,9 @@ class BiliTask {
|
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
242
|
let mergeTextPic = !!biliConfigData.mergeTextPic === false ? false : true; // 是否合并文本和图片,默认为 true
|
|
241
|
-
if (mergeTextPic) {
|
|
243
|
+
if (mergeTextPic === true) {
|
|
242
244
|
const mergeMsg = [...dynamicMsg.msg, ...dynamicMsg.pics];
|
|
243
|
-
if (liveAtAll && liveAtAllMark && dynamicMsg.dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList.has(chatId)) {
|
|
245
|
+
if (liveAtAll && !liveAtAllMark && dynamicMsg.dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList.has(String(chatId))) {
|
|
244
246
|
try {
|
|
245
247
|
await this.sendMessage(chatId, bot_id, chatType, Segment.at('all'));
|
|
246
248
|
await Redis.set(`${markKey}${chatId}:liveAtAllMark`, 1, { EX: liveAtAllCD }); // 设置直播动态@全体成员标记为 1
|
|
@@ -253,7 +255,7 @@ class BiliTask {
|
|
|
253
255
|
await this.sendMessage(chatId, bot_id, chatType, mergeMsg);
|
|
254
256
|
}
|
|
255
257
|
else {
|
|
256
|
-
if (liveAtAll && liveAtAllMark && dynamicMsg.dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList.has(chatId)) {
|
|
258
|
+
if (liveAtAll && !liveAtAllMark && dynamicMsg.dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList.has(String(chatId))) {
|
|
257
259
|
try {
|
|
258
260
|
await this.sendMessage(chatId, bot_id, chatType, Segment.at('all'));
|
|
259
261
|
await Redis.set(`${markKey}${chatId}:liveAtAllMark`, 1, { EX: liveAtAllCD }); // 设置直播动态@全体成员标记为 1
|
|
@@ -2,8 +2,8 @@ import QRCode from 'qrcode';
|
|
|
2
2
|
import { Redis, Segment, Bot } from 'yunzaijs';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
4
|
import { renderPage } from '../../utils/image.js';
|
|
5
|
-
import { WeiboGetWebData } from './weibo.get.web.data.js';
|
|
6
|
-
import { WeiboQuery } from './weibo.query.js';
|
|
5
|
+
import { WeiboGetWebData } from './weibo.main.get.web.data.js';
|
|
6
|
+
import { WeiboQuery } from './weibo.main.query.js';
|
|
7
7
|
|
|
8
8
|
class WeiboTask {
|
|
9
9
|
taskName;
|
|
@@ -19,6 +19,7 @@ class WeiboTask {
|
|
|
19
19
|
let weiboConfigData = await Config.getUserConfig('weibo', 'config');
|
|
20
20
|
let weiboPushData = await Config.getUserConfig('weibo', 'push');
|
|
21
21
|
let interval = weiboConfigData.interval || 7200; // 推送间隔时间,单位为秒,默认2小时
|
|
22
|
+
logger.debug(`当前微博功能配置:${JSON.stringify(weiboConfigData)}`);
|
|
22
23
|
const uidMap = new Map(); // 存放group 和 private 对应所属 uid 与推送信息的映射
|
|
23
24
|
const dynamicList = {}; // 存放获取的所有动态,键为 uid,值为动态数组
|
|
24
25
|
await this.processWeiboData(weiboPushData, uidMap, dynamicList);
|
package/package.json
CHANGED
|
File without changes
|