Sapphire Scheduled Tasks | When do they launch after bot restarts?
I have a task that disables all message components. But this fails to run after bot restarts and trying to run it
Logs:
2024-05-15 02:54:54 - INFO - @yume/sapphire-utilities registered successfully! // preInit2024-05-15 02:54:55 - ERROR - [ScheduledTaskPlugin] There was no task found for "DisableMessageComponents"2024-05-15 02:54:56 - INFO - @yume/sapphire-utilities/tasks registered successfully! // postLogin
2024-05-15 02:54:54 - INFO - @yume/sapphire-utilities registered successfully! // preInit2024-05-15 02:54:55 - ERROR - [ScheduledTaskPlugin] There was no task found for "DisableMessageComponents"2024-05-15 02:54:56 - INFO - @yume/sapphire-utilities/tasks registered successfully! // postLogin
I setup it to load only on
postLogin
postLogin
because in task I need to fetch channel & message, and obv I can't do that when bot is not ready. Seems like
ScheduledTaskPlugin
ScheduledTaskPlugin
trying to run tasks that was on redis before postLogin step if you restart your bot Is there a way to change that? :Hmm:
My custom plugin that loads this task to my bots:
export class CustomSapphireScheduledTasks extends Plugin { public static [postLogin](this: SapphireClient) { loadScheduledTasks() container.logger.info(`@yume/sapphire-utilities/tasks registered successfully!`) }}SapphireClient.plugins.registerPostLoginHook( CustomSapphireScheduledTasks[postLogin], "CustomSapphireScheduledTasks-postLogin")
export class CustomSapphireScheduledTasks extends Plugin { public static [postLogin](this: SapphireClient) { loadScheduledTasks() container.logger.info(`@yume/sapphire-utilities/tasks registered successfully!`) }}SapphireClient.plugins.registerPostLoginHook( CustomSapphireScheduledTasks[postLogin], "CustomSapphireScheduledTasks-postLogin")