init commit

This commit is contained in:
2025-07-16 06:10:22 +09:00
commit c3b9a4cda1
7 changed files with 125 additions and 0 deletions

30
main.py Normal file
View File

@@ -0,0 +1,30 @@
import asyncio
import os
from aiogram import Bot, Dispatcher, F
from aiogram.types import Message
from aiogram.enums import ParseMode
from dotenv import load_dotenv
from aiogram.client.default import DefaultBotProperties
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,
default=DefaultBotProperties(parse_mode=ParseMode.HTML)
)
dp = Dispatcher()
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())