Example #1
0
        /// <summary>
        /// <para>1. Sends photos and text about board</para>
        /// <para>2. Adds photos and text history to the user</para>
        /// </summary>
        /// <param name="board">dfdf</param>
        /// <param name="user"></param>
        /// <param name="client"></param>
        /// <returns></returns>
        public static async Task SendInfoAbout(LongBoard board, BotUser user, TelegramBotClient client)
        {
            var lbInfoPatternTask = Texts.GetLongBoardInfoText();

            var chatId   = user.ChatId;
            var info     = GetInfo(board.Style, BoardsDirectory);
            var textFile = info.First(i => i.Name == LBInfoFileName);

            var textTask             = ReadAllTextAsync(textFile.FullName);
            var waitForPhotosMsgTask = client.SendTextMessageAsync(chatId, PhotosAreBeingSentText);
            var photosMsgTask        = SendLBExistingPhotos(chatId, client, board.Style);

            await Task.WhenAll(waitForPhotosMsgTask, photosMsgTask, textTask, lbInfoPatternTask);

            var toSend  = Format(lbInfoPatternTask.Result, board.Price, textTask.Result);
            var textMsg = await client.SendTextMessageAsync(chatId, toSend);

            user.History.AddMessages(photosMsgTask.Result, false);
            user.History.AddMessage(textMsg, false);
            user.History.AddMessage(waitForPhotosMsgTask.Result, false);
        }