Remove MkDocs

This commit is contained in:
Alex Root Junior 2021-05-13 00:13:09 +03:00
parent 7dd80d281f
commit e1cd7268a1
442 changed files with 4 additions and 9429 deletions

View file

@ -1,7 +1,7 @@
version: 2
sphinx:
configuration: docs2/conf.py
configuration: docs/conf.py
formats: all

View file

@ -39,8 +39,6 @@ help:
@echo " build: Run tests build package and docs"
@echo ""
# =================================================================================================
# Environment
# =================================================================================================
@ -63,7 +61,6 @@ clean:
rm -f .coverage.*
rm -rf {build,dist,site,.cache,.mypy_cache,reports}
# =================================================================================================
# Code quality
# =================================================================================================
@ -109,7 +106,6 @@ test-coverage:
mkdir -p $(reports_dir)/tests/
$(py) pytest --cov=aiogram --cov-config .coveragerc --html=$(reports_dir)/tests/index.html tests/
.PHONY: test-coverage-report
test-coverage-report:
$(py) coverage html -d $(reports_dir)/coverage
@ -123,34 +119,21 @@ test-coverage-view:
# Docs
# =================================================================================================
.PHONY: docs
docs:
$(py) mkdocs build
.PHONY: docs-serve
docs-serve:
$(py) mkdocs serve
.PHONY: docs2-serve
docs2-serve:
rm -rf docs2/_build
$(py) sphinx-autobuild --watch aiogram/ docs2/ docs2/_build/
.PHONY: docs-copy-reports
docs-copy-reports:
mv $(reports_dir)/* site/reports
rm -rf docs/_build
$(py) sphinx-autobuild --watch aiogram/ docs/ docs/_build/
# =================================================================================================
# Project
# =================================================================================================
.PHONY: build
build: clean flake8-report mypy-report test-coverage docs docs-copy-reports
build: clean flake8-report mypy-report test-coverage
mkdir -p site/simple
poetry build
mv dist site/simple/aiogram
.PHONY: bump
bump:
poetry version $(args)

View file

@ -1 +0,0 @@
5.2

View file

@ -1 +0,0 @@
3.0.0a8

View file

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Before After
Before After

View file

@ -1,79 +0,0 @@
# Aiohttp session
AiohttpSession represents a wrapper-class around `ClientSession` from [aiohttp](https://pypi.org/project/aiohttp/ "PyPi repository"){target=_blank}
Currently `AiohttpSession` is a default session used in `aiogram.Bot`
## Usage example
```python
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
session = AiohttpSession()
Bot('token', session=session)
```
## Proxy requests in AiohttpSession
In order to use AiohttpSession with proxy connector you have to install [aiohttp-socks](https://pypi.org/project/aiohttp-socks/ "PyPi repository"){target=_blank}
Binding session to bot:
```python
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
session = AiohttpSession(proxy="protocol://host:port/")
Bot(token="bot token", session=session)
```
!!! note "Protocols"
Only following protocols are supported: http(tunneling), socks4(a), socks5 as aiohttp_socks documentation claims.
### Authorization
Proxy authorization credentials can be specified in proxy URL or come as an instance of `aiohttp.BasicAuth` containing
login and password.
Consider examples:
```python
from aiogram.client.session.aiohttp import BasicAuth
from aiogram.client.session.aiohttp import AiohttpSession
auth = BasicAuth(login="user", password="password")
session = AiohttpSession(proxy=("protocol://host:port", auth))
# or simply include your basic auth credential in URL
session = AiohttpSession(proxy="protocol://user:password@host:port")
```
!!! note "Credential priorities"
Aiogram prefers `BasicAuth` over username and password in URL, so
if proxy URL contains login and password and `BasicAuth` object is passed at the same time
aiogram will use login and password from `BasicAuth` instance.
### Proxy chains
Since [aiohttp-socks]('https://pypi.org/project/aiohttp-socks/') supports proxy chains, you're able to use them in aiogram
Example of chain proxies:
```python
from aiogram.client.session.aiohttp import BasicAuth
from aiogram.client.session.aiohttp import AiohttpSession
auth = BasicAuth(login="user", password="password")
session = AiohttpSession(
proxy={"protocol0://host0:port0",
"protocol1://user:password@host1:port1",
("protocol2://host2:port2", auth), } # can be any iterable if not set
)
```
## Location
- `from aiogram.api.client.session.aiohttp import AiohttpSession`

View file

@ -1,106 +0,0 @@
# How to download file?
## Download file manually
First, you must get the `file_id` of the file you want to download. Information about files sent to the bot is contained in [Message](./types/message.md).
For example, download the document that came to the bot.
```python3
file_id = message.document.file_id
```
Then use the [getFile](./methods/get_file.md) method to get `file_path`.
```python3
file = await bot.get_file(file_id)
file_path = file.file_path
```
After that, use the [download_file](#download_file) method from the bot object.
### download_file(...)
Download file by `file_path` to destination.
If you want to automatically create destination (`#!python3 io.BytesIO`) use default
value of destination and handle result of this method.
|Argument|Type|Description|
|---|---|---|
| file_path | `#!python3 str` | File path on Telegram server |
| destination | `#!python3 Optional[Union[BinaryIO, pathlib.Path, str]]` | Filename, file path or instance of `#!python3 io.IOBase`. For e.g. `#!python3 io.BytesIO` (Default: `#!python3 None`) |
| timeout | `#!python3 int` | Total timeout in seconds (Default: `30`) |
| chunk_size | `#!python3 int` | File chunks size (Default: `64 kb`) |
| seek | `#!python3 bool` | Go to start of file when downloading is finished. Used only for destination with `#!python3 typing.BinaryIO` type (Default: `#!python3 True`) |
There are two options where you can download the file: to **disk** or to **binary I/O object**.
### Download file to disk
To download file to disk, you must specify the file name or path where to download the file. In this case, the function will return nothing.
```python3
await bot.download_file(file_path, "text.txt")
```
### Download file to binary I/O object
To download file to binary I/O object, you must specify an object with the `#!python3 typing.BinaryIO` type or use the default (`#!python3 None`) value.
In the first case, the function will return your object:
```python3
my_object = MyBinaryIO()
result: MyBinaryIO = await bot.download_file(file_path, my_object)
# print(result is my_object) # True
```
If you leave the default value, an `#!python3 io.BytesIO` object will be created and returned.
```python3
result: io.BytesIO = await bot.download_file(file_path)
```
## Download file in short way
Getting `file_path` manually every time is boring, so you should use the [download](#download) method.
### download(...)
Download file by `file_id` or `Downloadable` object to destination.
If you want to automatically create destination (`#!python3 io.BytesIO`) use default
value of destination and handle result of this method.
|Argument|Type|Description|
|---|---|---|
| file | `#!python3 Union[str, Downloadable]` | file_id or Downloadable object |
| destination | `#!python3 Optional[Union[BinaryIO, pathlib.Path, str]]` | Filename, file path or instance of `#!python3 io.IOBase`. For e.g. `#!python3 io.BytesIO` (Default: `#!python3 None`) |
| timeout | `#!python3 int` | Total timeout in seconds (Default: `30`) |
| chunk_size | `#!python3 int` | File chunks size (Default: `64 kb`) |
| seek | `#!python3 bool` | Go to start of file when downloading is finished. Used only for destination with `#!python3 typing.BinaryIO` type (Default: `#!python3 True`) |
It differs from [download_file](#download_file) **only** in that it accepts `file_id` or an `Downloadable` object (object that contains the `file_id` attribute) instead of `file_path`.
!!! note
All `Downloadable` objects are listed in Related pages.
You can download a file to [disk](#download-file-to-disk) or to a [binary I/O](#download-file-to-binary-io-object) object in the same way.
Example:
```python3
document = message.document
await bot.download(document)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getfile)
- [aiogram.types.Animation](types/animation.md)
- [aiogram.types.Audio](types/audio.md)
- [aiogram.types.Document](types/document.md)
- [aiogram.types.File](types/file.md)
- [aiogram.types.PassportFile](types/passport_file.md)
- [aiogram.types.PhotoSize](types/photo_size.md)
- [aiogram.types.Sticker](types/sticker.md)
- [aiogram.types.Video](types/video.md)
- [aiogram.types.VideoNote](types/video_note.md)
- [aiogram.types.Voice](types/voice.md)
- [How to upload file?](upload_file.md)

View file

@ -1,59 +0,0 @@
# Overview
**aiogram** now is fully support of [Telegram Bot API v{!_api_version.md!}](https://core.telegram.org/bots/api)
All API methods and types is fully autogenerated from Telegram Bot API docs by parser with code-generator.
Package: `aiogram.api`
## Methods
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`
Full list of methods can be found in section "[Methods](methods/index.md)"
## Types
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](https://docs.python.org/3/reference/lexical_analysis.html#keywords)
- timestamps has `datetime.datetime` type instead of `int`
- InputFile is used for sending files and is not use `pydantic.BaseModel` as base class
Full list of methods can be found in section "[Types](types/index.md)"
## Bot instance
Bot instance can be created from `aiogram.Bot` (`#!python3 from aiogram import Bot`) and you can't use API methods without instance of bot with configured token.
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. |
This class has aliases for all API methods and named in `lower_camel_case`. For example `sendMessage` named `send_message` and has the same specification with all class-based methods.
Here you can pass default parse mode (argument `parse_mode`) and this value will be used in all API methods automatically.
## Usage
```python3
import asyncio
from os import getenv
from aiogram import Bot
async def main():
async with Bot(token=getenv("TELEGRAM_TOKEN"), parse_mode="HTML").context() as bot:
await bot.send_message(61043901, "<b>Hello, World!</b>")
if __name__ == "__main__":
asyncio.run(main())
```

View file

@ -1,64 +0,0 @@
# addStickerToSet
## Description
Use this method to add a new sticker to a set created by the bot. You must use exactly one of the fields png_sticker or tgs_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `user_id` | `#!python3 int` | User identifier of sticker set owner |
| `name` | `#!python3 str` | Sticker set name |
| `emojis` | `#!python3 str` | One or more emoji corresponding to the sticker |
| `png_sticker` | `#!python3 Optional[Union[InputFile, str]]` | Optional. PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. |
| `tgs_sticker` | `#!python3 Optional[InputFile]` | Optional. TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements |
| `mask_position` | `#!python3 Optional[MaskPosition]` | Optional. A JSON-serialized object for position where the mask should be placed on faces |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.add_sticker_to_set(...)
```
### Method as object
Imports:
- `from aiogram.methods import AddStickerToSet`
- `from aiogram.api.methods import AddStickerToSet`
- `from aiogram.api.methods.add_sticker_to_set import AddStickerToSet`
#### In handlers with current bot
```python3
result: bool = await AddStickerToSet(...)
```
#### With specific bot
```python3
result: bool = await bot(AddStickerToSet(...))
```
#### As reply into Webhook in handler
```python3
return AddStickerToSet(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#addstickertoset)
- [aiogram.types.InputFile](../types/input_file.md)
- [aiogram.types.MaskPosition](../types/mask_position.md)
- [How to upload file?](../upload_file.md)

View file

@ -1,64 +0,0 @@
# answerCallbackQuery
## Description
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
## Arguments
| Name | Type | Description |
| - | - | - |
| `callback_query_id` | `#!python3 str` | Unique identifier for the query to be answered |
| `text` | `#!python3 Optional[str]` | Optional. Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters |
| `show_alert` | `#!python3 Optional[bool]` | Optional. If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. |
| `url` | `#!python3 Optional[str]` | Optional. URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game — note that this will only work if the query comes from a callback_game button. |
| `cache_time` | `#!python3 Optional[int]` | Optional. The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. |
## Response
Type: `#!python3 bool`
Description: On success, True is returned.
## Usage
### As bot method
```python3
result: bool = await bot.answer_callback_query(...)
```
### Method as object
Imports:
- `from aiogram.methods import AnswerCallbackQuery`
- `from aiogram.api.methods import AnswerCallbackQuery`
- `from aiogram.api.methods.answer_callback_query import AnswerCallbackQuery`
#### In handlers with current bot
```python3
result: bool = await AnswerCallbackQuery(...)
```
#### With specific bot
```python3
result: bool = await bot(AnswerCallbackQuery(...))
```
#### As reply into Webhook in handler
```python3
return AnswerCallbackQuery(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#answercallbackquery)
- [aiogram.types.CallbackQuery](../types/callback_query.md)
- [Aliases](../types/callback_query.md#aliases)

View file

@ -1,67 +0,0 @@
# answerInlineQuery
## Description
Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.
## Arguments
| Name | Type | Description |
| - | - | - |
| `inline_query_id` | `#!python3 str` | Unique identifier for the answered query |
| `results` | `#!python3 List[InlineQueryResult]` | A JSON-serialized array of results for the inline query |
| `cache_time` | `#!python3 Optional[int]` | Optional. The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. |
| `is_personal` | `#!python3 Optional[bool]` | Optional. Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query |
| `next_offset` | `#!python3 Optional[str]` | Optional. Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you dont support pagination. Offset length cant exceed 64 bytes. |
| `switch_pm_text` | `#!python3 Optional[str]` | Optional. If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter |
| `switch_pm_parameter` | `#!python3 Optional[str]` | Optional. Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. |
## Response
Type: `#!python3 bool`
Description: On success, True is returned.
## Usage
### As bot method
```python3
result: bool = await bot.answer_inline_query(...)
```
### Method as object
Imports:
- `from aiogram.methods import AnswerInlineQuery`
- `from aiogram.api.methods import AnswerInlineQuery`
- `from aiogram.api.methods.answer_inline_query import AnswerInlineQuery`
#### In handlers with current bot
```python3
result: bool = await AnswerInlineQuery(...)
```
#### With specific bot
```python3
result: bool = await bot(AnswerInlineQuery(...))
```
#### As reply into Webhook in handler
```python3
return AnswerInlineQuery(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#answerinlinequery)
- [aiogram.types.InlineQuery](../types/inline_query.md)
- [aiogram.types.InlineQueryResult](../types/inline_query_result.md)
- [Aliases](../types/inline_query.md#aliases)

View file

@ -1,60 +0,0 @@
# answerPreCheckoutQuery
## Description
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
## Arguments
| Name | Type | Description |
| - | - | - |
| `pre_checkout_query_id` | `#!python3 str` | Unique identifier for the query to be answered |
| `ok` | `#!python3 bool` | Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. |
| `error_message` | `#!python3 Optional[str]` | Optional. Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. |
## Response
Type: `#!python3 bool`
Description: On success, True is returned.
## Usage
### As bot method
```python3
result: bool = await bot.answer_pre_checkout_query(...)
```
### Method as object
Imports:
- `from aiogram.methods import AnswerPreCheckoutQuery`
- `from aiogram.api.methods import AnswerPreCheckoutQuery`
- `from aiogram.api.methods.answer_pre_checkout_query import AnswerPreCheckoutQuery`
#### In handlers with current bot
```python3
result: bool = await AnswerPreCheckoutQuery(...)
```
#### With specific bot
```python3
result: bool = await bot(AnswerPreCheckoutQuery(...))
```
#### As reply into Webhook in handler
```python3
return AnswerPreCheckoutQuery(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#answerprecheckoutquery)
- [aiogram.types.PreCheckoutQuery](../types/pre_checkout_query.md)
- [Aliases](../types/pre_checkout_query.md#aliases)

View file

@ -1,62 +0,0 @@
# answerShippingQuery
## Description
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `shipping_query_id` | `#!python3 str` | Unique identifier for the query to be answered |
| `ok` | `#!python3 bool` | Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible) |
| `shipping_options` | `#!python3 Optional[List[ShippingOption]]` | Optional. Required if ok is True. A JSON-serialized array of available shipping options. |
| `error_message` | `#!python3 Optional[str]` | Optional. Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. |
## Response
Type: `#!python3 bool`
Description: On success, True is returned.
## Usage
### As bot method
```python3
result: bool = await bot.answer_shipping_query(...)
```
### Method as object
Imports:
- `from aiogram.methods import AnswerShippingQuery`
- `from aiogram.api.methods import AnswerShippingQuery`
- `from aiogram.api.methods.answer_shipping_query import AnswerShippingQuery`
#### In handlers with current bot
```python3
result: bool = await AnswerShippingQuery(...)
```
#### With specific bot
```python3
result: bool = await bot(AnswerShippingQuery(...))
```
#### As reply into Webhook in handler
```python3
return AnswerShippingQuery(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#answershippingquery)
- [aiogram.types.ShippingOption](../types/shipping_option.md)
- [aiogram.types.ShippingQuery](../types/shipping_query.md)
- [Aliases](../types/shipping_query.md#aliases)

View file

@ -1,66 +0,0 @@
# createNewStickerSet
## Description
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields png_sticker or tgs_sticker. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `user_id` | `#!python3 int` | User identifier of created sticker set owner |
| `name` | `#!python3 str` | Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in '_by_<bot username>'. <bot_username> is case insensitive. 1-64 characters. |
| `title` | `#!python3 str` | Sticker set title, 1-64 characters |
| `emojis` | `#!python3 str` | One or more emoji corresponding to the sticker |
| `png_sticker` | `#!python3 Optional[Union[InputFile, str]]` | Optional. PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. |
| `tgs_sticker` | `#!python3 Optional[InputFile]` | Optional. TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements |
| `contains_masks` | `#!python3 Optional[bool]` | Optional. Pass True, if a set of mask stickers should be created |
| `mask_position` | `#!python3 Optional[MaskPosition]` | Optional. A JSON-serialized object for position where the mask should be placed on faces |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.create_new_sticker_set(...)
```
### Method as object
Imports:
- `from aiogram.methods import CreateNewStickerSet`
- `from aiogram.api.methods import CreateNewStickerSet`
- `from aiogram.api.methods.create_new_sticker_set import CreateNewStickerSet`
#### In handlers with current bot
```python3
result: bool = await CreateNewStickerSet(...)
```
#### With specific bot
```python3
result: bool = await bot(CreateNewStickerSet(...))
```
#### As reply into Webhook in handler
```python3
return CreateNewStickerSet(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#createnewstickerset)
- [aiogram.types.InputFile](../types/input_file.md)
- [aiogram.types.MaskPosition](../types/mask_position.md)
- [How to upload file?](../upload_file.md)

View file

@ -1,56 +0,0 @@
# deleteChatPhoto
## Description
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.delete_chat_photo(...)
```
### Method as object
Imports:
- `from aiogram.methods import DeleteChatPhoto`
- `from aiogram.api.methods import DeleteChatPhoto`
- `from aiogram.api.methods.delete_chat_photo import DeleteChatPhoto`
#### In handlers with current bot
```python3
result: bool = await DeleteChatPhoto(...)
```
#### With specific bot
```python3
result: bool = await bot(DeleteChatPhoto(...))
```
#### As reply into Webhook in handler
```python3
return DeleteChatPhoto(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#deletechatphoto)

View file

@ -1,56 +0,0 @@
# deleteChatStickerSet
## Description
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) |
## Response
Type: `#!python3 bool`
Description: Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.delete_chat_sticker_set(...)
```
### Method as object
Imports:
- `from aiogram.methods import DeleteChatStickerSet`
- `from aiogram.api.methods import DeleteChatStickerSet`
- `from aiogram.api.methods.delete_chat_sticker_set import DeleteChatStickerSet`
#### In handlers with current bot
```python3
result: bool = await DeleteChatStickerSet(...)
```
#### With specific bot
```python3
result: bool = await bot(DeleteChatStickerSet(...))
```
#### As reply into Webhook in handler
```python3
return DeleteChatStickerSet(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#deletechatstickerset)

View file

@ -1,73 +0,0 @@
# deleteMessage
## Description
Use this method to delete a message, including service messages, with the following limitations:
- A message can only be deleted if it was sent less than 48 hours ago.
- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups.
- Bots can delete incoming messages in private chats.
- Bots granted can_post_messages permissions can delete outgoing messages in channels.
- If the bot is an administrator of a group, it can delete any message there.
- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `message_id` | `#!python3 int` | Identifier of the message to delete |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.delete_message(...)
```
### Method as object
Imports:
- `from aiogram.methods import DeleteMessage`
- `from aiogram.api.methods import DeleteMessage`
- `from aiogram.api.methods.delete_message import DeleteMessage`
#### In handlers with current bot
```python3
result: bool = await DeleteMessage(...)
```
#### With specific bot
```python3
result: bool = await bot(DeleteMessage(...))
```
#### As reply into Webhook in handler
```python3
return DeleteMessage(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#deletemessage)

View file

@ -1,56 +0,0 @@
# deleteStickerFromSet
## Description
Use this method to delete a sticker from a set created by the bot. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `sticker` | `#!python3 str` | File identifier of the sticker |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.delete_sticker_from_set(...)
```
### Method as object
Imports:
- `from aiogram.methods import DeleteStickerFromSet`
- `from aiogram.api.methods import DeleteStickerFromSet`
- `from aiogram.api.methods.delete_sticker_from_set import DeleteStickerFromSet`
#### In handlers with current bot
```python3
result: bool = await DeleteStickerFromSet(...)
```
#### With specific bot
```python3
result: bool = await bot(DeleteStickerFromSet(...))
```
#### As reply into Webhook in handler
```python3
return DeleteStickerFromSet(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#deletestickerfromset)

View file

@ -1,50 +0,0 @@
# deleteWebhook
## Description
Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.delete_webhook(...)
```
### Method as object
Imports:
- `from aiogram.methods import DeleteWebhook`
- `from aiogram.api.methods import DeleteWebhook`
- `from aiogram.api.methods.delete_webhook import DeleteWebhook`
#### In handlers with current bot
```python3
result: bool = await DeleteWebhook(...)
```
#### With specific bot
```python3
result: bool = await bot(DeleteWebhook(...))
```
#### As reply into Webhook in handler
```python3
return DeleteWebhook(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#deletewebhook)

View file

@ -1,63 +0,0 @@
# editMessageCaption
## Description
Use this method to edit captions of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Optional[Union[int, str]]` | Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit |
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
| `caption` | `#!python3 Optional[str]` | Optional. New caption of the message, 0-1024 characters after entities parsing |
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message caption. See formatting options for more details. |
| `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for an inline keyboard. |
## Response
Type: `#!python3 Union[Message, bool]`
Description: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
## Usage
### As bot method
```python3
result: Union[Message, bool] = await bot.edit_message_caption(...)
```
### Method as object
Imports:
- `from aiogram.methods import EditMessageCaption`
- `from aiogram.api.methods import EditMessageCaption`
- `from aiogram.api.methods.edit_message_caption import EditMessageCaption`
#### In handlers with current bot
```python3
result: Union[Message, bool] = await EditMessageCaption(...)
```
#### With specific bot
```python3
result: Union[Message, bool] = await bot(EditMessageCaption(...))
```
#### As reply into Webhook in handler
```python3
return EditMessageCaption(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#editmessagecaption)
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
- [aiogram.types.Message](../types/message.md)

View file

@ -1,63 +0,0 @@
# editMessageLiveLocation
## Description
Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `latitude` | `#!python3 float` | Latitude of new location |
| `longitude` | `#!python3 float` | Longitude of new location |
| `chat_id` | `#!python3 Optional[Union[int, str]]` | Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit |
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
| `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for a new inline keyboard. |
## Response
Type: `#!python3 Union[Message, bool]`
Description: On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
## Usage
### As bot method
```python3
result: Union[Message, bool] = await bot.edit_message_live_location(...)
```
### Method as object
Imports:
- `from aiogram.methods import EditMessageLiveLocation`
- `from aiogram.api.methods import EditMessageLiveLocation`
- `from aiogram.api.methods.edit_message_live_location import EditMessageLiveLocation`
#### In handlers with current bot
```python3
result: Union[Message, bool] = await EditMessageLiveLocation(...)
```
#### With specific bot
```python3
result: Union[Message, bool] = await bot(EditMessageLiveLocation(...))
```
#### As reply into Webhook in handler
```python3
return EditMessageLiveLocation(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#editmessagelivelocation)
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
- [aiogram.types.Message](../types/message.md)

View file

@ -1,63 +0,0 @@
# editMessageMedia
## Description
Use this method to edit animation, audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `media` | `#!python3 InputMedia` | A JSON-serialized object for a new media content of the message |
| `chat_id` | `#!python3 Optional[Union[int, str]]` | Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit |
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
| `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for a new inline keyboard. |
## Response
Type: `#!python3 Union[Message, bool]`
Description: On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
## Usage
### As bot method
```python3
result: Union[Message, bool] = await bot.edit_message_media(...)
```
### Method as object
Imports:
- `from aiogram.methods import EditMessageMedia`
- `from aiogram.api.methods import EditMessageMedia`
- `from aiogram.api.methods.edit_message_media import EditMessageMedia`
#### In handlers with current bot
```python3
result: Union[Message, bool] = await EditMessageMedia(...)
```
#### With specific bot
```python3
result: Union[Message, bool] = await bot(EditMessageMedia(...))
```
#### As reply into Webhook in handler
```python3
return EditMessageMedia(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#editmessagemedia)
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
- [aiogram.types.InputMedia](../types/input_media.md)
- [aiogram.types.Message](../types/message.md)

View file

@ -1,61 +0,0 @@
# editMessageReplyMarkup
## Description
Use this method to edit only the reply markup of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Optional[Union[int, str]]` | Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit |
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
| `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for an inline keyboard. |
## Response
Type: `#!python3 Union[Message, bool]`
Description: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
## Usage
### As bot method
```python3
result: Union[Message, bool] = await bot.edit_message_reply_markup(...)
```
### Method as object
Imports:
- `from aiogram.methods import EditMessageReplyMarkup`
- `from aiogram.api.methods import EditMessageReplyMarkup`
- `from aiogram.api.methods.edit_message_reply_markup import EditMessageReplyMarkup`
#### In handlers with current bot
```python3
result: Union[Message, bool] = await EditMessageReplyMarkup(...)
```
#### With specific bot
```python3
result: Union[Message, bool] = await bot(EditMessageReplyMarkup(...))
```
#### As reply into Webhook in handler
```python3
return EditMessageReplyMarkup(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#editmessagereplymarkup)
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
- [aiogram.types.Message](../types/message.md)

View file

@ -1,64 +0,0 @@
# editMessageText
## Description
Use this method to edit text and game messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `text` | `#!python3 str` | New text of the message, 1-4096 characters after entities parsing |
| `chat_id` | `#!python3 Optional[Union[int, str]]` | Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit |
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message text. See formatting options for more details. |
| `disable_web_page_preview` | `#!python3 Optional[bool]` | Optional. Disables link previews for links in this message |
| `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for an inline keyboard. |
## Response
Type: `#!python3 Union[Message, bool]`
Description: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
## Usage
### As bot method
```python3
result: Union[Message, bool] = await bot.edit_message_text(...)
```
### Method as object
Imports:
- `from aiogram.methods import EditMessageText`
- `from aiogram.api.methods import EditMessageText`
- `from aiogram.api.methods.edit_message_text import EditMessageText`
#### In handlers with current bot
```python3
result: Union[Message, bool] = await EditMessageText(...)
```
#### With specific bot
```python3
result: Union[Message, bool] = await bot(EditMessageText(...))
```
#### As reply into Webhook in handler
```python3
return EditMessageText(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#editmessagetext)
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
- [aiogram.types.Message](../types/message.md)

View file

@ -1,58 +0,0 @@
# exportChatInviteLink
## Description
Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as String on success.
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink — after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
## Response
Type: `#!python3 str`
Description: Returns the new invite link as String on success.
## Usage
### As bot method
```python3
result: str = await bot.export_chat_invite_link(...)
```
### Method as object
Imports:
- `from aiogram.methods import ExportChatInviteLink`
- `from aiogram.api.methods import ExportChatInviteLink`
- `from aiogram.api.methods.export_chat_invite_link import ExportChatInviteLink`
#### In handlers with current bot
```python3
result: str = await ExportChatInviteLink(...)
```
#### With specific bot
```python3
result: str = await bot(ExportChatInviteLink(...))
```
#### As reply into Webhook in handler
```python3
return ExportChatInviteLink(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#exportchatinvitelink)

View file

@ -1,60 +0,0 @@
# forwardMessage
## Description
Use this method to forward messages of any kind. On success, the sent Message is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `from_chat_id` | `#!python3 Union[int, str]` | Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername) |
| `message_id` | `#!python3 int` | Message identifier in the chat specified in from_chat_id |
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
## Response
Type: `#!python3 Message`
Description: On success, the sent Message is returned.
## Usage
### As bot method
```python3
result: Message = await bot.forward_message(...)
```
### Method as object
Imports:
- `from aiogram.methods import ForwardMessage`
- `from aiogram.api.methods import ForwardMessage`
- `from aiogram.api.methods.forward_message import ForwardMessage`
#### In handlers with current bot
```python3
result: Message = await ForwardMessage(...)
```
#### With specific bot
```python3
result: Message = await bot(ForwardMessage(...))
```
#### As reply into Webhook in handler
```python3
return ForwardMessage(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#forwardmessage)
- [aiogram.types.Message](../types/message.md)

View file

@ -1,54 +0,0 @@
# getChat
## Description
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) |
## Response
Type: `#!python3 Chat`
Description: Returns a Chat object on success.
## Usage
### As bot method
```python3
result: Chat = await bot.get_chat(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetChat`
- `from aiogram.api.methods import GetChat`
- `from aiogram.api.methods.get_chat import GetChat`
#### In handlers with current bot
```python3
result: Chat = await GetChat(...)
```
#### With specific bot
```python3
result: Chat = await bot(GetChat(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getchat)
- [aiogram.types.Chat](../types/chat.md)

View file

@ -1,54 +0,0 @@
# getChatAdministrators
## Description
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) |
## Response
Type: `#!python3 List[ChatMember]`
Description: On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
## Usage
### As bot method
```python3
result: List[ChatMember] = await bot.get_chat_administrators(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetChatAdministrators`
- `from aiogram.api.methods import GetChatAdministrators`
- `from aiogram.api.methods.get_chat_administrators import GetChatAdministrators`
#### In handlers with current bot
```python3
result: List[ChatMember] = await GetChatAdministrators(...)
```
#### With specific bot
```python3
result: List[ChatMember] = await bot(GetChatAdministrators(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getchatadministrators)
- [aiogram.types.ChatMember](../types/chat_member.md)

View file

@ -1,55 +0,0 @@
# getChatMember
## Description
Use this method to get information about a member of a chat. Returns a ChatMember object on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) |
| `user_id` | `#!python3 int` | Unique identifier of the target user |
## Response
Type: `#!python3 ChatMember`
Description: Returns a ChatMember object on success.
## Usage
### As bot method
```python3
result: ChatMember = await bot.get_chat_member(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetChatMember`
- `from aiogram.api.methods import GetChatMember`
- `from aiogram.api.methods.get_chat_member import GetChatMember`
#### In handlers with current bot
```python3
result: ChatMember = await GetChatMember(...)
```
#### With specific bot
```python3
result: ChatMember = await bot(GetChatMember(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getchatmember)
- [aiogram.types.ChatMember](../types/chat_member.md)

View file

@ -1,53 +0,0 @@
# getChatMembersCount
## Description
Use this method to get the number of members in a chat. Returns Int on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) |
## Response
Type: `#!python3 int`
Description: Returns Int on success.
## Usage
### As bot method
```python3
result: int = await bot.get_chat_members_count(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetChatMembersCount`
- `from aiogram.api.methods import GetChatMembersCount`
- `from aiogram.api.methods.get_chat_members_count import GetChatMembersCount`
#### In handlers with current bot
```python3
result: int = await GetChatMembersCount(...)
```
#### With specific bot
```python3
result: int = await bot(GetChatMembersCount(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getchatmemberscount)

View file

@ -1,56 +0,0 @@
# getFile
## Description
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
## Arguments
| Name | Type | Description |
| - | - | - |
| `file_id` | `#!python3 str` | File identifier to get info about |
## Response
Type: `#!python3 File`
Description: On success, a File object is returned.
## Usage
### As bot method
```python3
result: File = await bot.get_file(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetFile`
- `from aiogram.api.methods import GetFile`
- `from aiogram.api.methods.get_file import GetFile`
#### In handlers with current bot
```python3
result: File = await GetFile(...)
```
#### With specific bot
```python3
result: File = await bot(GetFile(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getfile)
- [aiogram.types.File](../types/file.md)

View file

@ -1,59 +0,0 @@
# getGameHighScores
## Description
Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change.
## Arguments
| Name | Type | Description |
| - | - | - |
| `user_id` | `#!python3 int` | Target user id |
| `chat_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Unique identifier for the target chat |
| `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the sent message |
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
## Response
Type: `#!python3 List[GameHighScore]`
Description: Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them.
## Usage
### As bot method
```python3
result: List[GameHighScore] = await bot.get_game_high_scores(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetGameHighScores`
- `from aiogram.api.methods import GetGameHighScores`
- `from aiogram.api.methods.get_game_high_scores import GetGameHighScores`
#### In handlers with current bot
```python3
result: List[GameHighScore] = await GetGameHighScores(...)
```
#### With specific bot
```python3
result: List[GameHighScore] = await bot(GetGameHighScores(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getgamehighscores)
- [aiogram.types.GameHighScore](../types/game_high_score.md)

View file

@ -1,48 +0,0 @@
# getMe
## Description
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.
## Response
Type: `#!python3 User`
Description: Returns basic information about the bot in form of a User object.
## Usage
### As bot method
```python3
result: User = await bot.get_me(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetMe`
- `from aiogram.api.methods import GetMe`
- `from aiogram.api.methods.get_me import GetMe`
#### In handlers with current bot
```python3
result: User = await GetMe(...)
```
#### With specific bot
```python3
result: User = await bot(GetMe(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getme)
- [aiogram.types.User](../types/user.md)

View file

@ -1,48 +0,0 @@
# getMyCommands
## Description
Use this method to get the current list of the bot's commands. Requires no parameters. Returns Array of BotCommand on success.
## Response
Type: `#!python3 List[BotCommand]`
Description: Returns Array of BotCommand on success.
## Usage
### As bot method
```python3
result: List[BotCommand] = await bot.get_my_commands(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetMyCommands`
- `from aiogram.api.methods import GetMyCommands`
- `from aiogram.api.methods.get_my_commands import GetMyCommands`
#### In handlers with current bot
```python3
result: List[BotCommand] = await GetMyCommands(...)
```
#### With specific bot
```python3
result: List[BotCommand] = await bot(GetMyCommands(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getmycommands)
- [aiogram.types.BotCommand](../types/bot_command.md)

View file

@ -1,54 +0,0 @@
# getStickerSet
## Description
Use this method to get a sticker set. On success, a StickerSet object is returned.
## Arguments
| Name | Type | Description |
| - | - | - |
| `name` | `#!python3 str` | Name of the sticker set |
## Response
Type: `#!python3 StickerSet`
Description: On success, a StickerSet object is returned.
## Usage
### As bot method
```python3
result: StickerSet = await bot.get_sticker_set(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetStickerSet`
- `from aiogram.api.methods import GetStickerSet`
- `from aiogram.api.methods.get_sticker_set import GetStickerSet`
#### In handlers with current bot
```python3
result: StickerSet = await GetStickerSet(...)
```
#### With specific bot
```python3
result: StickerSet = await bot(GetStickerSet(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getstickerset)
- [aiogram.types.StickerSet](../types/sticker_set.md)

View file

@ -1,63 +0,0 @@
# getUpdates
## Description
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
Notes
1. This method will not work if an outgoing webhook is set up.
2. In order to avoid getting duplicate updates, recalculate offset after each server response.
## Arguments
| Name | Type | Description |
| - | - | - |
| `offset` | `#!python3 Optional[int]` | Optional. Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. |
| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. |
| `timeout` | `#!python3 Optional[int]` | Optional. Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. |
| `allowed_updates` | `#!python3 Optional[List[str]]` | Optional. A JSON-serialized list of the update types you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. |
## Response
Type: `#!python3 List[Update]`
Description: An Array of Update objects is returned.
## Usage
### As bot method
```python3
result: List[Update] = await bot.get_updates(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetUpdates`
- `from aiogram.api.methods import GetUpdates`
- `from aiogram.api.methods.get_updates import GetUpdates`
#### In handlers with current bot
```python3
result: List[Update] = await GetUpdates(...)
```
#### With specific bot
```python3
result: List[Update] = await bot(GetUpdates(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getupdates)
- [aiogram.types.Update](../types/update.md)

View file

@ -1,56 +0,0 @@
# getUserProfilePhotos
## Description
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
## Arguments
| Name | Type | Description |
| - | - | - |
| `user_id` | `#!python3 int` | Unique identifier of the target user |
| `offset` | `#!python3 Optional[int]` | Optional. Sequential number of the first photo to be returned. By default, all photos are returned. |
| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. |
## Response
Type: `#!python3 UserProfilePhotos`
Description: Returns a UserProfilePhotos object.
## Usage
### As bot method
```python3
result: UserProfilePhotos = await bot.get_user_profile_photos(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetUserProfilePhotos`
- `from aiogram.api.methods import GetUserProfilePhotos`
- `from aiogram.api.methods.get_user_profile_photos import GetUserProfilePhotos`
#### In handlers with current bot
```python3
result: UserProfilePhotos = await GetUserProfilePhotos(...)
```
#### With specific bot
```python3
result: UserProfilePhotos = await bot(GetUserProfilePhotos(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getuserprofilephotos)
- [aiogram.types.UserProfilePhotos](../types/user_profile_photos.md)

View file

@ -1,48 +0,0 @@
# getWebhookInfo
## Description
Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
## Response
Type: `#!python3 WebhookInfo`
Description: On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
## Usage
### As bot method
```python3
result: WebhookInfo = await bot.get_webhook_info(...)
```
### Method as object
Imports:
- `from aiogram.methods import GetWebhookInfo`
- `from aiogram.api.methods import GetWebhookInfo`
- `from aiogram.api.methods.get_webhook_info import GetWebhookInfo`
#### In handlers with current bot
```python3
result: WebhookInfo = await GetWebhookInfo(...)
```
#### With specific bot
```python3
result: WebhookInfo = await bot(GetWebhookInfo(...))
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#getwebhookinfo)
- [aiogram.types.WebhookInfo](../types/webhook_info.md)

View file

@ -1,82 +0,0 @@
# Methods
Here is list of all available API methods:
- Getting updates
- [getUpdates](get_updates.md)
- [setWebhook](set_webhook.md)
- [deleteWebhook](delete_webhook.md)
- [getWebhookInfo](get_webhook_info.md)
- Available methods
- [getMe](get_me.md)
- [sendMessage](send_message.md)
- [forwardMessage](forward_message.md)
- [sendPhoto](send_photo.md)
- [sendAudio](send_audio.md)
- [sendDocument](send_document.md)
- [sendVideo](send_video.md)
- [sendAnimation](send_animation.md)
- [sendVoice](send_voice.md)
- [sendVideoNote](send_video_note.md)
- [sendMediaGroup](send_media_group.md)
- [sendLocation](send_location.md)
- [editMessageLiveLocation](edit_message_live_location.md)
- [stopMessageLiveLocation](stop_message_live_location.md)
- [sendVenue](send_venue.md)
- [sendContact](send_contact.md)
- [sendPoll](send_poll.md)
- [sendDice](send_dice.md)
- [sendChatAction](send_chat_action.md)
- [getUserProfilePhotos](get_user_profile_photos.md)
- [getFile](get_file.md)
- [kickChatMember](kick_chat_member.md)
- [unbanChatMember](unban_chat_member.md)
- [restrictChatMember](restrict_chat_member.md)
- [promoteChatMember](promote_chat_member.md)
- [setChatAdministratorCustomTitle](set_chat_administrator_custom_title.md)
- [setChatPermissions](set_chat_permissions.md)
- [exportChatInviteLink](export_chat_invite_link.md)
- [setChatPhoto](set_chat_photo.md)
- [deleteChatPhoto](delete_chat_photo.md)
- [setChatTitle](set_chat_title.md)
- [setChatDescription](set_chat_description.md)
- [pinChatMessage](pin_chat_message.md)
- [unpinChatMessage](unpin_chat_message.md)
- [leaveChat](leave_chat.md)
- [getChat](get_chat.md)
- [getChatAdministrators](get_chat_administrators.md)
- [getChatMembersCount](get_chat_members_count.md)
- [getChatMember](get_chat_member.md)
- [setChatStickerSet](set_chat_sticker_set.md)
- [deleteChatStickerSet](delete_chat_sticker_set.md)
- [answerCallbackQuery](answer_callback_query.md)
- [setMyCommands](set_my_commands.md)
- [getMyCommands](get_my_commands.md)
- Updating messages
- [editMessageText](edit_message_text.md)
- [editMessageCaption](edit_message_caption.md)
- [editMessageMedia](edit_message_media.md)
- [editMessageReplyMarkup](edit_message_reply_markup.md)
- [stopPoll](stop_poll.md)
- [deleteMessage](delete_message.md)
- Stickers
- [sendSticker](send_sticker.md)
- [getStickerSet](get_sticker_set.md)
- [uploadStickerFile](upload_sticker_file.md)
- [createNewStickerSet](create_new_sticker_set.md)
- [addStickerToSet](add_sticker_to_set.md)
- [setStickerPositionInSet](set_sticker_position_in_set.md)
- [deleteStickerFromSet](delete_sticker_from_set.md)
- [setStickerSetThumb](set_sticker_set_thumb.md)
- Inline mode
- [answerInlineQuery](answer_inline_query.md)
- Payments
- [sendInvoice](send_invoice.md)
- [answerShippingQuery](answer_shipping_query.md)
- [answerPreCheckoutQuery](answer_pre_checkout_query.md)
- Telegram Passport
- [setPassportDataErrors](set_passport_data_errors.md)
- Games
- [sendGame](send_game.md)
- [setGameScore](set_game_score.md)
- [getGameHighScores](get_game_high_scores.md)

View file

@ -1,58 +0,0 @@
# kickChatMember
## Description
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) |
| `user_id` | `#!python3 int` | Unique identifier of the target user |
| `until_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever |
## Response
Type: `#!python3 bool`
Description: In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc. Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.kick_chat_member(...)
```
### Method as object
Imports:
- `from aiogram.methods import KickChatMember`
- `from aiogram.api.methods import KickChatMember`
- `from aiogram.api.methods.kick_chat_member import KickChatMember`
#### In handlers with current bot
```python3
result: bool = await KickChatMember(...)
```
#### With specific bot
```python3
result: bool = await bot(KickChatMember(...))
```
#### As reply into Webhook in handler
```python3
return KickChatMember(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#kickchatmember)

View file

@ -1,56 +0,0 @@
# leaveChat
## Description
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.leave_chat(...)
```
### Method as object
Imports:
- `from aiogram.methods import LeaveChat`
- `from aiogram.api.methods import LeaveChat`
- `from aiogram.api.methods.leave_chat import LeaveChat`
#### In handlers with current bot
```python3
result: bool = await LeaveChat(...)
```
#### With specific bot
```python3
result: bool = await bot(LeaveChat(...))
```
#### As reply into Webhook in handler
```python3
return LeaveChat(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#leavechat)

View file

@ -1,58 +0,0 @@
# pinChatMessage
## Description
Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the can_pin_messages admin right in the supergroup or can_edit_messages admin right in the channel. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `message_id` | `#!python3 int` | Identifier of a message to pin |
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels. |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.pin_chat_message(...)
```
### Method as object
Imports:
- `from aiogram.methods import PinChatMessage`
- `from aiogram.api.methods import PinChatMessage`
- `from aiogram.api.methods.pin_chat_message import PinChatMessage`
#### In handlers with current bot
```python3
result: bool = await PinChatMessage(...)
```
#### With specific bot
```python3
result: bool = await bot(PinChatMessage(...))
```
#### As reply into Webhook in handler
```python3
return PinChatMessage(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#pinchatmessage)

View file

@ -1,65 +0,0 @@
# promoteChatMember
## Description
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `user_id` | `#!python3 int` | Unique identifier of the target user |
| `can_change_info` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can change chat title, photo and other settings |
| `can_post_messages` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can create channel posts, channels only |
| `can_edit_messages` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can edit messages of other users and can pin messages, channels only |
| `can_delete_messages` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can delete messages of other users |
| `can_invite_users` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can invite new users to the chat |
| `can_restrict_members` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can restrict, ban or unban chat members |
| `can_pin_messages` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can pin messages, supergroups only |
| `can_promote_members` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.promote_chat_member(...)
```
### Method as object
Imports:
- `from aiogram.methods import PromoteChatMember`
- `from aiogram.api.methods import PromoteChatMember`
- `from aiogram.api.methods.promote_chat_member import PromoteChatMember`
#### In handlers with current bot
```python3
result: bool = await PromoteChatMember(...)
```
#### With specific bot
```python3
result: bool = await bot(PromoteChatMember(...))
```
#### As reply into Webhook in handler
```python3
return PromoteChatMember(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#promotechatmember)

View file

@ -1,60 +0,0 @@
# restrictChatMember
## Description
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) |
| `user_id` | `#!python3 int` | Unique identifier of the target user |
| `permissions` | `#!python3 ChatPermissions` | New user permissions |
| `until_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever |
## Response
Type: `#!python3 bool`
Description: Returns True on success.
## Usage
### As bot method
```python3
result: bool = await bot.restrict_chat_member(...)
```
### Method as object
Imports:
- `from aiogram.methods import RestrictChatMember`
- `from aiogram.api.methods import RestrictChatMember`
- `from aiogram.api.methods.restrict_chat_member import RestrictChatMember`
#### In handlers with current bot
```python3
result: bool = await RestrictChatMember(...)
```
#### With specific bot
```python3
result: bool = await bot(RestrictChatMember(...))
```
#### As reply into Webhook in handler
```python3
return RestrictChatMember(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#restrictchatmember)
- [aiogram.types.ChatPermissions](../types/chat_permissions.md)

View file

@ -1,73 +0,0 @@
# sendAnimation
## Description
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `animation` | `#!python3 Union[InputFile, str]` | Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. |
| `duration` | `#!python3 Optional[int]` | Optional. Duration of sent animation in seconds |
| `width` | `#!python3 Optional[int]` | Optional. Animation width |
| `height` | `#!python3 Optional[int]` | Optional. Animation height |
| `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnails width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails cant be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
| `caption` | `#!python3 Optional[str]` | Optional. Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing |
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the animation caption. See formatting options for more details. |
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
| `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
## Response
Type: `#!python3 Message`
Description: On success, the sent Message is returned.
## Usage
### As bot method
```python3
result: Message = await bot.send_animation(...)
```
### Method as object
Imports:
- `from aiogram.methods import SendAnimation`
- `from aiogram.api.methods import SendAnimation`
- `from aiogram.api.methods.send_animation import SendAnimation`
#### In handlers with current bot
```python3
result: Message = await SendAnimation(...)
```
#### With specific bot
```python3
result: Message = await bot(SendAnimation(...))
```
#### As reply into Webhook in handler
```python3
return SendAnimation(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#sendanimation)
- [aiogram.types.ForceReply](../types/force_reply.md)
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
- [aiogram.types.InputFile](../types/input_file.md)
- [aiogram.types.Message](../types/message.md)
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
- [How to upload file?](../upload_file.md)

View file

@ -1,75 +0,0 @@
# sendAudio
## Description
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
For sending voice messages, use the sendVoice method instead.
## Arguments
| Name | Type | Description |
| - | - | - |
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
| `audio` | `#!python3 Union[InputFile, str]` | Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. |
| `caption` | `#!python3 Optional[str]` | Optional. Audio caption, 0-1024 characters after entities parsing |
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. |
| `duration` | `#!python3 Optional[int]` | Optional. Duration of the audio in seconds |
| `performer` | `#!python3 Optional[str]` | Optional. Performer |
| `title` | `#!python3 Optional[str]` | Optional. Track name |
| `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnails width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails cant be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
| `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
## Response
Type: `#!python3 Message`
Description: On success, the sent Message is returned.
## Usage
### As bot method
```python3
result: Message = await bot.send_audio(...)
```
### Method as object
Imports:
- `from aiogram.methods import SendAudio`
- `from aiogram.api.methods import SendAudio`
- `from aiogram.api.methods.send_audio import SendAudio`
#### In handlers with current bot
```python3
result: Message = await SendAudio(...)
```
#### With specific bot
```python3
result: Message = await bot(SendAudio(...))
```
#### As reply into Webhook in handler
```python3
return SendAudio(...)
```
## Related pages:
- [Official documentation](https://core.telegram.org/bots/api#sendaudio)
- [aiogram.types.ForceReply](../types/force_reply.md)
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
- [aiogram.types.InputFile](../types/input_file.md)
- [aiogram.types.Message](../types/message.md)
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
- [How to upload file?](../upload_file.md)

Some files were not shown because too many files have changed in this diff Show more