aiogram/docs/api/index.md

36 lines
1.6 KiB
Markdown
Raw Normal View History

# Overview
2020-01-16 17:32:26 +05:00
**aiogram** now is fully support of [Telegram Bot API v4.5](https://core.telegram.org/bots/api)
2019-12-03 13:12:39 +02:00
All API methods and types is fully autogenerated from Telegram Bot API docs by parser with code-generator.
Package: `aiogram.api`
## Methods
2019-12-03 13:12:39 +02:00
All API methods is wrapped as [pydantic](https://pydantic-docs.helpmanual.io/) models and placed in `aiogram.api.methods` package so that's mean all values which you pass as arguments to the methods will be validated.
Here is all methods is classes and in due to Python standards all classes named in upper camel case, for example methods `sendMessage` has the name `SendMessage`
Also in places where you can send
## Types
2019-12-03 13:12:39 +02:00
All types is also wrapped with [pydantic](https://pydantic-docs.helpmanual.io/) and placed in `aiogram.api.types` package.
In this place makes some more differences with official documentations:
- name `from` was renamed to `from_user` in due to `from` is an keyword in python
- timestamps has `datetime.datetime` type instead of `int`
- InputFile is used for sending files and is not use `pydantic.BaseModel` as base class
2019-12-03 13:10:09 +02:00
## Bot instance
2019-12-03 13:10:09 +02:00
Bot instance can be created from `aiogram.Bot` (`#!python3 from aiogram import Bot`)
Constructor specification:
| Argument | Type | Description |
| --- | --- | --- |
| `token` | `#!python3 str` | Telegram Bot token (Obtained from [@BotFather](https://t.me/BotFather)). |
| `session` | `#!python3 Optional[BaseSession]` | HTTP Client session (For example AiohttpSession). If not specified it will be automatically created. |
| `parse_mode` | `#!python3 Optional[str]` | Default parse mode. If specified it will be propagated into the API methods at runtime. |