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); }
public void Execute() { Session session = SessionHelper.GetSession(_callbackQueryEventArgs.CallbackQuery.From.Id); if (session.InstructionId.Equals(NextInstruction.RemoveChannelGroupFromRss)) { Response <RssChatRelationEntity> rss = _queryRssChatService.Get(Convert.ToInt32(_callbackQueryEventArgs.CallbackQuery.Data.Substring(11, _callbackQueryEventArgs.CallbackQuery.Data.Length - 11))); Response <int> response = _commandRssChatService.Remove(rss.ResponseData); if (response.ResponseData.Equals(0) || response.Type.Equals(ResponseType.NotFound)) { _telegramBotClient.SendTextMessageAsync(_callbackQueryEventArgs.CallbackQuery.From.Id, "chosen rss is not found."); } else { _telegramBotClient.SendTextMessageAsync(_callbackQueryEventArgs.CallbackQuery.From.Id, "successfully done."); } session.UrlId = 0; } else { _telegramBotClient.SendTextMessageAsync(_callbackQueryEventArgs.CallbackQuery.From.Id, "choose rss first."); } }