Start scheduler after syncing commands
This commit is contained in:
@ -286,12 +286,6 @@ class RemindBotClient(discord.Client):
|
|||||||
|
|
||||||
async def setup_hook(self) -> None:
|
async def setup_hook(self) -> None:
|
||||||
"""Setup the bot."""
|
"""Setup the bot."""
|
||||||
if not scheduler.running:
|
|
||||||
logger.info("Starting the scheduler...")
|
|
||||||
scheduler.start()
|
|
||||||
else:
|
|
||||||
logger.error("Scheduler is already running.")
|
|
||||||
|
|
||||||
scheduler.add_listener(my_listener, EVENT_JOB_MISSED | EVENT_JOB_ERROR)
|
scheduler.add_listener(my_listener, EVENT_JOB_MISSED | EVENT_JOB_ERROR)
|
||||||
jobs: list[Job] = scheduler.get_jobs()
|
jobs: list[Job] = scheduler.get_jobs()
|
||||||
if jobs:
|
if jobs:
|
||||||
@ -309,6 +303,12 @@ class RemindBotClient(discord.Client):
|
|||||||
|
|
||||||
await self.tree.sync(guild=None)
|
await self.tree.sync(guild=None)
|
||||||
|
|
||||||
|
if not scheduler.running:
|
||||||
|
logger.info("Starting the scheduler...")
|
||||||
|
scheduler.start()
|
||||||
|
else:
|
||||||
|
logger.error("Scheduler is already running.")
|
||||||
|
|
||||||
|
|
||||||
def format_job_for_ui(job: Job) -> str:
|
def format_job_for_ui(job: Job) -> str:
|
||||||
"""Format a single job for display in the UI.
|
"""Format a single job for display in the UI.
|
||||||
|
Reference in New Issue
Block a user