Answer the question
In order to leave comments, you need to log in
How to run multiple copies of telegram bots with different tokens?
How to run multiple copies of telegram bots with different tokens?
Example code on aiogram. There is an example on the webhook, but this option does not suit me.
bot = Bot(token=config.BOT_TOKEN, parse_mode=types.ParseMode.HTML)
dp = Dispatcher(bot, storage=MemoryStorage())
async def on_startup(dp):
filters.setup(dp)
middlewares.setup(dp)
await set_default_commands(dp)
if __name__ == "__main__":
create_bdx()
executor.start_polling(dp, on_startup=on_startup)
Answer the question
In order to leave comments, you need to log in
If the option with webhooks is not suitable at all (there is an example here ), then there are several possible options:
1) Run several Docker containers with different environments, and pass the token as the TELEGRAM_TOKEN environment variable;
2) Run bots in separate threads ( threading module ), with the ability to synchronize if necessary.
3) Write your own Event Loop on asyncio, in which you can access the cart API using different tokens and request updates.
How many possibilities!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question