private async Task ConnectedHandler() { await _discordAccess.SetCurrentGame("Hand of Unity"); if (_isFirstConnect) { _isFirstConnect = false; await _discordAccess.LogToDiscord($"Bot started on **{_botInformationProvider.GetEnvironmentName()}** in version {_botInformationProvider.GetFormattedVersion()}."); // Start privacy provider clean up _privacyProvider.Start(); // Register background jobs (HangFire). // Sync all users every 15 minutes to UNITS. RecurringJob.AddOrUpdate <IUnitsSyncService>("sync-users-to-UNITS", service => service.SyncAllUsers(), "0,15,30,45 0-23 * * *"); // Sync all users every 15 minutes to UnityHub. RecurringJob.AddOrUpdate <UnityHubSyncService>("sync-users-to-UnityHub", service => service.SyncAllUsers(), "0,15,30,45 0-23 * * *"); // Send personal reminders as scheduled. SchedulePersonalReminders(); // Apply birthday role at 09:00 community time (UTC). RecurringJob.AddOrUpdate <BirthdayService>("birthday-apply-role", service => service.ApplyRoleAsync(), "0 9 * * *"); // Remove birthday role at 23:59 community time (UTC). RecurringJob.AddOrUpdate <BirthdayService>("birthday-revoke-role", service => service.RevokeRoleAsync(), "59 23 * * *"); RecurringJob.AddOrUpdate <IRoleRemover>("remove-basement-role", remover => remover.RemoveBasementRolesAsync(), "0 0-23 * * *"); EstablishUnitsSignalRConnections(); } _logger.LogInformation("Bot ready."); }