This commit is contained in:
4
main.py
4
main.py
@@ -10,10 +10,12 @@ load_dotenv()
|
||||
|
||||
BOT_TOKENS = os.getenv("BOT_TOKENS", "").split(",")
|
||||
|
||||
|
||||
async def send_echo_message(message: Message, bot: Bot):
|
||||
me = await bot.get_me()
|
||||
await message.answer(f"Это бот {me.username}, вы написали \"{message.text}\"")
|
||||
|
||||
|
||||
async def start_bot(token: str):
|
||||
bot = Bot(
|
||||
token,
|
||||
@@ -23,8 +25,10 @@ async def start_bot(token: str):
|
||||
dp.message.register(send_echo_message, F.text)
|
||||
await dp.start_polling(bot)
|
||||
|
||||
|
||||
async def main():
|
||||
await asyncio.gather(*(start_bot(token) for token in BOT_TOKENS if token))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user