koishi-plugin-weibo-post-monitor 1.0.1-beta.2 → 1.0.1-beta.3
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.js +7 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -356,13 +356,11 @@ async function getMessage(params, wbPost) {
|
|
|
356
356
|
}
|
|
357
357
|
const screenName = user?.screen_name || "";
|
|
358
358
|
let weiboType = -1;
|
|
359
|
-
if (
|
|
359
|
+
if (wbPost?.page_info) {
|
|
360
360
|
weiboType = 0;
|
|
361
|
-
}
|
|
362
|
-
if ("pic_infos" in wbPost) {
|
|
361
|
+
} else if (wbPost?.pic_infos && wbPost?.pic_ids && wbPost.pic_ids.length > 0) {
|
|
363
362
|
weiboType = 2;
|
|
364
|
-
}
|
|
365
|
-
if ("topic_struct" in wbPost || "retweeted_status" in wbPost) {
|
|
363
|
+
} else if (wbPost?.retweeted_status) {
|
|
366
364
|
weiboType = 1;
|
|
367
365
|
}
|
|
368
366
|
let message_text = "";
|
|
@@ -371,7 +369,7 @@ async function getMessage(params, wbPost) {
|
|
|
371
369
|
return null;
|
|
372
370
|
}
|
|
373
371
|
if (weiboType == 0) {
|
|
374
|
-
logger.info("
|
|
372
|
+
logger.info("获取到推文类型: 0-视频");
|
|
375
373
|
const pageInfo = wbPost?.page_info;
|
|
376
374
|
if (!pageInfo) {
|
|
377
375
|
return null;
|
|
@@ -383,20 +381,20 @@ async function getMessage(params, wbPost) {
|
|
|
383
381
|
}
|
|
384
382
|
}
|
|
385
383
|
if (weiboType == 1) {
|
|
386
|
-
logger.info("
|
|
384
|
+
logger.info("获取到推文类型: 1-转发微博");
|
|
387
385
|
if (params.forward) {
|
|
388
386
|
tempMessage += screenName + " 转发了微博:\n{temp_text}" || "";
|
|
389
387
|
}
|
|
390
388
|
}
|
|
391
389
|
if (weiboType == 2) {
|
|
392
|
-
logger.info("
|
|
390
|
+
logger.info("获取到推文类型: 2-图文");
|
|
393
391
|
const picIds = wbPost?.pic_ids || [];
|
|
394
392
|
const picInfos = wbPost?.pic_infos || {};
|
|
395
393
|
const firstPicUrl = picInfos?.[picIds[0]]?.large?.url || "";
|
|
396
394
|
const picture = import_koishi2.h.image(firstPicUrl);
|
|
397
395
|
tempMessage += screenName + " 发布了微博:\n{temp_text}\n" + picture || "";
|
|
398
396
|
}
|
|
399
|
-
logger.info("weiboType = " + weiboType);
|
|
397
|
+
logger.info("[weiboType = " + weiboType + "]");
|
|
400
398
|
const mid = wbPost?.mid || "";
|
|
401
399
|
const url = `https://m.weibo.cn/status/${mid}`;
|
|
402
400
|
const detailMessage = await getDetailMessage(url);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-weibo-post-monitor",
|
|
3
3
|
"description": "微博帖子更新推送插件,用于获取指定微博用户的最新帖子推送到指定群聊,参考代码https://github.com/moehuhu/weibo-monitor",
|
|
4
|
-
"version": "1.0.1-beta.
|
|
4
|
+
"version": "1.0.1-beta.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|