Comments (4)
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.
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.
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.
Wonderful and very quick solution
from telebot.
Related Issues (20)
- Wrong response from the webhook: 403 Forbidden HOT 1
- Clean up political shit from where it's fucked up like no place HOT 1
- Method answerInlineQuery missing in PHPDoc
- WebApps support HOT 1
- Invalid handler type HOT 1
- Error Handling HOT 4
- get error when use many hendlers in laravel HOT 2
- How can I make a Menu button which opening a web app? HOT 2
- Ошибка в документации HOT 1
- Can't run 2.0 on PHP 7.4 HOT 1
- Tests are failing when using handleUpdate() in loop HOT 2
- Cannot cast value of type NULL to type string in Inline mode HOT 3
- [Cannot cast value of type NULL to type string error in Inline mode] HOT 6
- Upgrading from v1 to v2.4 HOT 2
- [BUG] message thread not found HOT 2
- [BUG] Declaration of Handler::write(array $record): void must be compatible with AbstractProcessingHandler::write(Monolog\LogRecord $record): void HOT 7
- Can you provide an example of a bot with laravel? HOT 1
- [BUG] Argument #1 ($bot) must be of type TeleBot, WeStacks\TeleBot\TeleBot given HOT 1
- Error in RequestInputHandler while executing $this->acceptInput()
- Laravel telebot config on database
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telebot.