koishi-plugin-reminder
v0.0.1
Published
定时提醒插件:支持 Cron 定时、倒计时(一次性/每年重复)、多群开关、消息模板变量
Readme
koishi-plugin-reminder
定时提醒插件:通过 Cron 表达式定时向指定群组发送自定义消息,支持倒计时功能和模板变量。
功能
- Cron 定时:使用标准 Cron 表达式配置触发时间
- 倒计时:支持一次性日期(
YYYY-MM-DD)和每年重复日期(MM-DD) - 多群开关:每个群组可独立启用/禁用推送
- 消息模板:支持变量替换,自定义消息内容
配置项
定时设置
| 字段 | 类型 | 说明 |
|---|---|---|
| cron | string | Cron 表达式,如 0 8 * * * 表示每天早上 8 点 |
倒计时日期
| 字段 | 类型 | 说明 |
|---|---|---|
| countdownDates[].label | string | 日期名称,如"春节" |
| countdownDates[].date | string | 目标日期。YYYY-MM-DD 为一次性(过了显示 0),MM-DD 为每年重复(如 02-17) |
群组设置
| 字段 | 类型 | 说明 |
|---|---|---|
| groups[].groupId | string | 推送目标 ID,格式 {平台}:{频道ID},如 onebot:123456 |
| groups[].enabled | boolean | 是否启用 |
消息模板
| 字段 | 类型 | 说明 |
|---|---|---|
| messageTemplate | string | 消息内容,支持变量(见下方) |
模板变量
| 变量 | 含义 | 示例 |
|---|---|---|
| {year} | 当前年 | 2026 |
| {month} | 当前月 | 6 |
| {day} | 当前日 | 4 |
| {week} | 星期几 | 四 |
| {d0}~{dN} | 距第 N 个倒计时的天数 | 258 |
| {d0-label} | 第 N 个倒计时的名称 | 春节 |
| {d0-date} | 第 N 个倒计时的日期 | 2026-02-17 |
指令
reminder.test— 预览当前消息模板的渲染结果reminder.list— 查看所有倒计时状态
示例配置
reminder:rem1nd:
cron: '0 8 * * *'
countdownDates:
- label: 春节
date: '02-17'
- label: 国庆节
date: '10-01'
groups:
- groupId: 'onebot:123456'
enabled: true
messageTemplate: |
今天是{year}年{month}月{day}日 星期{week}
距离{d0-label}还有{d0}天
距离{d1-label}还有{d1}天