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.

Last updated 2026-09-06

FAQ

Do scheduled restarts drop my bot's data?

No. Only the process restarts, and the /app volume stays untouched.

Can I run a schedule on the free plan?

Platform schedules are a Lite and Pro feature. A task loop inside your bot works on Free.

What timezone does the scheduler use?

It stores UTC and renders in the timezone on your account page, which is also what every other timestamp on the site uses.

Will a restart interrupt a command mid-flight?

The process gets a termination signal first and a few seconds to finish. Handle the signal if you have work worth finishing.