koishi-plugin-weibo-post-monitor 1.0.1-beta.0 → 1.0.1-beta.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.
Files changed (2) hide show
  1. package/lib/index.js +8 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -350,6 +350,9 @@ async function getMessage(params, wbPost) {
350
350
  const { created_at, user } = wbPost;
351
351
  const time = parseDateString(created_at);
352
352
  const lastCheckTime = Date.now() - (params.waitMinutes > 0 ? params.waitMinutes * 60 * 1e3 : 6e4);
353
+ if (time.getTime() < lastCheckTime) {
354
+ return null;
355
+ }
353
356
  const screenName = user?.screen_name || "";
354
357
  let weiboType = -1;
355
358
  if ("page_info" in wbPost) {
@@ -367,24 +370,25 @@ async function getMessage(params, wbPost) {
367
370
  return null;
368
371
  }
369
372
  if (weiboType == 0) {
373
+ console.log("获取到类型 0-视频");
370
374
  const pageInfo = wbPost?.page_info;
371
375
  if (!pageInfo) {
372
376
  return null;
373
377
  }
374
378
  const objType = pageInfo?.object_type || "";
375
379
  if (objType == "video") {
376
- const text = wbPost?.text_raw || "";
377
380
  const video = pageInfo?.media_info?.h5_url || "";
378
381
  tempMessage += screenName + " 发布了微博:\n{temp_text}\n" + video || "";
379
382
  }
380
383
  }
381
384
  if (weiboType == 1) {
385
+ console.log("获取到类型 1-转发微博");
382
386
  if (params.forward) {
383
387
  tempMessage += screenName + " 转发了微博:\n{temp_text}" || "";
384
388
  }
385
389
  }
386
390
  if (weiboType == 2) {
387
- const text = wbPost?.text_raw || "";
391
+ console.log("获取到类型 2-图文");
388
392
  const picIds = wbPost?.pic_ids || [];
389
393
  const picInfos = wbPost?.pic_infos || {};
390
394
  const firstPicUrl = picInfos?.[picIds[0]]?.large?.url || "";
@@ -396,6 +400,8 @@ async function getMessage(params, wbPost) {
396
400
  const detailMessage = await getDetailMessage(url);
397
401
  if (detailMessage) {
398
402
  message_text = detailMessage;
403
+ } else {
404
+ message_text = wbPost?.text_raw;
399
405
  }
400
406
  const urlMessage = `
401
407
  微博链接:${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.0",
4
+ "version": "1.0.1-beta.1",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [