Scheduler (cron)
This skill schedules future actions using Moltbotâs cron CLI (via exec), defaulting to delivering the result back into the current Discord channel when available.
What to collect
- When: either a one-shot time (
in 2 minutes,at 20:00) or a recurring schedule (every day at 20:00). - Timezone: ask if ambiguous; otherwise prefer the gateway hostâs timezone.
- What: what the message should say, or what should be generated.
- Where:
- If the request came from Discord, use the message contextâs channel id and set delivery target to
channel:<id>. - If the request came from another surface (webchat/terminal), ask for a destination (Discord channel ID, Telegram chat ID, etc).
- If the request came from Discord, use the message contextâs channel id and set delivery target to
Key rules
- Cron jobs run in the background, so there is no âcurrent channelâ at execution time. Always capture the channel id at creation time and bake it into the cron job (
--channel discord --to channel:<id>). - Use an isolated agent job for scheduled messages (prevents the âMain jobs require --system-eventâ error).
- Avoid ambiguous Discord names like
#test; always deliver to an explicitchannel:<id>oruser:<id>.
Implementation (use exec)
One-shot message to the current Discord channel
If the user says âremind me in 2 minutesâ (or similar), schedule a one-shot isolated agent job:
moltbot cron add \
--name "<short-name>" \
--session isolated \
--at 2m \
--agent main \
--message "<message text>" \
--deliver \
--channel discord \
--to channel:<DISCORD_CHANNEL_ID> \
--delete-after-run
Notes:
--ataccepts2m,20m,1h, or an ISO timestamp. Do not use+2m.
Daily âtomorrow planâ at 20:00 (recurring)
If the user says âevery day at 8pm, send me tomorrowâs work planâ, create a recurring cron job that instructs the agent to generate the plan and deliver it:
moltbot cron add \
--name "tomorrow-plan" \
--session isolated \
--cron "0 20 * * *" \
--tz "Asia/Shanghai" \
--agent main \
--message "At execution time, write tomorrow's work plan. Keep it concise. Include: priorities, schedule blocks, risks, and a short checklist." \
--deliver \
--channel discord \
--to channel:<DISCORD_CHANNEL_ID>
Verify
moltbot cron list
moltbot cron runs --id <JOB_ID>
How to find the current Discord channel id
When the user request comes from Discord, the message context includes channel identifiers (e.g. channel=... / discord channel id ...). Use that value for channel:<id>.
If the context does not include it, ask the user to provide a Discord message link (from which you can extract the channel id), or the channel id directly.