public static MessagePhoto GetPhoto(TelegramBotClient bot, Message mes, PhotoQuality quality = PhotoQuality.High) { if (bot == null || mes == null || mes.Type != MessageType.Photo) { return(null); } int qualityIndex = (int)Math.Round(((int)quality) / ((double)PhotoQuality.High) * mes.Photo.Length - 1); string fileId = null; fileId = mes.Photo[qualityIndex].FileId; MessagePhoto photo = new MessagePhoto(); photo.File = GetFile(bot, mes, fileId); return(photo); }
/// <summary> /// Получаем фотку из сообщения. /// </summary> /// <param name="quality"></param> /// <returns></returns> public MessagePhoto GetMessagePhoto(PhotoQuality quality) { return(HelperBot.GetPhoto(this.Bot, this.baseMessage, quality)); }