Custom Commands homeCustom Commands
  • Blog
  • Privacy
  • Premium
  • Support
Back to blog
// blog

Create jobs that keeps running after interval in custom commands bot

If you want to create a repeating job that keeps running until cancelled

Md Shahriyar Alam

2 years ago

·1 min read

In custom commands bot jobs run automatically after a given amount time, once a job is started it will keep running itself on the given interval until its cancelled

For example lets say you want to run a clock event every hour

py
await start_job(
  custom_id="hourly_job",
  freq="hour",
  interval=1,
  minute=0,
  second=0
)

This codes run the clock event with hourly_job once every hour (because interval is 1), if you want to run every 2 hour, just make interval=2 so it run once in every 2 hour

What about every day? Simple…

py
await start_job(
  custom_id="daily_job",
  freq="day",
  interval=1,
  hour=12,
  minute=0,
  second=0
)

Every week

py
await start_job(
  custom_id="weekly_job",
  freq="week",
  day_name="sunday",
  interval=1,
  hour=12,
  minute=0,
  second=0
)
# every sunday 12:00:00

Every month

py
await start_job(
  custom_id="monthly_job",
  freq="month",
  interval=1,
  date=1,
  hour=12,
  minute=0,
  second=0
)
# every month's 1st day, 12:00:00

Every year

py
await start_job(
  custom_id="yearly_job",
  freq="year",
  interval=1,
  month=1,
  date=1,
  hour=12,
  minute=0,
  second=0
)
# every year 1st January, 12:00:00

Loading comments…

{}

Need help?

Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.

DiscordJoin support server
Custom CommandsCustom Commands

The #1 custom commands Discord bot — build commands, events and databases with zero boilerplate.

Links

HomeBlogPrivacySupport

Contact

[email protected]

2 Frederick StreetLondon, WC1X 0ND

{ / } custom commands

© WEiRDSOFT LTD. All rights reserved.