Git Product home page Git Product logo

Comments (4)

punyflash avatar punyflash commented on June 17, 2024

Hello!
I'm a bit confused what config data you telling about. If you mean bot-config, there is no way to access bot's config from bot instance when it's already created currently. And i'm not sure that this is needed, as you writing config by yourself - if you need some data from config you may store your config as array and use it later as you need it. Or if you are using laravel you may use config('telebot.bots') function to get your all bots configs anywhere from your app.

You can't change config "on the go" by the way. You may change laravel variables using Config::set('key.to.config.var') but bot instances will not be recreated as app creates them as singletons.

From UpdateHandler and CommandHandler you may get current TeleBot instance using $this->bot

from telebot.

rsimonru avatar rsimonru commented on June 17, 2024

Hello.
Thank for quick response. I'm trying to explain better. I'm using Laravel and my question is how to know the bot's local config name or token, for example, in an UpdateHandler. When an update is received, I have $this->update and $this->bot and I can use all Telegram methods, but how I know the related local config for the bot related to Update? With config('telebot.bots') I can access all the bots config, but what is the update's bot config?

from telebot.

punyflash avatar punyflash commented on June 17, 2024

Oh, I see now. I now can imagine condition where you may want to reuse UpdateHandler for different bots and get access to current bot name/token. Yeah, currently you can't do that comfortably as functionality for bot validation is related to BotManager. I think you proposed the best way to do that - just add ability to get bots config from the bot instance using method. This need to be done for sure.

from telebot.

rsimonru avatar rsimonru commented on June 17, 2024

Wonderful and very quick solution

from telebot.

Related Issues (20)

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.