koishi-plugin-ll-schedule 1.7.7 → 1.7.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/index.js +24 -5
  2. package/package.json +5 -25
package/index.js CHANGED
@@ -653,6 +653,25 @@ function apply(ctx, config) {
653
653
  return typeof code === 'number' && KNOWN_IGNORE_CODES.has(code)
654
654
  }
655
655
 
656
+ // 把发送错误整理成可读的一行(含错误码与原始返回,便于定位问题)
657
+ function errDetail(e) {
658
+ const parts = []
659
+ if (e && e.message) parts.push(e.message)
660
+ if (e && e.code) parts.push(`code=${e.code}`)
661
+ const data = e && e.response && e.response.data
662
+ if (data) {
663
+ const c = data.code !== undefined ? data.code : data.err_code
664
+ if (c !== undefined) parts.push(`apiCode=${c}`)
665
+ if (data.message) parts.push(`msg=${data.message}`)
666
+ try {
667
+ parts.push(JSON.stringify(data).slice(0, 300))
668
+ }
669
+ catch (x) { /* 忽略序列化失败 */ }
670
+ }
671
+ if (!parts.length) parts.push(String(e))
672
+ return parts.join(' | ')
673
+ }
674
+
656
675
  async function sendOne(bot, target, text, { markdown, image }) {
657
676
  if (markdown && bot.platform === 'qq' && bot.internal && typeof bot.internal.sendMessage === 'function') {
658
677
  const md = buildMd(text, image)
@@ -663,10 +682,10 @@ function apply(ctx, config) {
663
682
  }
664
683
  catch (e) {
665
684
  if (isKnownIgnoreError(e)) {
666
- if (config.verbose) logger.debug(`[schedule] 主动消息受限 (code=${errCode(e)}),跳过 ${bot.sid}:${target}`)
685
+ logger.warn(`[schedule] 主动消息受限,未发出 (${bot.sid}:${target}) ${errDetail(e)}`)
667
686
  return false
668
687
  }
669
- logger.warn(`[schedule] markdown 发送失败,回退纯文本 (${bot.sid}:${target}):`, e.message || e)
688
+ logger.warn(`[schedule] markdown 发送失败,回退纯文本 (${bot.sid}:${target}): ${errDetail(e)}`)
670
689
  }
671
690
  }
672
691
  const parts = []
@@ -727,7 +746,7 @@ function apply(ctx, config) {
727
746
  if (config.verbose) logger.info(`[schedule] 已发送任务 "${name}" 到 ${bot.sid}:${target}`)
728
747
  }
729
748
  catch (e) {
730
- logger.error(`[schedule] 发送到 ${bot.sid}:${target} 失败: ${e.message}`)
749
+ logger.error(`[schedule] 发送到 ${bot.sid}:${target} 失败: ${errDetail(e)}`)
731
750
  }
732
751
  }
733
752
  for (const target of subTargets) {
@@ -752,7 +771,7 @@ function apply(ctx, config) {
752
771
  if (config.verbose) logger.info(`[schedule] 已发送任务 "${name}" 到 ${bot.sid}:${g.guildId}`)
753
772
  }
754
773
  catch (e) {
755
- logger.error(`[schedule] 发送到 ${bot.sid}:${g.guildId} 失败: ${e.message}`)
774
+ logger.error(`[schedule] 发送到 ${bot.sid}:${g.guildId} 失败: ${errDetail(e)}`)
756
775
  }
757
776
  }
758
777
  }
@@ -796,7 +815,7 @@ function apply(ctx, config) {
796
815
  if (config.verbose) logger.info(`[schedule] 提醒已发 ${bot.sid}:${target}`)
797
816
  }
798
817
  catch (e) {
799
- logger.error(`[schedule] 提醒发送失败 ${bot.sid}:${target}: ${e.message}`)
818
+ logger.error(`[schedule] 提醒发送失败 ${bot.sid}:${target}: ${errDetail(e)}`)
800
819
  }
801
820
  }
802
821
  }
package/package.json CHANGED
@@ -1,41 +1,21 @@
1
1
  {
2
2
  "name": "koishi-plugin-ll-schedule",
3
- "version": "1.7.7",
4
- "description": "Scheduled message sender with weekly slots (per-day time & content), QQ official markdown card support",
3
+ "version": "1.7.9",
4
+ "description": "BNS activity reminder: one activity table, one-click subscribe, auto reminders with time/place/next-up, QQ official markdown card support",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "index.js"
8
8
  ],
9
9
  "license": "MIT",
10
- "keywords": ["koishi", "koishi-plugin", "schedule", "timer", "定时", "markdown", "排班"],
10
+ "keywords": ["koishi", "koishi-plugin", "schedule", "timer", "定时", "提醒", "markdown", "剑灵"],
11
11
  "peerDependencies": {
12
12
  "koishi": "^4.18.0"
13
13
  },
14
14
  "koishi": {
15
15
  "description": {
16
- "zh": "定时发送插件:设置时间自动发送文字/图片/QQ官方Markdown卡片到指定群,支持排班表(按星期设置不同时间与内容),兼容官方QQ机器人(官机)。",
17
- "en": "Scheduled message sender. Auto-send text/image/markdown card to groups at set times, with weekly slots for per-day schedule, works with official QQ bot."
16
+ "zh": "剑灵活动提醒:全部活动写在一张活动表里,群内发「剑灵提醒订阅」一键订阅全部提醒,到点自动提前提醒(含活动时间、地点、下一时段活动),支持 QQ 官方 Markdown 卡片,兼容官方QQ机器人(官机)。",
17
+ "en": "BNS activity reminder. All activities in one table; groups subscribe once and get every reminder in advance (time, place, next activity), with QQ official markdown card support."
18
18
  }
19
19
  }
20
20
  }
21
21
 
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-