2

I use wtelegramclient library to sign in a telegram account via api
WTelegramClient saves (typically in the encrypted file bin\WTelegram.session) its state and the authentication keys that were negociated with Telegram so that you needn't sign-in again every time.
But I want save with other path name and load it
So How to do it?
Thanks

2 Answers2

3

add

case "session_pathname": return "sessions/filename.session";

to your config like this:

 string Config(string what)
    {
        switch (what)
        {   
            case "api_id": return Properties.Settings.Default.api_id;
            case "api_hash": return Properties.Settings.Default.api_hash;
            case "phone_number": return Properties.Settings.Default.phone_number;
            case "session_pathname": return "sessions/filename.session";
            case "verification_code":
            case "password":
                BeginInvoke(new Action(() => CodeNeeded(what.Replace('_', ' '))));
                _codeReady.Reset();
                _codeReady.Wait();
                return textBoxCode.Text;
            default: return null;
        };

    }

sessions is the folder the filename.session is stored in

this will be in your bin/debug folder

Amospikins
  • 126
  • 5
0

By default, the WTelegram.session file is saved in the bin subfolder or at the root of your project.

In order to change its name and location, you just need to reply something to "session_pathname" instead of null in your Config callback.

See also this FAQ for more information around this subject

Wizou
  • 1,336
  • 13
  • 24