Пример #1
0
        private void UpdateAndNotifyContents(Dictionary <ContentType, LinkedList <KidsNoteContent> > newContents)
        {
            Dictionary <ContentType, KidsNoteNotification> notification = new Dictionary <ContentType, KidsNoteNotification>();

            foreach (var each in newContents)
            {
                notification[each.Key]             = new KidsNoteNotification();
                notification[each.Key].ContentType = each.Key;
                notification[each.Key].Receivers   = TheConfiguration.GetSubscribers(each.Key);
                notification[each.Key].Contents    = each.Value;
            }

            try
            {
                TheBot.SendNewContents(notification);
            }
            catch (Exception)
            {
                HandleTelegramError();
            }
        }
        private void UpdateAndNotifyContents(Dictionary <ContentType, LinkedList <KidsNoteContent> > newContents)
        {
            try
            {
                List <Telegram.Bot.Types.ChatId> receivers = new List <Telegram.Bot.Types.ChatId>();
                if (TheConfiguration.SubscriberIdList != null)
                {
                    receivers.AddRange(TheConfiguration.SubscriberIdList);
                }

                if (TheConfiguration.ManagerChatId != (Telegram.Bot.Types.ChatId) 0)
                {
                    receivers.Add(TheConfiguration.ManagerChatId);
                }

                TheBot.SendNewContents(receivers, new Bot.KidsNoteNotifyMessage(newContents));
                UpdateLastNotifiedIds(newContents);
            }
            catch (Exception)
            {
                HandleTelegramError();
            }
        }