koishi-plugin-weibo-post-monitor 1.0.1-beta.7 → 1.0.2

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 +4 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -384,7 +384,6 @@ async function getMessage(params, wbPost) {
384
384
  }
385
385
  const screenName = user?.screen_name || "";
386
386
  let weiboType = -1;
387
- logger.info("wbPost = " + JSON.stringify(wbPost));
388
387
  if (wbPost?.page_info) {
389
388
  weiboType = 0;
390
389
  }
@@ -436,7 +435,7 @@ async function getMessage(params, wbPost) {
436
435
  return null;
437
436
  }
438
437
  let message = tempMessage.replace("{temp_text}", message_text);
439
- const wbpost = message ? message + urlMessage : screenName + " 发布了微博:\n" + wbPost?.text_raw + urlMessage || "";
438
+ const wbpost = message ? message + urlMessage : screenName + " 发布了微博:\n" + (message_text ? message_text : wbPost?.text_raw) + urlMessage || "";
440
439
  return { post: wbpost, islast: true };
441
440
  }
442
441
  __name(getMessage, "getMessage");
@@ -485,7 +484,6 @@ async function getDetailMessage(wb_url) {
485
484
  timeout: 1e4
486
485
  });
487
486
  const responseData = response.data;
488
- logger.info("responseData = " + JSON.stringify(responseData));
489
487
  if (!responseData || responseData.ok !== 1 || !responseData.data) {
490
488
  logger.error("获取微博response返回报错: " + JSON.stringify(responseData));
491
489
  return null;
@@ -495,7 +493,6 @@ async function getDetailMessage(wb_url) {
495
493
  logger.error("获取微博返回的longTextContent为空");
496
494
  return null;
497
495
  }
498
- logger.info("longTextContent = " + JSON.stringify(responseData));
499
496
  const plainText = stripHtmlTags(longTextContent);
500
497
  return plainText;
501
498
  } catch (error) {
@@ -515,7 +512,9 @@ function apply(ctx, config) {
515
512
  waitMinutes: config.waitMinutes,
516
513
  is_using_cookie: config.is_using_cookie
517
514
  };
518
- setCookie(config.manual_cookie);
515
+ if (config.is_using_cookie) {
516
+ setCookie(config.manual_cookie);
517
+ }
519
518
  setUserAgent(USER_AGENT_LIST[0]);
520
519
  ctx.setInterval(async () => {
521
520
  for (const singleConfig of config.sendINFO) {
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.7",
4
+ "version": "1.0.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [