Exemplo n.º 1
0
 public RemoveRssInstruction(ITelegramBotClient telegramBotClient, CallbackQueryEventArgs callbackQueryEventArgs, BotPlatform botPlatform)
 {
     _telegramBotClient           = telegramBotClient;
     _callbackQueryEventArgs      = callbackQueryEventArgs;
     _queryRssService             = botPlatform.Resolve <IQueryRssService>();
     _queryRssChatRelationService = botPlatform.Resolve <IQueryRssChatRelationService>();
 }
        public BotKickedException(Exception exception, MessagingPlatform messagingPlatform)
        {
            if (exception.Message.Equals(BOT_KICKED))
            {
                IQueryRssChatRelationService   queryRssChatRelationService   = messagingPlatform.Resolve <IQueryRssChatRelationService>();
                ICommandRssChatRelationService commandRssChatRelationService = messagingPlatform.Resolve <ICommandRssChatRelationService>();

                Response <IList <RssChatRelationEntity> > response = queryRssChatRelationService.GetList(LifeTimeCycle.LifeTimeCycle.ExceptionChat);
                foreach (var item in response.ResponseData)
                {
                    commandRssChatRelationService.Remove(item);
                }

                return;
            }
            //new Exception(exception);
        }
Exemplo n.º 3
0
        public static void SyncList(ReaderPlatform readerPlatform)
        {
            _queryRssChat = readerPlatform.Resolve <IQueryRssChatRelationService>();
            var datas = _queryRssChat.GetList().ResponseData;

            RssList = RssList.Where(x => datas.Select(y => y.Id).Contains(x.Key.Id)).ToDictionary(x => x.Key, y => y.Value);

            foreach (var item in datas)
            {
                if (RssList.Select(x => x.Key.Id).Contains(item.Id))
                {
                    continue;
                }
                else
                {
                    RssList.Add(item, DateTimeOffset.Now);
                }
            }
        }
Exemplo n.º 4
0
 public static void Load(ReaderPlatform readerPlatform)
 {
     _queryRssChat = readerPlatform.Resolve <IQueryRssChatRelationService>();
     RssList       = _queryRssChat.GetList().ResponseData.ToDictionary(x => x, x => DateTimeOffset.Now);
 }