scheduler for discord
Latest: v1.0.0
Schedule (⏰) — Natural-language scheduling for Moltbot
What it does
Turns “remind me later / every day at…” requests into Moltbot cron jobs. When invoked from Discord, it captures the current channel ID at creation time and bakes it into the job, so delivery works even though cron runs have no “current channel”. Uses isolated agent jobs to avoid main-session cron constraints and to ensure reliable background execution. Avoids ambiguous Discord targets (e.g. #test) by always delivering to an explicit channel:. Examples
One-shot reminder (Discord): “Remind me in 2 minutes: stand up and stretch.” Daily plan (Discord): “Every day at 8pm, send tomorrow’s work plan.” Weekly report (Discord): “Every Monday at 9am, post a short weekly goals checklist.” Result
A cron job is created and later delivers the message (or generated content) back into the same Discord channel automatically.
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.
