Code Monkey home page Code Monkey logo

Comments (1)

setiawanhu avatar setiawanhu commented on June 13, 2024

Hi!

Hi, how are sessions stored?

The sessions are stored into a file which contains the serialized danog\MadelineProto\API instance.

Can I run multiple telegram accounts?

Based on this issue you can run multiple telegram accounts by defining different instance with different session file name.

For now, the current wrapper that I made only supporting only 1 telegram session out of the box by defining the session file name at session_file property from telegram.php config file.

But there's a workaround for that. You still can create multiple session instances by doing this following code:

//YourController.php
use danog\MadelineProto\API;
use Hu\MadelineProto\MadelineProto;
use Hu\MadelineProto\ClientMessages;

//...

public function doSomethingWithTelegram() {
   //instantiating new session instance
   $session = new API('your_session_file_path.madeline', config('telegram.settings'));
   
   //then pass the session instance to the wrapper for doing authentication business logic
   $madeline = new MadelineProto($session);

   //or pass the instance's 'messages' property to the messages wrapper for doing some messaging business logic
   //(note: the session must have been authenticated)
   $messaging = new ClientMessages($session->messages);

   //...
}

Hope this helps

from laravel-madeline-proto.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.