koishi-plugin-booknews 0.0.7 → 0.0.9

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 +7 -9
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -43,12 +43,6 @@ function apply(ctx, config) {
43
43
  timestamp: "timestamp"
44
44
  }, { autoInc: true });
45
45
  const sendDailyReport = /* @__PURE__ */ __name(async (isManual = false) => {
46
- ctx.logger("booknews").error(
47
- "sendDailyReport called, newsList length =",
48
- (await ctx.database.get("daily_book_news", {})).length,
49
- "time =",
50
- Date.now()
51
- );
52
46
  const newsList = await ctx.database.get("daily_book_news", {});
53
47
  if (newsList.length === 0) return "今日暂无书讯。";
54
48
  const bot = ctx.bots[0];
@@ -62,7 +56,7 @@ function apply(ctx, config) {
62
56
  forward: true,
63
57
  userId: bot.selfId,
64
58
  nickname: item.authorName
65
- }, pureText);
59
+ }, import_koishi.h.parse(pureText));
66
60
  });
67
61
  const partNum = Math.floor(i / chunkSize) + 1;
68
62
  const totalParts = Math.ceil(newsList.length / chunkSize);
@@ -72,6 +66,10 @@ function apply(ctx, config) {
72
66
  nickname: "书讯助手"
73
67
  }, `📅 书讯汇总 (${partNum}/${totalParts})
74
68
  本段包含 ${chunk.length} 条资讯`));
69
+ if (i === 0) {
70
+ ctx.logger("book").info(`[调试] 正在准备发送第 ${partNum} 段,节点总数: ${nodes.length}`);
71
+ ctx.logger("book").info(`[调试] 第一个节点详情: ${JSON.stringify(nodes[0], null, 2)}`);
72
+ }
75
73
  try {
76
74
  await bot.sendMessage(config.dstGroupIds, nodes);
77
75
  await new Promise((resolve) => setTimeout(resolve, 2e3));
@@ -92,11 +90,11 @@ function apply(ctx, config) {
92
90
  authorName: session.username || session.userId,
93
91
  timestamp: /* @__PURE__ */ new Date()
94
92
  });
95
- session.send("已收录书讯");
96
93
  });
97
94
  ctx.cron(config.sendTime, () => sendDailyReport(false));
98
95
  ctx.command("sendnews", "手动触发发送今日书讯").option("clear", "-c 发送后清空数据库", { fallback: false }).action(async ({ options }) => {
99
- return await sendDailyReport(!options.clear);
96
+ await sendDailyReport(!options.clear);
97
+ ctx.logger("book").info(`日报发送成功`);
100
98
  });
101
99
  }
102
100
  __name(apply, "apply");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-booknews",
3
3
  "description": "It's a plugin for booknews collection",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [