From 759c76b899c5db82072597bef22fea60472010f0 Mon Sep 17 00:00:00 2001 From: omarm Date: Thu, 13 Apr 2017 14:07:45 +0300 Subject: [PATCH] Add caption length validation --- TLSharp.Core/TelegramClient.cs | 2 +- TeleSharp.TL/TL/TLInputMediaUploadedPhoto.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs index 036ae8d..3851eaf 100644 --- a/TLSharp.Core/TelegramClient.cs +++ b/TLSharp.Core/TelegramClient.cs @@ -269,7 +269,7 @@ namespace TLSharp.Core random_id = Helpers.GenerateRandomLong(), background = false, clear_draft = false, - media = new TLInputMediaUploadedPhoto() { file = file, caption = caption }, + media = new TLInputMediaUploadedPhoto() { file = file, Caption = caption }, peer = peer }); } diff --git a/TeleSharp.TL/TL/TLInputMediaUploadedPhoto.cs b/TeleSharp.TL/TL/TLInputMediaUploadedPhoto.cs index beb4050..beb9dad 100644 --- a/TeleSharp.TL/TL/TLInputMediaUploadedPhoto.cs +++ b/TeleSharp.TL/TL/TLInputMediaUploadedPhoto.cs @@ -20,8 +20,9 @@ namespace TeleSharp.TL public int flags {get;set;} public TLAbsInputFile file {get;set;} - public string caption {get;set;} - public TLVector stickers {get;set;} + private string caption; + public string Caption { get { return caption; } set { caption = value.Length > 200 ? value.Remove(199, value.Length - 199) : value; } } + public TLVector stickers {get;set;} public void ComputeFlags()