mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 07:50:32 +00:00
3.7 KiB
3.7 KiB
Overview
Documentation for version 3.0 [WIP] 1
aiogram modern and fully asynchronous framework for Telegram Bot API written in Python 3.7 with asyncio and aiohttp. It helps you to make your bots faster and simpler.
Features
- Asynchronous
- Supports Telegram Bot API v{!_api_version.md!}
- Updates router (Blueprints)
- Finite State Machine
- Middlewares
- Replies into Webhook
!!! note Before start using aiogram is highly recommend to know how to work with asyncio.
Also if you has questions you can go to our community chats in Telegram:
- [English language](https://t.me/aiogram)
- [Russian language](https://t.me/aiogram_ru)
Example
Simple usage
from aiogram import Bot, Dispatcher, types
from aiogram.dispatcher.handler import MessageHandler
TOKEN = "42:TOKEN"
dp = Dispatcher()
@dp.message_handler(commands=["start"])
class MyHandler(MessageHandler):
"""
This handler receive messages with /start command
"""
async def handle(self):
await self.event.answer(f"<b>Hello, {self.from_user.full_name}!</b>")
@dp.message_handler(content_types=[types.ContentType.ANY])
async def echo_handler(message: types.Message, bot: Bot):
"""
Handler will forward received message back to the sender
"""
await bot.forward_message(
from_chat_id=message.chat.id, chat_id=message.chat.id, message_id=message.message_id
)
def main():
bot = Bot(TOKEN, parse_mode="HTML")
dp.run_polling(bot)
if __name__ == "__main__":
main()
Task list for 3.0
- Telegram API features
- Rewrite Telegram types using pydantic
- Rewrite Telegram methods using pydantic
- Rewrite bot class
- Contextual aliases for methods in types
- ...
- Dispatcher features
- Blueprints/Routers
- Refactor FSM
- Refactor filters
- Middlewares
- Tests
- API
- Sessions
- Types
- Methods
- Client
- Dispatcher
- Dispatcher
- Router
- Observers
- Filters
- Utils
- Helper
- Markdown/HTML
- ...
- API
- CI/CD
- Publish to PyPi on tag
- Build docs on push
- Code style
- Test with coverage on pull-request
- Test with coverage on push
- mypy on pull-request
- Flake8 on pull-request
-
work in progress ↩︎