Т
Size: a a a
Т
g(
T
tg
BOT1: MyBot1 = MyBot1(token=BOT_TOKEN_1)
BOT2: MyBot2 = MyBot2(token=BOT_TOKEN_2)
tg
tg
@app.post("/webhook/{SECRET_1}",)
async def telegram_webhook(update_raw: Dict[str, Any] = Body(...)) -> Response:
await BOT1.new_update(update_raw=update_raw)
return Response(status_code=status.HTTP_200_OK)
@app.post("/webhook/{SECRET_2}",)
async def telegram_webhook(update_raw: Dict[str, Any] = Body(...)) -> Response:
await BOT2.new_update(update_raw=update_raw)
return Response(status_code=status.HTTP_200_OK)
tg
tg
def __init__(self, token: str):
self.TOKEN: str = token
self.bot: Bot = Bot(token=self.TOKEN, parse_mode="HTML")
self.dispatcher: Dispatcher = Dispatcher(bot=self.bot)
self.dispatcher.register_message_handler(
callback=handlers.start_handler, commands=["start", "help"]
)
self.dispatcher.register_message_handler(
callback=handlers.echo_handler, content_types=types.ContentTypes.TEXT
)
СА
tg
g(
tg
async def new_update(self, update_raw: Dict[str, Any]) -> None:
await self.dispatcher.process_update(types.Update(**update_raw))
СА
Т
AR
async def new_update(self, update_raw: Dict[str, Any]) -> None:
await self.dispatcher.process_update(types.Update(**update_raw))
T
tg
raise RuntimeError("Can't get bot instance from context. "
RuntimeError: Can't get bot instance from context. You can fix it with setting current instance: 'Bot.set_current(bot_instance)'
g(
AR
raise RuntimeError("Can't get bot instance from context. "
RuntimeError: Can't get bot instance from context. You can fix it with setting current instance: 'Bot.set_current(bot_instance)'
tg