public static async Task <TelegramClient> ConnectAsync(BotDisguisedAsUserBotInfo userbot) { var apiId = userbot.GetApiId(); if (apiId == null) { return(null); } var t = new TelegramClient(apiId.Value, userbot.GetApiHash(), sessionUserId: userbot.GetSessionUserId()); await t.ConnectAsync(); if (t.IsUserAuthorized()) { return(t); } var r = await t.AuthImportBotAuthorization(userbot.GetToken()); return(r?.User != null ? t : null); }