mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Allow token to be sent via SMS or telegram
This commit is contained in:
parent
8026bd79dc
commit
bfbc125bbe
|
|
@ -23,6 +23,8 @@ namespace TLSharp.Core
|
||||||
private Session _session;
|
private Session _session;
|
||||||
private List<DcOption> dcOptions;
|
private List<DcOption> dcOptions;
|
||||||
|
|
||||||
|
public enum sms_type { numeric_code_via_sms = 0, numeric_code_via_telegram = 5 }
|
||||||
|
|
||||||
public TelegramClient(ISessionStore store, string sessionUserId, int apiId, string apiHash)
|
public TelegramClient(ISessionStore store, string sessionUserId, int apiId, string apiHash)
|
||||||
{
|
{
|
||||||
_apiHash = apiHash;
|
_apiHash = apiHash;
|
||||||
|
|
@ -92,7 +94,7 @@ namespace TLSharp.Core
|
||||||
return authCheckPhoneRequest._phoneRegistered;
|
return authCheckPhoneRequest._phoneRegistered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> SendCodeRequest(string phoneNumber)
|
public async Task<string> SendCodeRequest(string phoneNumber, sms_type tokenDestination = sms_type.numeric_code_via_telegram)
|
||||||
{
|
{
|
||||||
var completed = false;
|
var completed = false;
|
||||||
|
|
||||||
|
|
@ -100,7 +102,7 @@ namespace TLSharp.Core
|
||||||
|
|
||||||
while (!completed)
|
while (!completed)
|
||||||
{
|
{
|
||||||
request = new AuthSendCodeRequest(phoneNumber, 5, _apiId, _apiHash, "en");
|
request = new AuthSendCodeRequest(phoneNumber, (int)tokenDestination, _apiId, _apiHash, "en");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue