Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/TgSharp.Core/TelegramClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,18 @@ public bool IsUserAuthorized()
.ConfigureAwait(false);
}

public async Task<TLAbsUpdates> SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, CancellationToken token = default(CancellationToken))
public async Task<TLAbsUpdates> SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string message, CancellationToken token = default(CancellationToken))
{
if (String.IsNullOrEmpty(message)) {
throw new ArgumentNullException (nameof (message));
}

return await SendAuthenticatedRequestAsync<TLAbsUpdates>(new TLRequestSendMedia()
{
RandomId = Helpers.GenerateRandomLong(),
Background = false,
ClearDraft = false,
Message = message,
Media = new TLInputMediaUploadedPhoto() { File = file },
Peer = peer
}, token)
Expand Down
1 change: 0 additions & 1 deletion src/TgSharp.Tests.NUnit/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public override async Task SendMessageToChannelTest()
}

[Test]
[Ignore("Untested in CI")]
public override async Task SendPhotoToContactTest()
{
await base.SendPhotoToContactTest();
Expand Down
2 changes: 1 addition & 1 deletion src/TgSharp.Tests/TgSharpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public virtual async Task SendPhotoToContactTest()
.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()
Expand Down