public static async Task <bool> SendLongBoards(TelegramBotClient client, long chatId, IList <ChatMessage> msgStorage, IEnumerable <LongBoard> boardsToIgnore = null) { if (boardsToIgnore == null) { boardsToIgnore = Enumerable.Empty <LongBoard>(); } var neededFiles = AllLBs.Where(i => !boardsToIgnore.Any(j => j.Style == i.NameWithoutExt())).ToArray(); var success = neededFiles.Length >= 1; if (!success) { var msg1 = await client.SendTextMessageAsync(chatId, NoMoreStylesText); msgStorage.AddMessage(msg1, false); return(success); } else { var msg1 = await client.SendTextMessageAsync(chatId, PhotosAreBeingSentText); msgStorage.AddMessage(msg1, false); await client.SendChatActionAsync(chatId, Telegram.Bot.Types.Enums.ChatAction.UploadPhoto); } var msgsTask = SendPhotos(chatId, client, neededFiles); var buttons = GetButtons(neededFiles).ToArray(); var myReplyMarkup = new ReplyKeyboardMarkup(buttons, resizeKeyboard: true, oneTimeKeyboard: true); await msgsTask; var msg = await client.SendTextMessageAsync(chatId, ChooseLongBoardText, replyMarkup : myReplyMarkup); // now process the result. Add messages to history. msgStorage.AddMessage(msg, false); msgStorage.AddMessages(msgsTask.Result, false); return(success); }
public static bool ExistsLongBoard(string text) => AllLBs.Any(i => i.Name.Contains(text));