public override BotMessage BuildMsg() { NotificationList = NotificationFunction.NotificationList(); base.PageSize = 5; Pages = base.BuildDataPage <MyTelegramBot.Notification>(NotificationList, base.PageSize); CreateNotificationBtn = BuildInlineBtn("Создать рассылку", BuildCallData(NotificationBot.NotificationCreateCmd, NotificationBot.ModuleName)); MessageReplyMarkup = PageNavigatorKeyboard <MyTelegramBot.Notification>(Pages, NotificationBot.NotificationViewCmd, NotificationBot.ModuleName, BackToAdminPanelBtn(), new InlineKeyboardButton[] { CreateNotificationBtn }); base.TextMessage = "Список рассылок:" + NewLine() + NewLine(); if (Pages != null && Pages.Count > 0 && Pages.Count >= SelectPageNumber && Pages[SelectPageNumber] != null) { var page = Pages[SelectPageNumber]; foreach (var notifi in page) { base.TextMessage += "Рассылка №" + notifi.Id.ToString() + " /notifi" + notifi.Id.ToString() + NewLine() + "Дата:" + notifi.DateAdd.ToString() + NewLine() + NewLine(); } } return(this); }
private async Task <IActionResult> AddNotifi() { var list = NotificationFunction.NotificationList(); if (list.LastOrDefault() != null && list.LastOrDefault().DateAdd.Value.Year == DateTime.Now.Year && list.LastOrDefault().DateAdd.Value.DayOfYear == DateTime.Now.DayOfYear) { await SendMessage(new BotMessage { TextMessage = "Сегодня уже была сделана рассылка. Попробуйте завтра" }); } else { string text = base.ReplyToMessageText; var notifi = NotificationFunction.InsertNotification(text, FollowerId); BotMessage = new EditorNotificationMessage(notifi); await SendMessage(BotMessage.BuildMsg()); } return(OkResult); }