static int Main(string[] args) { try { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); AppDomain.CurrentDomain.ProcessExit += (s, e) => { logger.LogInformation("Process exit"); cancellationTokenSource.Cancel(); }; IConfiguration configuration = (new ConfigurationBuilder()).AddUserSecrets(Assembly.GetExecutingAssembly()).Build(); RemindersRepository = new Repository.DB.ReminderDbRepository(); ITelegramBotClient telegramClient = new TelegramBotClient(configuration["token"]); ConversationHolder conversationHolder = new ConversationHolder(); telegramClient.OnUpdate += conversationHolder.OnUpdate; telegramClient.OnReceiveError += conversationHolder.OnApiError; telegramClient.OnReceiveGeneralError += conversationHolder.OnError; telegramClient.StartReceiving(new UpdateType[] { UpdateType.Message, UpdateType.CallbackQuery }, cancellationTokenSource.Token); NotificationSender notificationSender = new NotificationSender(telegramClient); notificationSender.SendNotificationsAsync(cancellationTokenSource.Token); cancellationTokenSource.Token.WaitHandle.WaitOne(); } catch (Exception ex) { logger.LogError(ex.ToString()); } return(0); }
IEnumerator ConversationCoroutine() { if (conversations.Count > 0) { ConversationHolder tmpConversationHolder = conversations.Dequeue(); UI_Base.Instance.DialogDisplayer.SetConversationSettings(tmpConversationHolder.speaker.Icon, tmpConversationHolder.dialog); } else { InGameEvents.OnDialogEndedFunction(); UI_Base.Instance.DialogDisplayer.SetDialogBox(false); } yield return(null); }