From b5a816951b8155e992f51e38dd279158c960f57b Mon Sep 17 00:00:00 2001 From: CheshireCaat Date: Thu, 23 Jan 2020 08:31:40 +0300 Subject: [PATCH] Add UpdateUsernameAsync method. Add CheckUsernameAsync method. --- TLSharp.Core/TelegramClient.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs index d86b349..ffc334c 100644 --- a/TLSharp.Core/TelegramClient.cs +++ b/TLSharp.Core/TelegramClient.cs @@ -234,6 +234,26 @@ namespace TLSharp.Core return (T)result; } + public async Task UpdateUsernameAsync(string username) + { + if (!IsUserAuthorized()) + throw new InvalidOperationException("Authorize user first!"); + + var req = new TLRequestUpdateUsername { Username = username }; + + return await SendRequestAsync(req); + } + + public async Task CheckUsernameAsync(string username) + { + if (!IsUserAuthorized()) + throw new InvalidOperationException("Authorize user first!"); + + var req = new TLRequestCheckUsername { Username = username }; + + return await SendRequestAsync(req); + } + public async Task ImportContactsAsync(IReadOnlyList contacts) { if (!IsUserAuthorized())