-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAiogramBotTemplate.py
More file actions
30 lines (23 loc) · 835 Bytes
/
AiogramBotTemplate.py
File metadata and controls
30 lines (23 loc) · 835 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
29
30
import logging
from asyncio import run
from aiogram import Bot, Dispatcher
from aiogram.filters import CommandStart, Command
from aiogram.types import Message
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
bot = Bot("TOKEN", default = DefaultBotProperties(parse_mode = ParseMode.HTML))
dp = Dispatcher()
@dp.message(CommandStart())
async def cmd_start(message: Message):
await message.answer("Привет!")
@dp.message(Command("help"))
async def cmd_help(message: Message):
await message.answer("Помощь")
@dp.message()
async def echo(message: Message):
await message.answer(message.text)
async def main() -> None:
await bot.delete_webhook(True)
await dp.start_polling(bot)
logging.basicConfig(level=logging.INFO)
run(main())