diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs index 3406ee9..4888143 100644 --- a/TLSharp.Core/TelegramClient.cs +++ b/TLSharp.Core/TelegramClient.cs @@ -258,11 +258,19 @@ namespace TLSharp.Core return await SendRequestAsync(req); } - public async Task GetUserDialogsAsync() + public async Task GetUserDialogsAsync(int offset_date = 0, int offset_id = 0, TLAbsInputPeer offset_peer = null, int limit = 100) { - var peer = new TLInputPeerSelf(); - return await SendRequestAsync( - new TLRequestGetDialogs() { OffsetDate = 0, OffsetPeer = peer, Limit = 100 }); + if (!IsUserAuthorized()) + throw new InvalidOperationException("Authorize user first!"); + + var req = new TLRequestGetDialogs() + { + OffsetDate = offset_date, + OffsetId = offset_id, + OffsetPeer = offset_peer, + Limit = limit + }; + return await SendRequestAsync(req); } public async Task SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption) @@ -313,7 +321,10 @@ namespace TLSharp.Core await _sender.SendPingAsync(); } - public async Task GetHistoryAsync(TLAbsInputPeer peer, int offset, int max_id, int limit) + /// + /// messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:date add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages + /// + public async Task GetHistoryAsync(TLAbsInputPeer peer, int offset_id = 0, int offset_date = 0, int add_offset = 0, int limit = 100, int max_id = 0, int min_id = 0) { if (!IsUserAuthorized()) throw new InvalidOperationException("Authorize user first!"); @@ -321,9 +332,12 @@ namespace TLSharp.Core var req = new TLRequestGetHistory() { Peer = peer, - AddOffset = offset, + OffsetId = offset_id, + OffsetDate = offset_date, + AddOffset = add_offset, + Limit = limit, MaxId = max_id, - Limit = limit + MinId = min_id }; return await SendRequestAsync(req); }