Idea for multiple Telegram Bots on a single installation
- Dominant language
- PHP
- Stars
- 332
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
I have multiple small Telegram bots that do, mostly, useless crap.
IMHO have a BotMan studio running for each of my small bots it's an overkill.
I'll try to explain my idea to support multiple telegram bots with one single BotMan Studio installation.
I'm not a Laravel expert and what I would like to know it's if this can be done or maybe there is a better way to do it.
The main issue is the Telegram Token. If we could load dynamically that, then, probably, BotMan Studio would work without any additional trouble.
My idea is this:
Change the Telegram webook from:
https://yourapp.domain/botman
to
https://yourapp.domain/botman/{botusername}
Change the routing to something like this (changing also the $except on class VerifyCsrfToken):
`Route::match(['get', 'post'], '/botman/{botusername?}', 'BotManController@handle');`
Then on BotMan Studio .env map each token like this:
```
TELEGRAM_TOKEN_MY_BOT_USERNAME1 =
TELEGRAM_TOKEN_MY_BOT_USERNAME2 =
...
```
At this point when we land on the route https://yourapp.domain/botman/{botusername} we set the {botusername} 'somewhere' and then use that to load the Telegram Token dynamically inside the TelegramDriver class.
Does this make any sense or there is a simpler way to achieve the same result?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.