skip to Main Content

I use wtelegramclient library to sign in a telegram account via api
WTelegramClient saves (typically in the encrypted file binWTelegram.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

Answers


  1. 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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search