koishi-plugin-ll-schedule 1.7.4 → 1.7.5
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/index.js +16 -0
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -627,6 +627,11 @@ function apply(ctx, config) {
|
|
|
627
627
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
// 分钟数 → "HH:MM"
|
|
631
|
+
function minToHM(min) {
|
|
632
|
+
return `${String(Math.floor(min / 60) % 24).padStart(2, '0')}:${String(min % 60).padStart(2, '0')}`
|
|
633
|
+
}
|
|
634
|
+
|
|
630
635
|
// ===== 发送 =====
|
|
631
636
|
const KNOWN_IGNORE_CODES = new Set([11293, 40034101, 40034105, 304101, 304102])
|
|
632
637
|
|
|
@@ -829,10 +834,19 @@ function apply(ctx, config) {
|
|
|
829
834
|
// ① 活动表模式(有新活动表就只跑它,避免和旧任务重复发)
|
|
830
835
|
const activities = parseActivities(config.activities)
|
|
831
836
|
if (activities.length) {
|
|
837
|
+
const nowMin = hmToMin(hm)
|
|
832
838
|
const reminds = computeReminders(activities, now, hm)
|
|
833
839
|
for (const r of reminds) {
|
|
840
|
+
// 发送前复核:独立再算一次"这条提醒该在几点发",对不上就拒发(防任何上游错位)
|
|
841
|
+
const fireMin = r.inst.startMin - (r.inst.advance || 0)
|
|
842
|
+
if (fireMin !== nowMin) {
|
|
843
|
+
logger.warn(`[schedule] 触发复核未通过,已拒发:「${r.inst.activity}」提醒点 ${minToHM(fireMin)},当前 ${hm}`)
|
|
844
|
+
continue
|
|
845
|
+
}
|
|
834
846
|
if (firedToday[r.key]) continue
|
|
835
847
|
firedToday[r.key] = true
|
|
848
|
+
logger.info(`[schedule] 触发提醒:「${r.inst.activity}」星期${WEEK_CN[r.inst.day]} ${r.inst.start}-${r.inst.end}` +
|
|
849
|
+
`${r.inst.place ? '|' + r.inst.place : ''}|提醒点 ${minToHM(fireMin)}|当前 ${hm}`)
|
|
836
850
|
await sendReminder(r.inst, r.next, now, hm)
|
|
837
851
|
}
|
|
838
852
|
return
|
|
@@ -983,6 +997,8 @@ function apply(ctx, config) {
|
|
|
983
997
|
lines.push(`⏭ 下一次提醒:「${best.inst.activity}」${when} ${hh}:${mm}(活动 ${best.inst.start}-${best.inst.end}${best.inst.place ? ' ' + best.inst.place : ''})`)
|
|
984
998
|
}
|
|
985
999
|
lines.push(`💾 已订阅群:${(subs.get(ALL) || new Map()).size} 个`)
|
|
1000
|
+
const fired = Object.keys(firedToday).filter(k => k !== 'date')
|
|
1001
|
+
lines.push(`📤 今天已发过的提醒(${firedToday.date || todayStr(now)}):${fired.length ? fired.join('、') : '无'}`)
|
|
986
1002
|
return lines.join('\n')
|
|
987
1003
|
})
|
|
988
1004
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-ll-schedule",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "Scheduled message sender with weekly slots (per-day time & content), QQ official markdown card support",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -36,3 +36,4 @@
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
|