yz-yuki-plugin 2.0.7-10 → 2.0.7-11
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.
|
@@ -74,12 +74,7 @@ class BiliTask {
|
|
|
74
74
|
const { uid, bot_id, name, type } = subInfoOfup;
|
|
75
75
|
let resp;
|
|
76
76
|
// 检查是否已经请求过该 uid
|
|
77
|
-
if (requestedDataOfUids.has(uid)) {
|
|
78
|
-
resp = requestedDataOfUids.get(uid); // 从已请求的映射中获取响应数据
|
|
79
|
-
const dynamicData = resp.data?.items || [];
|
|
80
|
-
dynamicList[uid] = dynamicData;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
77
|
+
if (!requestedDataOfUids.has(uid)) {
|
|
83
78
|
resp = await this.hendleEventDynamicData(uid);
|
|
84
79
|
if (resp) {
|
|
85
80
|
if (resp.code === 0) {
|
|
@@ -142,8 +137,9 @@ class BiliTask {
|
|
|
142
137
|
logger.debug(`超过间隔,跳过 [ ${author?.name} : ${author?.mid} ] ${author?.pub_time} 的动态`);
|
|
143
138
|
continue;
|
|
144
139
|
} // 如果超过推送时间间隔,跳过当前循环
|
|
145
|
-
if (dynamicItem
|
|
146
|
-
continue;
|
|
140
|
+
if (dynamicItem?.type === 'DYNAMIC_TYPE_FORWARD' && !biliConfigData.pushTransmit) {
|
|
141
|
+
continue;
|
|
142
|
+
} // 如果关闭了转发动态的推送,跳过当前循环
|
|
147
143
|
willPushDynamicList.push(dynamicItem);
|
|
148
144
|
}
|
|
149
145
|
// 遍历待推送的动态数组,发送动态消息
|
|
@@ -151,8 +147,9 @@ class BiliTask {
|
|
|
151
147
|
for (let [chatId, subUpInfo] of chatIdMap) {
|
|
152
148
|
const { upName, types } = subUpInfo;
|
|
153
149
|
for (let pushDynamicData of willPushDynamicList) {
|
|
154
|
-
if (types && types.length && !types.includes(pushDynamicData.type))
|
|
155
|
-
continue;
|
|
150
|
+
if (types && types.length > 0 && !types.includes(pushDynamicData.type)) {
|
|
151
|
+
continue;
|
|
152
|
+
} // 如果禁用了某类型的动态推送,跳过当前循环
|
|
156
153
|
await this.makeDynamicMessageMap(chatId, bot_id, upName, pushDynamicData, biliConfigData, chatType, messageMap); // 发送动态消息
|
|
157
154
|
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
158
155
|
}
|
|
@@ -54,12 +54,7 @@ class WeiboTask {
|
|
|
54
54
|
const { uid, bot_id, name, type } = subInfoOfup;
|
|
55
55
|
let resp;
|
|
56
56
|
// 检查是否已经请求过该 uid
|
|
57
|
-
if (requestedDataOfUids.has(uid)) {
|
|
58
|
-
resp = requestedDataOfUids.get(uid); // 从已请求的映射中获取响应数据
|
|
59
|
-
const dynamicData = resp || [];
|
|
60
|
-
dynamicList[uid] = dynamicData;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
57
|
+
if (!requestedDataOfUids.has(uid)) {
|
|
63
58
|
resp = await new WeiboWebDataFetcher().getBloggerDynamicList(uid); // 获取指定 uid 的动态列表
|
|
64
59
|
if (resp) {
|
|
65
60
|
requestedDataOfUids.set(uid, resp); // 将响应数据存储到映射中
|
|
@@ -109,8 +104,9 @@ class WeiboTask {
|
|
|
109
104
|
logger.debug(`超过间隔,跳过 [ ${user?.screen_name} : ${user?.id} ] ${raw_post?.mblog?.created_at} 的动态`);
|
|
110
105
|
continue;
|
|
111
106
|
} // 如果超过推送时间间隔,跳过当前循环
|
|
112
|
-
if (dynamicItem
|
|
113
|
-
continue;
|
|
107
|
+
if (dynamicItem?.type === 'DYNAMIC_TYPE_FORWARD' && !weiboConfigData.pushTransmit) {
|
|
108
|
+
continue;
|
|
109
|
+
} // 如果关闭了转发动态的推送,跳过当前循环
|
|
114
110
|
willPushDynamicList.push(dynamicItem);
|
|
115
111
|
}
|
|
116
112
|
// 遍历待推送的动态数组,发送动态消息
|
|
@@ -118,8 +114,9 @@ class WeiboTask {
|
|
|
118
114
|
for (let [chatId, subUpInfo] of chatIdMap) {
|
|
119
115
|
const { upName, types } = subUpInfo;
|
|
120
116
|
for (let pushDynamicData of willPushDynamicList) {
|
|
121
|
-
if (types && types.length && !types.includes(pushDynamicData.type))
|
|
122
|
-
continue;
|
|
117
|
+
if (types && types.length > 0 && !types.includes(pushDynamicData.type)) {
|
|
118
|
+
continue;
|
|
119
|
+
} // 如果禁用了某类型的动态推送,跳过当前循环
|
|
123
120
|
await this.makeDynamicMessageMap(chatId, bot_id, upName, pushDynamicData, weiboConfigData, chatType, messageMap); // 发送动态消息
|
|
124
121
|
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
125
122
|
}
|