mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-04-05 06:25:30 +00:00
A null config value for "verification_code" will show a console prompt. This allows Environment.GetEnvironmentVariable to be used directly as config callback.
This commit is contained in:
parent
87a85bec4b
commit
4f9fbfc12c
4 changed files with 18 additions and 27 deletions
|
|
@ -101,13 +101,14 @@ namespace WTelegram
|
|||
"lang_pack" => "",
|
||||
"lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
|
||||
"user_id" => "-1",
|
||||
_ => null // api_id api_hash phone_number verification_code... it's up to you to reply to these correctly
|
||||
"verification_code" => AskConfig(config),
|
||||
_ => null // api_id api_hash phone_number... it's up to you to reply to these correctly
|
||||
};
|
||||
|
||||
public static string DefaultConfigOrAsk(string config)
|
||||
public static string DefaultConfigOrAsk(string config) => DefaultConfig(config) ?? AskConfig(config);
|
||||
|
||||
private static string AskConfig(string config)
|
||||
{
|
||||
var value = DefaultConfig(config);
|
||||
if (value != null) return value;
|
||||
Console.Write($"Enter {config.Replace('_', ' ')}: ");
|
||||
return Console.ReadLine();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue