Cron jobs for Discord bots
There are two ways to run something on a schedule: inside your bot with a task loop, or outside it with a platform schedule that restarts or pokes the process. Use the task loop for anything your bot already knows how to do, and a platform schedule for the things it cannot do while it is stuck.
Inside the bot: task loops
Both major libraries ship one, and it works on every plan.
from discord.ext import tasks
@tasks.loop(hours=24)
async def daily_digest():
...
setInterval(() => postDigest().catch(console.error), 24 * 60 * 60 * 1000);
A task loop dies with the process. If a nightly job matters, make it idempotent and check on boot whether it already ran today.
Outside the bot: platform schedules
Scheduled restarts and cron entries are a paid-plan feature (Mini, Lite, Pro or Max; see pricing). They are the right tool for:
- a nightly restart that clears a slow memory leak you have not found yet
- a weekly maintenance command run through your entry file with a flag
- anything that must happen even when the bot is wedged
Schedules are stored in UTC and shown in your account timezone, so a "03:00" restart means 03:00 where you set it, not where the node is.
Related
Last updated 2026-09-06