koishi-plugin-ll-schedule 1.7.5 → 1.7.6
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 +21 -2
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -243,6 +243,7 @@ function hmToMin(hm) {
|
|
|
243
243
|
function parseActivities(text) {
|
|
244
244
|
const lines = String(text || '').split(/\r?\n/)
|
|
245
245
|
const acts = []
|
|
246
|
+
const errors = []
|
|
246
247
|
let cur = null
|
|
247
248
|
const pad = (s) => (String(s).length === 4 ? '0' + s : String(s))
|
|
248
249
|
for (const raw of lines) {
|
|
@@ -262,12 +263,22 @@ function parseActivities(text) {
|
|
|
262
263
|
if (/^[#/]/.test(line)) continue // 注释行
|
|
263
264
|
// 时段行:星期 开始-结束 [地点:xxx]
|
|
264
265
|
const m = line.match(/^(\S+)\s+(\d{1,2}:\d{2})\s*[-~—至]\s*(\d{1,2}:\d{2})\s*(.*)$/)
|
|
265
|
-
if (!m)
|
|
266
|
+
if (!m) {
|
|
267
|
+
errors.push(line)
|
|
268
|
+
continue
|
|
269
|
+
}
|
|
266
270
|
const rest = (m[4] || '').trim()
|
|
267
271
|
const pm = rest.match(/地点\s*[::]\s*(.+)$/)
|
|
268
272
|
cur.slots.push({ wd: m[1], start: pad(m[2]), end: pad(m[3]), place: pm ? pm[1].trim() : rest })
|
|
269
273
|
}
|
|
270
|
-
|
|
274
|
+
const out = acts.filter(a => {
|
|
275
|
+
if (a.slots.length) return true
|
|
276
|
+
errors.push(`【${a.name}】下面没有任何可识别的时段行`)
|
|
277
|
+
return false
|
|
278
|
+
})
|
|
279
|
+
// 把"看不懂的行"挂到数组上,供 list/debug 提示(不影响正常调用)
|
|
280
|
+
out.errors = errors
|
|
281
|
+
return out
|
|
271
282
|
}
|
|
272
283
|
|
|
273
284
|
// 展开成"周内实例"(星期 × 时段)
|
|
@@ -896,6 +907,10 @@ function apply(ctx, config) {
|
|
|
896
907
|
}
|
|
897
908
|
const subCount = (subs.get(ALL) || new Map()).size
|
|
898
909
|
lines.push('', `已订阅的群:${subCount} 个(发送"订阅列表"查看)`)
|
|
910
|
+
if (acts.errors && acts.errors.length) {
|
|
911
|
+
lines.push(`⚠️ 有 ${acts.errors.length} 行看不懂、已忽略(检查写法:星期 开始-结束,时间要 HH:MM):`)
|
|
912
|
+
for (const e of acts.errors.slice(0, 5)) lines.push(` ✗ ${e}`)
|
|
913
|
+
}
|
|
899
914
|
return lines.join('\n')
|
|
900
915
|
}
|
|
901
916
|
// 旧任务模式
|
|
@@ -997,6 +1012,10 @@ function apply(ctx, config) {
|
|
|
997
1012
|
lines.push(`⏭ 下一次提醒:「${best.inst.activity}」${when} ${hh}:${mm}(活动 ${best.inst.start}-${best.inst.end}${best.inst.place ? ' ' + best.inst.place : ''})`)
|
|
998
1013
|
}
|
|
999
1014
|
lines.push(`💾 已订阅群:${(subs.get(ALL) || new Map()).size} 个`)
|
|
1015
|
+
if (acts.errors && acts.errors.length) {
|
|
1016
|
+
lines.push(`⚠️ 有 ${acts.errors.length} 行看不懂、已忽略(检查写法:星期 开始-结束,时间要 HH:MM):`)
|
|
1017
|
+
for (const e of acts.errors.slice(0, 5)) lines.push(` ✗ ${e}`)
|
|
1018
|
+
}
|
|
1000
1019
|
const fired = Object.keys(firedToday).filter(k => k !== 'date')
|
|
1001
1020
|
lines.push(`📤 今天已发过的提醒(${firedToday.date || todayStr(now)}):${fired.length ? fired.join('、') : '无'}`)
|
|
1002
1021
|
return lines.join('\n')
|
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.6",
|
|
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": [
|
|
@@ -37,3 +37,4 @@
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
|