koishi-plugin-weibo-post-monitor 1.0.1-beta.1 → 1.0.1-beta.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.
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { Context } from 'koishi';
1
+ import { Context, Logger } from 'koishi';
2
2
  import { Config, type Config as ConfigType } from './services/config';
3
3
  export declare const name = "weibo-post-monitor";
4
4
  export { Config };
5
+ export declare let logger: Logger;
5
6
  export declare function apply(ctx: Context, config: ConfigType): void;
package/lib/index.js CHANGED
@@ -32,9 +32,11 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  Config: () => Config,
34
34
  apply: () => apply,
35
+ logger: () => logger,
35
36
  name: () => name
36
37
  });
37
38
  module.exports = __toCommonJS(src_exports);
39
+ var import_koishi3 = require("koishi");
38
40
 
39
41
  // src/services/config.ts
40
42
  var import_koishi = require("koishi");
@@ -327,7 +329,6 @@ async function getWeiboAndSendMessageToGroup(ctx, params) {
327
329
  message = import_koishi2.h.at("all") + " " + message;
328
330
  }
329
331
  ctx.bots[`${params.plantform}:${params.account}`].sendMessage(params.groupID, message);
330
- console.log(message);
331
332
  }
332
333
  __name(getWeiboAndSendMessageToGroup, "getWeiboAndSendMessageToGroup");
333
334
  async function getLastPost(params, weiboList) {
@@ -370,7 +371,7 @@ async function getMessage(params, wbPost) {
370
371
  return null;
371
372
  }
372
373
  if (weiboType == 0) {
373
- console.log("获取到类型 0-视频");
374
+ logger.info("获取到类型 0-视频");
374
375
  const pageInfo = wbPost?.page_info;
375
376
  if (!pageInfo) {
376
377
  return null;
@@ -382,19 +383,20 @@ async function getMessage(params, wbPost) {
382
383
  }
383
384
  }
384
385
  if (weiboType == 1) {
385
- console.log("获取到类型 1-转发微博");
386
+ logger.info("获取到类型 1-转发微博");
386
387
  if (params.forward) {
387
388
  tempMessage += screenName + " 转发了微博:\n{temp_text}" || "";
388
389
  }
389
390
  }
390
391
  if (weiboType == 2) {
391
- console.log("获取到类型 2-图文");
392
+ logger.info("获取到类型 2-图文");
392
393
  const picIds = wbPost?.pic_ids || [];
393
394
  const picInfos = wbPost?.pic_infos || {};
394
395
  const firstPicUrl = picInfos?.[picIds[0]]?.large?.url || "";
395
396
  const picture = import_koishi2.h.image(firstPicUrl);
396
397
  tempMessage += screenName + " 发布了微博:\n{temp_text}\n" + picture || "";
397
398
  }
399
+ logger.info("weiboType = " + weiboType);
398
400
  const mid = wbPost?.mid || "";
399
401
  const url = `https://m.weibo.cn/status/${mid}`;
400
402
  const detailMessage = await getDetailMessage(url);
@@ -500,6 +502,7 @@ __name(getDetailMessage, "getDetailMessage");
500
502
 
501
503
  // src/index.ts
502
504
  var name = "weibo-post-monitor";
505
+ var logger = new import_koishi3.Logger(name);
503
506
  function apply(ctx, config) {
504
507
  const commonConfig = {
505
508
  account: config.account,
@@ -521,5 +524,6 @@ __name(apply, "apply");
521
524
  0 && (module.exports = {
522
525
  Config,
523
526
  apply,
527
+ logger,
524
528
  name
525
529
  });
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.1",
4
+ "version": "1.0.1-beta.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [