-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmini.py
More file actions
28 lines (22 loc) · 755 Bytes
/
Copy pathmini.py
File metadata and controls
28 lines (22 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os, asyncio
from dotenv import load_dotenv
from aiogram import Bot, Dispatcher, Router
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
from aiogram.filters import Command
from aiogram.types import Message
load_dotenv()
TOKEN = os.getenv("TELEGRAM_TOKEN") or os.getenv("BOT_TOKEN")
assert TOKEN, "нет TELEGRAM_TOKEN/BOT_TOKEN в .env"
bot = Bot(TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
dp = Dispatcher()
router = Router()
@router.message(Command("start"))
async def start(m: Message):
await m.answer("Я жив 👋")
dp.include_router(router)
async def main():
print("polling…")
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())