diff --git a/src/TgSharp.Core/TelegramClient.cs b/src/TgSharp.Core/TelegramClient.cs index 0593697..8858134 100644 --- a/src/TgSharp.Core/TelegramClient.cs +++ b/src/TgSharp.Core/TelegramClient.cs @@ -336,13 +336,18 @@ namespace TgSharp.Core .ConfigureAwait(false); } - public async Task SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, CancellationToken token = default(CancellationToken)) + public async Task SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string message, CancellationToken token = default(CancellationToken)) { + if (String.IsNullOrEmpty(message)) { + throw new ArgumentNullException (nameof (message)); + } + return await SendAuthenticatedRequestAsync(new TLRequestSendMedia() { RandomId = Helpers.GenerateRandomLong(), Background = false, ClearDraft = false, + Message = message, Media = new TLInputMediaUploadedPhoto() { File = file }, Peer = peer }, token) diff --git a/src/TgSharp.Tests.NUnit/Test.cs b/src/TgSharp.Tests.NUnit/Test.cs index 79f46ac..9a15d58 100644 --- a/src/TgSharp.Tests.NUnit/Test.cs +++ b/src/TgSharp.Tests.NUnit/Test.cs @@ -36,7 +36,6 @@ namespace TgSharp.Tests } [Test] - [Ignore("Untested in CI")] public override async Task SendPhotoToContactTest() { await base.SendPhotoToContactTest(); diff --git a/src/TgSharp.Tests/TgSharpTests.cs b/src/TgSharp.Tests/TgSharpTests.cs index 4d8cb97..576389c 100644 --- a/src/TgSharp.Tests/TgSharpTests.cs +++ b/src/TgSharp.Tests/TgSharpTests.cs @@ -206,7 +206,7 @@ namespace TgSharp.Tests .FirstOrDefault(x => x.Phone == NumberToSendMessage); var fileResult = (TLInputFile)await client.UploadFile("cat.jpg", new StreamReader("data/cat.jpg")); - await client.SendUploadedPhoto(new TLInputPeerUser() { UserId = user.Id }, fileResult); + await client.SendUploadedPhoto(new TLInputPeerUser() { UserId = user.Id }, fileResult, "cat"); } public virtual async Task SendBigFileToContactTest()