diff --git a/.gitignore b/.gitignore index 43d848ee..1f3e1971 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ .idea/ +.vscode/ __pycache__/ *.py[cod] env/ build/ +_build/ dist/ site/ *.egg-info/ diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..b06c4a0f --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,13 @@ +version: 2 + +sphinx: + configuration: docs2/source/conf.py + +formats: all + +python: + version: 3.8 + install: + - method: pip + path: . + - requirements: docs2/requirements.txt diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index 6030dd5a..8182d1c8 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -140,13 +140,20 @@ T = TypeVar("T") class Bot(ContextInstanceMixin["Bot"]): - """ - Main bot class - """ - def __init__( self, token: str, session: Optional[BaseSession] = None, parse_mode: Optional[str] = None, ) -> None: + """ + Bot class + + :param token: Telegram Bot token `Obtained from @BotFather `_ + :param session: HTTP Client session (For example AiohttpSession). + If not specified it will be automatically created. + :param parse_mode: Default parse mode. + If specified it will be propagated into the API methods at runtime. + :raise TokenValidationError: When token has invalid format this exception will be raised + """ + validate_token(token) if session is None: diff --git a/aiogram/client/session/base.py b/aiogram/client/session/base.py index 50beee50..8e1e8293 100644 --- a/aiogram/client/session/base.py +++ b/aiogram/client/session/base.py @@ -32,35 +32,63 @@ _JsonDumps = Callable[..., str] class BaseSession(abc.ABC): - default_timeout: ClassVar[float] = 60.0 api: Default[TelegramAPIServer] = Default(PRODUCTION) + """Telegra Bot API URL patterns""" json_loads: Default[_JsonLoads] = Default(json.loads) + """JSON loader""" json_dumps: Default[_JsonDumps] = Default(json.dumps) + """JSON dumper""" + default_timeout: ClassVar[float] = 60.0 + """Default timeout""" timeout: Default[float] = Default(fget=lambda self: float(self.__class__.default_timeout)) + """Session scope request timeout""" @classmethod def raise_for_status(cls, response: Response[T]) -> None: + """ + Check response status + + :param response: Response instance + """ if response.ok: return raise TelegramAPIError(response.description) @abc.abstractmethod async def close(self) -> None: # pragma: no cover + """ + Close client session + """ pass @abc.abstractmethod async def make_request( self, bot: Bot, method: TelegramMethod[T], timeout: Optional[int] = UNSET ) -> T: # pragma: no cover + """ + Make request to Telegram Bot API + + :param bot: Bot instance + :param method: Method instance + :param timeout: Request timeout + :return: + :raise TelegramApiError: + """ pass @abc.abstractmethod async def stream_content( self, url: str, timeout: int, chunk_size: int ) -> AsyncGenerator[bytes, None]: # pragma: no cover + """ + Stream reader + """ yield b"" def prepare_value(self, value: Any) -> Union[str, int, bool]: + """ + Prepare value before send + """ if isinstance(value, str): return value if isinstance(value, (list, dict)): @@ -74,6 +102,9 @@ class BaseSession(abc.ABC): return str(value) def clean_json(self, value: Any) -> Any: + """ + Clean data before send + """ if isinstance(value, list): return [self.clean_json(v) for v in value if v is not None] elif isinstance(value, dict): diff --git a/aiogram/dispatcher/event/event.py b/aiogram/dispatcher/event/event.py index 29aa4580..ef87d329 100644 --- a/aiogram/dispatcher/event/event.py +++ b/aiogram/dispatcher/event/event.py @@ -8,6 +8,19 @@ from .handler import CallbackType, HandlerObject, HandlerType class EventObserver: """ Simple events observer + + Is used for managing events is not related with Telegram (For example startup/shutdown processes) + + Handlers can be registered via decorator or method + + .. code-block:: python + + .register(my_handler) + + .. code-block:: python + + @() + async def my_handler(*args, **kwargs): ... """ def __init__(self) -> None: diff --git a/aiogram/dispatcher/event/telegram.py b/aiogram/dispatcher/event/telegram.py index fe40769c..9ea4650b 100644 --- a/aiogram/dispatcher/event/telegram.py +++ b/aiogram/dispatcher/event/telegram.py @@ -18,6 +18,9 @@ if TYPE_CHECKING: # pragma: no cover class TelegramEventObserver: """ Event observer for Telegram events + + Here you can register handler with filters or bounded filters which can be used as keyword arguments instead of writing full references when you register new handlers. + This observer will stops event propagation when first handler is pass. """ def __init__(self, router: Router, event_name: str) -> None: @@ -153,10 +156,19 @@ class TelegramEventObserver: Decorator for registering inner middlewares Usage: - >>> @.middleware() # via decorator (variant 1) - >>> @.middleware # via decorator (variant 2) - >>> async def my_middleware(handler, event, data): ... - >>> .middleware(middleware) # via method + + .. code-block:: python + + @.middleware() # via decorator (variant 1) + + .. code-block:: python + + @.middleware # via decorator (variant 2) + + .. code-block:: python + + async def my_middleware(handler, event, data): ... + .middleware(my_middleware) # via method """ def wrapper(m: MiddlewareType) -> MiddlewareType: @@ -174,10 +186,19 @@ class TelegramEventObserver: Decorator for registering outer middlewares Usage: - >>> @.outer_middleware() # via decorator (variant 1) - >>> @.outer_middleware # via decorator (variant 2) - >>> async def my_middleware(handler, event, data): ... - >>> .outer_middleware(my_middleware) # via method + + .. code-block:: python + + @.outer_middleware() # via decorator (variant 1) + + .. code-block:: python + + @.outer_middleware # via decorator (variant 2) + + .. code-block:: python + + async def my_middleware(handler, event, data): ... + .outer_middleware(my_middleware) # via method """ def wrapper(m: MiddlewareType) -> MiddlewareType: diff --git a/aiogram/dispatcher/router.py b/aiogram/dispatcher/router.py index 1d4ff979..0ee4971d 100644 --- a/aiogram/dispatcher/router.py +++ b/aiogram/dispatcher/router.py @@ -15,10 +15,22 @@ from .middlewares.error import ErrorsMiddleware class Router: """ - Events router + Router can route update and it nested update types like messages, callback query, polls and all other event types. + Here is used event-observer pattern. + + Event handlers can be registered in observer by two ways: + + - By observer method - :obj:`router..register(handler, )` + - By decorator - :obj:`@router.()` + """ def __init__(self, use_builtin_filters: bool = True) -> None: + """ + + :param use_builtin_filters: `aiogram` has many builtin filters and you can controll automatic registration of this filters in factory + """ + self.use_builtin_filters = use_builtin_filters self._parent_router: Optional[Router] = None diff --git a/aiogram/types/downloadable.py b/aiogram/types/downloadable.py index 0b0ee4cf..48525f65 100644 --- a/aiogram/types/downloadable.py +++ b/aiogram/types/downloadable.py @@ -1,4 +1,7 @@ -from typing_extensions import Protocol +try: + from typing import Protocol +except ImportError: # pragma: no cover + from typing_extensions import Protocol # type: ignore class Downloadable(Protocol): diff --git a/aiogram/types/input_file.py b/aiogram/types/input_file.py index 1407870a..d9db96d5 100644 --- a/aiogram/types/input_file.py +++ b/aiogram/types/input_file.py @@ -38,6 +38,13 @@ class InputFile(ABC): class BufferedInputFile(InputFile): def __init__(self, file: bytes, filename: str, chunk_size: int = DEFAULT_CHUNK_SIZE): + """ + Represents object for uploading files from filesystem + + :param file: Bytes + :param filename: Filename to be propagated to telegram. + :param chunk_size: Uploading chunk size + """ super().__init__(filename=filename, chunk_size=chunk_size) self.data = file @@ -49,6 +56,15 @@ class BufferedInputFile(InputFile): filename: Optional[str] = None, chunk_size: int = DEFAULT_CHUNK_SIZE, ) -> BufferedInputFile: + """ + Create buffer from file + + :param path: Path to file + :param filename: Filename to be propagated to telegram. + By default will be parsed from path + :param chunk_size: Uploading chunk size + :return: instance of :obj:`BufferedInputFile` + """ if filename is None: filename = os.path.basename(path) with open(path, "rb") as f: @@ -70,6 +86,14 @@ class FSInputFile(InputFile): filename: Optional[str] = None, chunk_size: int = DEFAULT_CHUNK_SIZE, ): + """ + Represents object for uploading files from filesystem + + :param path: Path to file + :param filename: Filename to be propagated to telegram. + By default will be parsed from path + :param chunk_size: Uploading chunk size + """ if filename is None: filename = os.path.basename(path) super().__init__(filename=filename, chunk_size=chunk_size) @@ -92,6 +116,13 @@ class URLInputFile(InputFile): chunk_size: int = DEFAULT_CHUNK_SIZE, timeout: int = 30, ): + """ + Represents object for streaming files from internet + + :param url: URL in internet + :param filename: Filename to be propagated to telegram. + :param chunk_size: Uploading chunk size + """ super().__init__(filename=filename, chunk_size=chunk_size) self.url = url diff --git a/docs2/Makefile b/docs2/Makefile new file mode 100644 index 00000000..f48952a6 --- /dev/null +++ b/docs2/Makefile @@ -0,0 +1,24 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SPHINXINTL ?= sphinx-intl +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +update-intl: gettext + $(SPHINXINTL) update -p $(BUILDDIR)/gettext $(O) + +.PHONY: help update-intl Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs2/_static/basics_middleware.png b/docs2/_static/basics_middleware.png new file mode 100644 index 00000000..b4165e2e Binary files /dev/null and b/docs2/_static/basics_middleware.png differ diff --git a/docs2/_static/logo.png b/docs2/_static/logo.png new file mode 100755 index 00000000..b363701d Binary files /dev/null and b/docs2/_static/logo.png differ diff --git a/docs2/_static/middleware_pipeline.png b/docs2/_static/middleware_pipeline.png new file mode 100644 index 00000000..dcb20d6f Binary files /dev/null and b/docs2/_static/middleware_pipeline.png differ diff --git a/docs2/_static/middleware_pipeline_nested.png b/docs2/_static/middleware_pipeline_nested.png new file mode 100644 index 00000000..f7a6195a Binary files /dev/null and b/docs2/_static/middleware_pipeline_nested.png differ diff --git a/docs2/_static/nested_routers_example.png b/docs2/_static/nested_routers_example.png new file mode 100644 index 00000000..8ccd824f Binary files /dev/null and b/docs2/_static/nested_routers_example.png differ diff --git a/docs2/_static/update_propagation_flow.png b/docs2/_static/update_propagation_flow.png new file mode 100644 index 00000000..1bd3667f Binary files /dev/null and b/docs2/_static/update_propagation_flow.png differ diff --git a/docs2/api/bot.rst b/docs2/api/bot.rst new file mode 100644 index 00000000..9f40aca1 --- /dev/null +++ b/docs2/api/bot.rst @@ -0,0 +1,17 @@ +### +Bot +### + +Bot instance can be created from :code:`aiogram.Bot` (:code:`from aiogram import Bot`) and +you can't use API methods without instance of bot with configured token. + +This class has aliases for all API methods and named in :code:`lower_camel_case`. + +For example :code:`sendMessage` named :code:`send_message` and has the same specification with all class-based methods. + +.. autoclass:: aiogram.api.client.bot.Bot + :members: + :show-inheritance: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/download_file.rst b/docs2/api/download_file.rst new file mode 100644 index 00000000..028eb723 --- /dev/null +++ b/docs2/api/download_file.rst @@ -0,0 +1,97 @@ +##################### +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 `__. + +For example, download the document that came to the bot. + +.. code-block:: + file_id = message.document.file_id + +Then use the `getFile `__ method to get `file_path`. + +.. code-block:: + + 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 (:obj:`io.BytesIO`) use default +value of destination and handle result of this method. + +.. autoclass:: aiogram.api.client.bot.Bot + :members: download_file + :exclude-members: __init__ + +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. + +.. code-block:: + + 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 +:obj:`typing.BinaryIO` type or use the default (:obj:`None`) value. + +In the first case, the function will return your object: + +.. code-block:: + + 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 :obj:`io.BytesIO` object will be created and returned. + +.. code-block:: + + 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 (:obj:`io.BytesIO`) use default +value of destination and handle result of this method. + +.. autoclass:: aiogram.api.client.bot.Bot + :members: download + :exclude-members: __init__ + +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`. + +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: + +.. code-block:: + + document = message.document + await bot.download(document) diff --git a/docs2/api/index.rst b/docs2/api/index.rst new file mode 100644 index 00000000..90ae61a2 --- /dev/null +++ b/docs2/api/index.rst @@ -0,0 +1,15 @@ +####### +Bot API +####### + +**aiogram** now is fully support of `Telegram Bot API `_ + +All API methods and types is fully autogenerated from Telegram Bot API docs by parser with code-generator. + +.. toctree:: + bot + session/index + types/index + methods/index + download_file + upload_file diff --git a/docs2/api/methods/add_sticker_to_set.rst b/docs2/api/methods/add_sticker_to_set.rst new file mode 100644 index 00000000..82d4f454 --- /dev/null +++ b/docs2/api/methods/add_sticker_to_set.rst @@ -0,0 +1,55 @@ +############### +addStickerToSet +############### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.add_sticker_to_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.add_sticker_to_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AddStickerToSet` +- :code:`from aiogram.api.methods import AddStickerToSet` +- :code:`from aiogram.api.methods.add_sticker_to_set import AddStickerToSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AddStickerToSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AddStickerToSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AddStickerToSet(...) \ No newline at end of file diff --git a/docs2/api/methods/answer_callback_query.rst b/docs2/api/methods/answer_callback_query.rst new file mode 100644 index 00000000..d0c602cd --- /dev/null +++ b/docs2/api/methods/answer_callback_query.rst @@ -0,0 +1,57 @@ +################### +answerCallbackQuery +################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_callback_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_callback_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerCallbackQuery` +- :code:`from aiogram.api.methods import AnswerCallbackQuery` +- :code:`from aiogram.api.methods.answer_callback_query import AnswerCallbackQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerCallbackQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerCallbackQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerCallbackQuery(...) \ No newline at end of file diff --git a/docs2/api/methods/answer_inline_query.rst b/docs2/api/methods/answer_inline_query.rst new file mode 100644 index 00000000..09040291 --- /dev/null +++ b/docs2/api/methods/answer_inline_query.rst @@ -0,0 +1,57 @@ +################# +answerInlineQuery +################# + +Use this method to send answers to an inline query. On success, True is returned. + +No more than 50 results per query are allowed. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_inline_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_inline_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerInlineQuery` +- :code:`from aiogram.api.methods import AnswerInlineQuery` +- :code:`from aiogram.api.methods.answer_inline_query import AnswerInlineQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerInlineQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerInlineQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerInlineQuery(...) \ No newline at end of file diff --git a/docs2/api/methods/answer_pre_checkout_query.rst b/docs2/api/methods/answer_pre_checkout_query.rst new file mode 100644 index 00000000..9809bc67 --- /dev/null +++ b/docs2/api/methods/answer_pre_checkout_query.rst @@ -0,0 +1,55 @@ +###################### +answerPreCheckoutQuery +###################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_pre_checkout_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_pre_checkout_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerPreCheckoutQuery` +- :code:`from aiogram.api.methods import AnswerPreCheckoutQuery` +- :code:`from aiogram.api.methods.answer_pre_checkout_query import AnswerPreCheckoutQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerPreCheckoutQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerPreCheckoutQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerPreCheckoutQuery(...) \ No newline at end of file diff --git a/docs2/api/methods/answer_shipping_query.rst b/docs2/api/methods/answer_shipping_query.rst new file mode 100644 index 00000000..35ce6199 --- /dev/null +++ b/docs2/api/methods/answer_shipping_query.rst @@ -0,0 +1,55 @@ +################### +answerShippingQuery +################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.answer_shipping_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.answer_shipping_query(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import AnswerShippingQuery` +- :code:`from aiogram.api.methods import AnswerShippingQuery` +- :code:`from aiogram.api.methods.answer_shipping_query import AnswerShippingQuery` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await AnswerShippingQuery(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(AnswerShippingQuery(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return AnswerShippingQuery(...) \ No newline at end of file diff --git a/docs2/api/methods/create_new_sticker_set.rst b/docs2/api/methods/create_new_sticker_set.rst new file mode 100644 index 00000000..70d98636 --- /dev/null +++ b/docs2/api/methods/create_new_sticker_set.rst @@ -0,0 +1,55 @@ +################### +createNewStickerSet +################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.create_new_sticker_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.create_new_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import CreateNewStickerSet` +- :code:`from aiogram.api.methods import CreateNewStickerSet` +- :code:`from aiogram.api.methods.create_new_sticker_set import CreateNewStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await CreateNewStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(CreateNewStickerSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return CreateNewStickerSet(...) \ No newline at end of file diff --git a/docs2/api/methods/delete_chat_photo.rst b/docs2/api/methods/delete_chat_photo.rst new file mode 100644 index 00000000..209f4752 --- /dev/null +++ b/docs2/api/methods/delete_chat_photo.rst @@ -0,0 +1,55 @@ +############### +deleteChatPhoto +############### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_chat_photo + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_chat_photo(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteChatPhoto` +- :code:`from aiogram.api.methods import DeleteChatPhoto` +- :code:`from aiogram.api.methods.delete_chat_photo import DeleteChatPhoto` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteChatPhoto(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteChatPhoto(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteChatPhoto(...) \ No newline at end of file diff --git a/docs2/api/methods/delete_chat_sticker_set.rst b/docs2/api/methods/delete_chat_sticker_set.rst new file mode 100644 index 00000000..7385050e --- /dev/null +++ b/docs2/api/methods/delete_chat_sticker_set.rst @@ -0,0 +1,55 @@ +#################### +deleteChatStickerSet +#################### + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_chat_sticker_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_chat_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteChatStickerSet` +- :code:`from aiogram.api.methods import DeleteChatStickerSet` +- :code:`from aiogram.api.methods.delete_chat_sticker_set import DeleteChatStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteChatStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteChatStickerSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteChatStickerSet(...) \ No newline at end of file diff --git a/docs2/api/methods/delete_message.rst b/docs2/api/methods/delete_message.rst new file mode 100644 index 00000000..41ebaee4 --- /dev/null +++ b/docs2/api/methods/delete_message.rst @@ -0,0 +1,71 @@ +############# +deleteMessage +############# + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_message + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteMessage` +- :code:`from aiogram.api.methods import DeleteMessage` +- :code:`from aiogram.api.methods.delete_message import DeleteMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteMessage(...) \ No newline at end of file diff --git a/docs2/api/methods/delete_sticker_from_set.rst b/docs2/api/methods/delete_sticker_from_set.rst new file mode 100644 index 00000000..80daaa16 --- /dev/null +++ b/docs2/api/methods/delete_sticker_from_set.rst @@ -0,0 +1,55 @@ +#################### +deleteStickerFromSet +#################### + +Use this method to delete a sticker from a set created by the bot. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_sticker_from_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_sticker_from_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteStickerFromSet` +- :code:`from aiogram.api.methods import DeleteStickerFromSet` +- :code:`from aiogram.api.methods.delete_sticker_from_set import DeleteStickerFromSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteStickerFromSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteStickerFromSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteStickerFromSet(...) \ No newline at end of file diff --git a/docs2/api/methods/delete_webhook.rst b/docs2/api/methods/delete_webhook.rst new file mode 100644 index 00000000..ddf0c126 --- /dev/null +++ b/docs2/api/methods/delete_webhook.rst @@ -0,0 +1,55 @@ +############# +deleteWebhook +############# + +Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.delete_webhook + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.delete_webhook(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import DeleteWebhook` +- :code:`from aiogram.api.methods import DeleteWebhook` +- :code:`from aiogram.api.methods.delete_webhook import DeleteWebhook` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await DeleteWebhook(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(DeleteWebhook(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return DeleteWebhook(...) \ No newline at end of file diff --git a/docs2/api/methods/edit_message_caption.rst b/docs2/api/methods/edit_message_caption.rst new file mode 100644 index 00000000..0ee58b74 --- /dev/null +++ b/docs2/api/methods/edit_message_caption.rst @@ -0,0 +1,55 @@ +################## +editMessageCaption +################## + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_caption + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_caption(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageCaption` +- :code:`from aiogram.api.methods import EditMessageCaption` +- :code:`from aiogram.api.methods.edit_message_caption import EditMessageCaption` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageCaption(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageCaption(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageCaption(...) \ No newline at end of file diff --git a/docs2/api/methods/edit_message_live_location.rst b/docs2/api/methods/edit_message_live_location.rst new file mode 100644 index 00000000..77ee05d0 --- /dev/null +++ b/docs2/api/methods/edit_message_live_location.rst @@ -0,0 +1,55 @@ +####################### +editMessageLiveLocation +####################### + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_live_location + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_live_location(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageLiveLocation` +- :code:`from aiogram.api.methods import EditMessageLiveLocation` +- :code:`from aiogram.api.methods.edit_message_live_location import EditMessageLiveLocation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageLiveLocation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageLiveLocation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageLiveLocation(...) \ No newline at end of file diff --git a/docs2/api/methods/edit_message_media.rst b/docs2/api/methods/edit_message_media.rst new file mode 100644 index 00000000..ed376534 --- /dev/null +++ b/docs2/api/methods/edit_message_media.rst @@ -0,0 +1,55 @@ +################ +editMessageMedia +################ + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_media + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_media(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageMedia` +- :code:`from aiogram.api.methods import EditMessageMedia` +- :code:`from aiogram.api.methods.edit_message_media import EditMessageMedia` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageMedia(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageMedia(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageMedia(...) \ No newline at end of file diff --git a/docs2/api/methods/edit_message_reply_markup.rst b/docs2/api/methods/edit_message_reply_markup.rst new file mode 100644 index 00000000..fcee14f0 --- /dev/null +++ b/docs2/api/methods/edit_message_reply_markup.rst @@ -0,0 +1,55 @@ +###################### +editMessageReplyMarkup +###################### + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_reply_markup + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_reply_markup(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageReplyMarkup` +- :code:`from aiogram.api.methods import EditMessageReplyMarkup` +- :code:`from aiogram.api.methods.edit_message_reply_markup import EditMessageReplyMarkup` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageReplyMarkup(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageReplyMarkup(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageReplyMarkup(...) \ No newline at end of file diff --git a/docs2/api/methods/edit_message_text.rst b/docs2/api/methods/edit_message_text.rst new file mode 100644 index 00000000..af456971 --- /dev/null +++ b/docs2/api/methods/edit_message_text.rst @@ -0,0 +1,55 @@ +############### +editMessageText +############### + +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. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.edit_message_text + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.edit_message_text(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import EditMessageText` +- :code:`from aiogram.api.methods import EditMessageText` +- :code:`from aiogram.api.methods.edit_message_text import EditMessageText` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await EditMessageText(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(EditMessageText(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return EditMessageText(...) \ No newline at end of file diff --git a/docs2/api/methods/export_chat_invite_link.rst b/docs2/api/methods/export_chat_invite_link.rst new file mode 100644 index 00000000..a5ed0f04 --- /dev/null +++ b/docs2/api/methods/export_chat_invite_link.rst @@ -0,0 +1,57 @@ +#################### +exportChatInviteLink +#################### + +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. + +Returns: :obj:`str` + +.. automodule:: aiogram.api.methods.export_chat_invite_link + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: str = await bot.export_chat_invite_link(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import ExportChatInviteLink` +- :code:`from aiogram.api.methods import ExportChatInviteLink` +- :code:`from aiogram.api.methods.export_chat_invite_link import ExportChatInviteLink` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: str = await ExportChatInviteLink(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: str = await bot(ExportChatInviteLink(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return ExportChatInviteLink(...) \ No newline at end of file diff --git a/docs2/api/methods/forward_message.rst b/docs2/api/methods/forward_message.rst new file mode 100644 index 00000000..443c4b5d --- /dev/null +++ b/docs2/api/methods/forward_message.rst @@ -0,0 +1,55 @@ +############## +forwardMessage +############## + +Use this method to forward messages of any kind. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.forward_message + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.forward_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import ForwardMessage` +- :code:`from aiogram.api.methods import ForwardMessage` +- :code:`from aiogram.api.methods.forward_message import ForwardMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await ForwardMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(ForwardMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return ForwardMessage(...) \ No newline at end of file diff --git a/docs2/api/methods/get_chat.rst b/docs2/api/methods/get_chat.rst new file mode 100644 index 00000000..e9a3101c --- /dev/null +++ b/docs2/api/methods/get_chat.rst @@ -0,0 +1,49 @@ +####### +getChat +####### + +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. + +Returns: :obj:`Chat` + +.. automodule:: aiogram.api.methods.get_chat + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Chat = await bot.get_chat(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChat` +- :code:`from aiogram.api.methods import GetChat` +- :code:`from aiogram.api.methods.get_chat import GetChat` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Chat = await GetChat(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Chat = await bot(GetChat(...)) + diff --git a/docs2/api/methods/get_chat_administrators.rst b/docs2/api/methods/get_chat_administrators.rst new file mode 100644 index 00000000..5c10491f --- /dev/null +++ b/docs2/api/methods/get_chat_administrators.rst @@ -0,0 +1,49 @@ +##################### +getChatAdministrators +##################### + +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. + +Returns: :obj:`List[ChatMember]` + +.. automodule:: aiogram.api.methods.get_chat_administrators + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[ChatMember] = await bot.get_chat_administrators(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChatAdministrators` +- :code:`from aiogram.api.methods import GetChatAdministrators` +- :code:`from aiogram.api.methods.get_chat_administrators import GetChatAdministrators` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[ChatMember] = await GetChatAdministrators(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[ChatMember] = await bot(GetChatAdministrators(...)) + diff --git a/docs2/api/methods/get_chat_member.rst b/docs2/api/methods/get_chat_member.rst new file mode 100644 index 00000000..07d53460 --- /dev/null +++ b/docs2/api/methods/get_chat_member.rst @@ -0,0 +1,49 @@ +############# +getChatMember +############# + +Use this method to get information about a member of a chat. Returns a ChatMember object on success. + +Returns: :obj:`ChatMember` + +.. automodule:: aiogram.api.methods.get_chat_member + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: ChatMember = await bot.get_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChatMember` +- :code:`from aiogram.api.methods import GetChatMember` +- :code:`from aiogram.api.methods.get_chat_member import GetChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: ChatMember = await GetChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: ChatMember = await bot(GetChatMember(...)) + diff --git a/docs2/api/methods/get_chat_members_count.rst b/docs2/api/methods/get_chat_members_count.rst new file mode 100644 index 00000000..4cd69f66 --- /dev/null +++ b/docs2/api/methods/get_chat_members_count.rst @@ -0,0 +1,49 @@ +################### +getChatMembersCount +################### + +Use this method to get the number of members in a chat. Returns Int on success. + +Returns: :obj:`int` + +.. automodule:: aiogram.api.methods.get_chat_members_count + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: int = await bot.get_chat_members_count(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetChatMembersCount` +- :code:`from aiogram.api.methods import GetChatMembersCount` +- :code:`from aiogram.api.methods.get_chat_members_count import GetChatMembersCount` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: int = await GetChatMembersCount(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: int = await bot(GetChatMembersCount(...)) + diff --git a/docs2/api/methods/get_file.rst b/docs2/api/methods/get_file.rst new file mode 100644 index 00000000..cc40a00b --- /dev/null +++ b/docs2/api/methods/get_file.rst @@ -0,0 +1,51 @@ +####### +getFile +####### + +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/, where 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. + +Returns: :obj:`File` + +.. automodule:: aiogram.api.methods.get_file + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: File = await bot.get_file(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetFile` +- :code:`from aiogram.api.methods import GetFile` +- :code:`from aiogram.api.methods.get_file import GetFile` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: File = await GetFile(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: File = await bot(GetFile(...)) + diff --git a/docs2/api/methods/get_game_high_scores.rst b/docs2/api/methods/get_game_high_scores.rst new file mode 100644 index 00000000..e4171f55 --- /dev/null +++ b/docs2/api/methods/get_game_high_scores.rst @@ -0,0 +1,51 @@ +################# +getGameHighScores +################# + +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. + +Returns: :obj:`List[GameHighScore]` + +.. automodule:: aiogram.api.methods.get_game_high_scores + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[GameHighScore] = await bot.get_game_high_scores(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetGameHighScores` +- :code:`from aiogram.api.methods import GetGameHighScores` +- :code:`from aiogram.api.methods.get_game_high_scores import GetGameHighScores` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[GameHighScore] = await GetGameHighScores(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[GameHighScore] = await bot(GetGameHighScores(...)) + diff --git a/docs2/api/methods/get_me.rst b/docs2/api/methods/get_me.rst new file mode 100644 index 00000000..6d0fda74 --- /dev/null +++ b/docs2/api/methods/get_me.rst @@ -0,0 +1,49 @@ +##### +getMe +##### + +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. + +Returns: :obj:`User` + +.. automodule:: aiogram.api.methods.get_me + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: User = await bot.get_me(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetMe` +- :code:`from aiogram.api.methods import GetMe` +- :code:`from aiogram.api.methods.get_me import GetMe` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: User = await GetMe(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: User = await bot(GetMe(...)) + diff --git a/docs2/api/methods/get_my_commands.rst b/docs2/api/methods/get_my_commands.rst new file mode 100644 index 00000000..103539e8 --- /dev/null +++ b/docs2/api/methods/get_my_commands.rst @@ -0,0 +1,49 @@ +############# +getMyCommands +############# + +Use this method to get the current list of the bot's commands. Requires no parameters. Returns Array of BotCommand on success. + +Returns: :obj:`List[BotCommand]` + +.. automodule:: aiogram.api.methods.get_my_commands + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[BotCommand] = await bot.get_my_commands(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetMyCommands` +- :code:`from aiogram.api.methods import GetMyCommands` +- :code:`from aiogram.api.methods.get_my_commands import GetMyCommands` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[BotCommand] = await GetMyCommands(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[BotCommand] = await bot(GetMyCommands(...)) + diff --git a/docs2/api/methods/get_sticker_set.rst b/docs2/api/methods/get_sticker_set.rst new file mode 100644 index 00000000..d7694f61 --- /dev/null +++ b/docs2/api/methods/get_sticker_set.rst @@ -0,0 +1,49 @@ +############# +getStickerSet +############# + +Use this method to get a sticker set. On success, a StickerSet object is returned. + +Returns: :obj:`StickerSet` + +.. automodule:: aiogram.api.methods.get_sticker_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: StickerSet = await bot.get_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetStickerSet` +- :code:`from aiogram.api.methods import GetStickerSet` +- :code:`from aiogram.api.methods.get_sticker_set import GetStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: StickerSet = await GetStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: StickerSet = await bot(GetStickerSet(...)) + diff --git a/docs2/api/methods/get_updates.rst b/docs2/api/methods/get_updates.rst new file mode 100644 index 00000000..068cd31a --- /dev/null +++ b/docs2/api/methods/get_updates.rst @@ -0,0 +1,55 @@ +########## +getUpdates +########## + +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. + +Returns: :obj:`List[Update]` + +.. automodule:: aiogram.api.methods.get_updates + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[Update] = await bot.get_updates(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetUpdates` +- :code:`from aiogram.api.methods import GetUpdates` +- :code:`from aiogram.api.methods.get_updates import GetUpdates` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[Update] = await GetUpdates(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[Update] = await bot(GetUpdates(...)) + diff --git a/docs2/api/methods/get_user_profile_photos.rst b/docs2/api/methods/get_user_profile_photos.rst new file mode 100644 index 00000000..ac68e32c --- /dev/null +++ b/docs2/api/methods/get_user_profile_photos.rst @@ -0,0 +1,49 @@ +#################### +getUserProfilePhotos +#################### + +Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. + +Returns: :obj:`UserProfilePhotos` + +.. automodule:: aiogram.api.methods.get_user_profile_photos + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: UserProfilePhotos = await bot.get_user_profile_photos(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetUserProfilePhotos` +- :code:`from aiogram.api.methods import GetUserProfilePhotos` +- :code:`from aiogram.api.methods.get_user_profile_photos import GetUserProfilePhotos` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: UserProfilePhotos = await GetUserProfilePhotos(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: UserProfilePhotos = await bot(GetUserProfilePhotos(...)) + diff --git a/docs2/api/methods/get_webhook_info.rst b/docs2/api/methods/get_webhook_info.rst new file mode 100644 index 00000000..94381347 --- /dev/null +++ b/docs2/api/methods/get_webhook_info.rst @@ -0,0 +1,49 @@ +############## +getWebhookInfo +############## + +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. + +Returns: :obj:`WebhookInfo` + +.. automodule:: aiogram.api.methods.get_webhook_info + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: WebhookInfo = await bot.get_webhook_info(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import GetWebhookInfo` +- :code:`from aiogram.api.methods import GetWebhookInfo` +- :code:`from aiogram.api.methods.get_webhook_info import GetWebhookInfo` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: WebhookInfo = await GetWebhookInfo(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: WebhookInfo = await bot(GetWebhookInfo(...)) + diff --git a/docs2/api/methods/index.rst b/docs2/api/methods/index.rst new file mode 100644 index 00000000..5d4f0f70 --- /dev/null +++ b/docs2/api/methods/index.rst @@ -0,0 +1,138 @@ +####### +Methods +####### + +All API methods is wrapped as `pydantic `_ models +and placed in :mod:`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 :code:`sendMessage` has the name :code:`SendMessage` + + +Getting updates +=============== + +.. toctree:: + :maxdepth: 1 + + get_updates + set_webhook + delete_webhook + get_webhook_info + + +Available methods +================= + +.. toctree:: + :maxdepth: 1 + + get_me + send_message + forward_message + send_photo + send_audio + send_document + send_video + send_animation + send_voice + send_video_note + send_media_group + send_location + edit_message_live_location + stop_message_live_location + send_venue + send_contact + send_poll + send_dice + send_chat_action + get_user_profile_photos + get_file + kick_chat_member + unban_chat_member + restrict_chat_member + promote_chat_member + set_chat_administrator_custom_title + set_chat_permissions + export_chat_invite_link + set_chat_photo + delete_chat_photo + set_chat_title + set_chat_description + pin_chat_message + unpin_chat_message + leave_chat + get_chat + get_chat_administrators + get_chat_members_count + get_chat_member + set_chat_sticker_set + delete_chat_sticker_set + answer_callback_query + set_my_commands + get_my_commands + +Updating messages +================= + +.. toctree:: + :maxdepth: 1 + + edit_message_text + edit_message_caption + edit_message_media + edit_message_reply_markup + stop_poll + delete_message + +Stickers +======== + +.. toctree:: + :maxdepth: 1 + + send_sticker + get_sticker_set + upload_sticker_file + create_new_sticker_set + add_sticker_to_set + set_sticker_position_in_set + delete_sticker_from_set + set_sticker_set_thumb + +Inline mode +=========== + +.. toctree:: + :maxdepth: 1 + + answer_inline_query + +Payments +======== + +.. toctree:: + :maxdepth: 1 + + send_invoice + answer_shipping_query + answer_pre_checkout_query + +Telegram Passport +================= + +.. toctree:: + :maxdepth: 1 + + set_passport_data_errors + +Games +===== + +.. toctree:: + :maxdepth: 1 + + send_game + set_game_score + get_game_high_scores diff --git a/docs2/api/methods/kick_chat_member.rst b/docs2/api/methods/kick_chat_member.rst new file mode 100644 index 00000000..14bceb76 --- /dev/null +++ b/docs2/api/methods/kick_chat_member.rst @@ -0,0 +1,55 @@ +############## +kickChatMember +############## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.kick_chat_member + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.kick_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import KickChatMember` +- :code:`from aiogram.api.methods import KickChatMember` +- :code:`from aiogram.api.methods.kick_chat_member import KickChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await KickChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(KickChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return KickChatMember(...) \ No newline at end of file diff --git a/docs2/api/methods/leave_chat.rst b/docs2/api/methods/leave_chat.rst new file mode 100644 index 00000000..c8497475 --- /dev/null +++ b/docs2/api/methods/leave_chat.rst @@ -0,0 +1,55 @@ +######### +leaveChat +######### + +Use this method for your bot to leave a group, supergroup or channel. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.leave_chat + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.leave_chat(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import LeaveChat` +- :code:`from aiogram.api.methods import LeaveChat` +- :code:`from aiogram.api.methods.leave_chat import LeaveChat` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await LeaveChat(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(LeaveChat(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return LeaveChat(...) \ No newline at end of file diff --git a/docs2/api/methods/pin_chat_message.rst b/docs2/api/methods/pin_chat_message.rst new file mode 100644 index 00000000..60728235 --- /dev/null +++ b/docs2/api/methods/pin_chat_message.rst @@ -0,0 +1,55 @@ +############## +pinChatMessage +############## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.pin_chat_message + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.pin_chat_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import PinChatMessage` +- :code:`from aiogram.api.methods import PinChatMessage` +- :code:`from aiogram.api.methods.pin_chat_message import PinChatMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await PinChatMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(PinChatMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return PinChatMessage(...) \ No newline at end of file diff --git a/docs2/api/methods/promote_chat_member.rst b/docs2/api/methods/promote_chat_member.rst new file mode 100644 index 00000000..4cbbb89d --- /dev/null +++ b/docs2/api/methods/promote_chat_member.rst @@ -0,0 +1,55 @@ +################# +promoteChatMember +################# + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.promote_chat_member + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.promote_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import PromoteChatMember` +- :code:`from aiogram.api.methods import PromoteChatMember` +- :code:`from aiogram.api.methods.promote_chat_member import PromoteChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await PromoteChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(PromoteChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return PromoteChatMember(...) \ No newline at end of file diff --git a/docs2/api/methods/restrict_chat_member.rst b/docs2/api/methods/restrict_chat_member.rst new file mode 100644 index 00000000..7b7fe121 --- /dev/null +++ b/docs2/api/methods/restrict_chat_member.rst @@ -0,0 +1,55 @@ +################## +restrictChatMember +################## + +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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.restrict_chat_member + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.restrict_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import RestrictChatMember` +- :code:`from aiogram.api.methods import RestrictChatMember` +- :code:`from aiogram.api.methods.restrict_chat_member import RestrictChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await RestrictChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(RestrictChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return RestrictChatMember(...) \ No newline at end of file diff --git a/docs2/api/methods/send_animation.rst b/docs2/api/methods/send_animation.rst new file mode 100644 index 00000000..a26c41fa --- /dev/null +++ b/docs2/api/methods/send_animation.rst @@ -0,0 +1,55 @@ +############# +sendAnimation +############# + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_animation + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_animation(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendAnimation` +- :code:`from aiogram.api.methods import SendAnimation` +- :code:`from aiogram.api.methods.send_animation import SendAnimation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendAnimation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendAnimation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendAnimation(...) \ No newline at end of file diff --git a/docs2/api/methods/send_audio.rst b/docs2/api/methods/send_audio.rst new file mode 100644 index 00000000..7c797c4f --- /dev/null +++ b/docs2/api/methods/send_audio.rst @@ -0,0 +1,57 @@ +######### +sendAudio +######### + +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. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_audio + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_audio(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendAudio` +- :code:`from aiogram.api.methods import SendAudio` +- :code:`from aiogram.api.methods.send_audio import SendAudio` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendAudio(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendAudio(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendAudio(...) \ No newline at end of file diff --git a/docs2/api/methods/send_chat_action.rst b/docs2/api/methods/send_chat_action.rst new file mode 100644 index 00000000..a2ad32c7 --- /dev/null +++ b/docs2/api/methods/send_chat_action.rst @@ -0,0 +1,59 @@ +############## +sendChatAction +############## + +Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. + +Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of 'Retrieving image, please wait…', the bot may use sendChatAction with action = upload_photo. The user will see a 'sending photo' status for the bot. + +We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.send_chat_action + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.send_chat_action(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendChatAction` +- :code:`from aiogram.api.methods import SendChatAction` +- :code:`from aiogram.api.methods.send_chat_action import SendChatAction` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SendChatAction(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SendChatAction(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendChatAction(...) \ No newline at end of file diff --git a/docs2/api/methods/send_contact.rst b/docs2/api/methods/send_contact.rst new file mode 100644 index 00000000..df912679 --- /dev/null +++ b/docs2/api/methods/send_contact.rst @@ -0,0 +1,55 @@ +########### +sendContact +########### + +Use this method to send phone contacts. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_contact + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_contact(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendContact` +- :code:`from aiogram.api.methods import SendContact` +- :code:`from aiogram.api.methods.send_contact import SendContact` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendContact(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendContact(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendContact(...) \ No newline at end of file diff --git a/docs2/api/methods/send_dice.rst b/docs2/api/methods/send_dice.rst new file mode 100644 index 00000000..f58b410e --- /dev/null +++ b/docs2/api/methods/send_dice.rst @@ -0,0 +1,55 @@ +######## +sendDice +######## + +Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_dice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_dice(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendDice` +- :code:`from aiogram.api.methods import SendDice` +- :code:`from aiogram.api.methods.send_dice import SendDice` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendDice(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendDice(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendDice(...) \ No newline at end of file diff --git a/docs2/api/methods/send_document.rst b/docs2/api/methods/send_document.rst new file mode 100644 index 00000000..afa2de3e --- /dev/null +++ b/docs2/api/methods/send_document.rst @@ -0,0 +1,55 @@ +############ +sendDocument +############ + +Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_document + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_document(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendDocument` +- :code:`from aiogram.api.methods import SendDocument` +- :code:`from aiogram.api.methods.send_document import SendDocument` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendDocument(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendDocument(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendDocument(...) \ No newline at end of file diff --git a/docs2/api/methods/send_game.rst b/docs2/api/methods/send_game.rst new file mode 100644 index 00000000..efad6f68 --- /dev/null +++ b/docs2/api/methods/send_game.rst @@ -0,0 +1,55 @@ +######## +sendGame +######## + +Use this method to send a game. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_game + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_game(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendGame` +- :code:`from aiogram.api.methods import SendGame` +- :code:`from aiogram.api.methods.send_game import SendGame` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendGame(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendGame(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendGame(...) \ No newline at end of file diff --git a/docs2/api/methods/send_invoice.rst b/docs2/api/methods/send_invoice.rst new file mode 100644 index 00000000..5409b2ec --- /dev/null +++ b/docs2/api/methods/send_invoice.rst @@ -0,0 +1,55 @@ +########### +sendInvoice +########### + +Use this method to send invoices. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_invoice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_invoice(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendInvoice` +- :code:`from aiogram.api.methods import SendInvoice` +- :code:`from aiogram.api.methods.send_invoice import SendInvoice` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendInvoice(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendInvoice(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendInvoice(...) \ No newline at end of file diff --git a/docs2/api/methods/send_location.rst b/docs2/api/methods/send_location.rst new file mode 100644 index 00000000..5410e967 --- /dev/null +++ b/docs2/api/methods/send_location.rst @@ -0,0 +1,55 @@ +############ +sendLocation +############ + +Use this method to send point on the map. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_location + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_location(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendLocation` +- :code:`from aiogram.api.methods import SendLocation` +- :code:`from aiogram.api.methods.send_location import SendLocation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendLocation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendLocation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendLocation(...) \ No newline at end of file diff --git a/docs2/api/methods/send_media_group.rst b/docs2/api/methods/send_media_group.rst new file mode 100644 index 00000000..85c748cd --- /dev/null +++ b/docs2/api/methods/send_media_group.rst @@ -0,0 +1,55 @@ +############## +sendMediaGroup +############## + +Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned. + +Returns: :obj:`List[Message]` + +.. automodule:: aiogram.api.methods.send_media_group + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: List[Message] = await bot.send_media_group(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendMediaGroup` +- :code:`from aiogram.api.methods import SendMediaGroup` +- :code:`from aiogram.api.methods.send_media_group import SendMediaGroup` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: List[Message] = await SendMediaGroup(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: List[Message] = await bot(SendMediaGroup(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendMediaGroup(...) \ No newline at end of file diff --git a/docs2/api/methods/send_message.rst b/docs2/api/methods/send_message.rst new file mode 100644 index 00000000..d17d9aaf --- /dev/null +++ b/docs2/api/methods/send_message.rst @@ -0,0 +1,55 @@ +########### +sendMessage +########### + +Use this method to send text messages. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_message + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendMessage` +- :code:`from aiogram.api.methods import SendMessage` +- :code:`from aiogram.api.methods.send_message import SendMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendMessage(...) \ No newline at end of file diff --git a/docs2/api/methods/send_photo.rst b/docs2/api/methods/send_photo.rst new file mode 100644 index 00000000..450bf9d8 --- /dev/null +++ b/docs2/api/methods/send_photo.rst @@ -0,0 +1,55 @@ +######### +sendPhoto +######### + +Use this method to send photos. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_photo + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_photo(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendPhoto` +- :code:`from aiogram.api.methods import SendPhoto` +- :code:`from aiogram.api.methods.send_photo import SendPhoto` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendPhoto(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendPhoto(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendPhoto(...) \ No newline at end of file diff --git a/docs2/api/methods/send_poll.rst b/docs2/api/methods/send_poll.rst new file mode 100644 index 00000000..9bc1f331 --- /dev/null +++ b/docs2/api/methods/send_poll.rst @@ -0,0 +1,55 @@ +######## +sendPoll +######## + +Use this method to send a native poll. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_poll + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_poll(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendPoll` +- :code:`from aiogram.api.methods import SendPoll` +- :code:`from aiogram.api.methods.send_poll import SendPoll` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendPoll(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendPoll(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendPoll(...) \ No newline at end of file diff --git a/docs2/api/methods/send_sticker.rst b/docs2/api/methods/send_sticker.rst new file mode 100644 index 00000000..a52802ae --- /dev/null +++ b/docs2/api/methods/send_sticker.rst @@ -0,0 +1,55 @@ +########### +sendSticker +########### + +Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_sticker + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_sticker(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendSticker` +- :code:`from aiogram.api.methods import SendSticker` +- :code:`from aiogram.api.methods.send_sticker import SendSticker` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendSticker(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendSticker(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendSticker(...) \ No newline at end of file diff --git a/docs2/api/methods/send_venue.rst b/docs2/api/methods/send_venue.rst new file mode 100644 index 00000000..2ae6fe74 --- /dev/null +++ b/docs2/api/methods/send_venue.rst @@ -0,0 +1,55 @@ +######### +sendVenue +######### + +Use this method to send information about a venue. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_venue + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_venue(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVenue` +- :code:`from aiogram.api.methods import SendVenue` +- :code:`from aiogram.api.methods.send_venue import SendVenue` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVenue(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVenue(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVenue(...) \ No newline at end of file diff --git a/docs2/api/methods/send_video.rst b/docs2/api/methods/send_video.rst new file mode 100644 index 00000000..a896b554 --- /dev/null +++ b/docs2/api/methods/send_video.rst @@ -0,0 +1,55 @@ +######### +sendVideo +######### + +Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_video + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_video(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVideo` +- :code:`from aiogram.api.methods import SendVideo` +- :code:`from aiogram.api.methods.send_video import SendVideo` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVideo(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVideo(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVideo(...) \ No newline at end of file diff --git a/docs2/api/methods/send_video_note.rst b/docs2/api/methods/send_video_note.rst new file mode 100644 index 00000000..e210564f --- /dev/null +++ b/docs2/api/methods/send_video_note.rst @@ -0,0 +1,55 @@ +############# +sendVideoNote +############# + +As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_video_note + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_video_note(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVideoNote` +- :code:`from aiogram.api.methods import SendVideoNote` +- :code:`from aiogram.api.methods.send_video_note import SendVideoNote` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVideoNote(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVideoNote(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVideoNote(...) \ No newline at end of file diff --git a/docs2/api/methods/send_voice.rst b/docs2/api/methods/send_voice.rst new file mode 100644 index 00000000..a701d8ad --- /dev/null +++ b/docs2/api/methods/send_voice.rst @@ -0,0 +1,55 @@ +######### +sendVoice +######### + +Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. + +Returns: :obj:`Message` + +.. automodule:: aiogram.api.methods.send_voice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_voice(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SendVoice` +- :code:`from aiogram.api.methods import SendVoice` +- :code:`from aiogram.api.methods.send_voice import SendVoice` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Message = await SendVoice(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Message = await bot(SendVoice(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SendVoice(...) \ No newline at end of file diff --git a/docs2/api/methods/set_chat_administrator_custom_title.rst b/docs2/api/methods/set_chat_administrator_custom_title.rst new file mode 100644 index 00000000..432365c4 --- /dev/null +++ b/docs2/api/methods/set_chat_administrator_custom_title.rst @@ -0,0 +1,55 @@ +############################### +setChatAdministratorCustomTitle +############################### + +Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_administrator_custom_title + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_administrator_custom_title(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatAdministratorCustomTitle` +- :code:`from aiogram.api.methods import SetChatAdministratorCustomTitle` +- :code:`from aiogram.api.methods.set_chat_administrator_custom_title import SetChatAdministratorCustomTitle` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatAdministratorCustomTitle(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatAdministratorCustomTitle(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatAdministratorCustomTitle(...) \ No newline at end of file diff --git a/docs2/api/methods/set_chat_description.rst b/docs2/api/methods/set_chat_description.rst new file mode 100644 index 00000000..e5079324 --- /dev/null +++ b/docs2/api/methods/set_chat_description.rst @@ -0,0 +1,55 @@ +################## +setChatDescription +################## + +Use this method to change the description of a group, 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. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_description + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_description(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatDescription` +- :code:`from aiogram.api.methods import SetChatDescription` +- :code:`from aiogram.api.methods.set_chat_description import SetChatDescription` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatDescription(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatDescription(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatDescription(...) \ No newline at end of file diff --git a/docs2/api/methods/set_chat_permissions.rst b/docs2/api/methods/set_chat_permissions.rst new file mode 100644 index 00000000..e71a64ce --- /dev/null +++ b/docs2/api/methods/set_chat_permissions.rst @@ -0,0 +1,55 @@ +################## +setChatPermissions +################## + +Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_permissions + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_permissions(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatPermissions` +- :code:`from aiogram.api.methods import SetChatPermissions` +- :code:`from aiogram.api.methods.set_chat_permissions import SetChatPermissions` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatPermissions(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatPermissions(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatPermissions(...) \ No newline at end of file diff --git a/docs2/api/methods/set_chat_photo.rst b/docs2/api/methods/set_chat_photo.rst new file mode 100644 index 00000000..fcfa8431 --- /dev/null +++ b/docs2/api/methods/set_chat_photo.rst @@ -0,0 +1,49 @@ +############ +setChatPhoto +############ + +Use this method to set a new profile photo for the chat. 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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_photo + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_photo(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatPhoto` +- :code:`from aiogram.api.methods import SetChatPhoto` +- :code:`from aiogram.api.methods.set_chat_photo import SetChatPhoto` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatPhoto(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatPhoto(...)) + diff --git a/docs2/api/methods/set_chat_sticker_set.rst b/docs2/api/methods/set_chat_sticker_set.rst new file mode 100644 index 00000000..3d10066e --- /dev/null +++ b/docs2/api/methods/set_chat_sticker_set.rst @@ -0,0 +1,55 @@ +################# +setChatStickerSet +################# + +Use this method to set a new group sticker set for 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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_sticker_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_sticker_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatStickerSet` +- :code:`from aiogram.api.methods import SetChatStickerSet` +- :code:`from aiogram.api.methods.set_chat_sticker_set import SetChatStickerSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatStickerSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatStickerSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatStickerSet(...) \ No newline at end of file diff --git a/docs2/api/methods/set_chat_title.rst b/docs2/api/methods/set_chat_title.rst new file mode 100644 index 00000000..99c08a3f --- /dev/null +++ b/docs2/api/methods/set_chat_title.rst @@ -0,0 +1,55 @@ +############ +setChatTitle +############ + +Use this method to change the title of a chat. Titles 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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_chat_title + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_chat_title(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetChatTitle` +- :code:`from aiogram.api.methods import SetChatTitle` +- :code:`from aiogram.api.methods.set_chat_title import SetChatTitle` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetChatTitle(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetChatTitle(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetChatTitle(...) \ No newline at end of file diff --git a/docs2/api/methods/set_game_score.rst b/docs2/api/methods/set_game_score.rst new file mode 100644 index 00000000..bf50b7c8 --- /dev/null +++ b/docs2/api/methods/set_game_score.rst @@ -0,0 +1,55 @@ +############ +setGameScore +############ + +Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.set_game_score + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.set_game_score(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetGameScore` +- :code:`from aiogram.api.methods import SetGameScore` +- :code:`from aiogram.api.methods.set_game_score import SetGameScore` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await SetGameScore(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(SetGameScore(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetGameScore(...) \ No newline at end of file diff --git a/docs2/api/methods/set_my_commands.rst b/docs2/api/methods/set_my_commands.rst new file mode 100644 index 00000000..71a89a04 --- /dev/null +++ b/docs2/api/methods/set_my_commands.rst @@ -0,0 +1,55 @@ +############# +setMyCommands +############# + +Use this method to change the list of the bot's commands. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_my_commands + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_my_commands(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetMyCommands` +- :code:`from aiogram.api.methods import SetMyCommands` +- :code:`from aiogram.api.methods.set_my_commands import SetMyCommands` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetMyCommands(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetMyCommands(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetMyCommands(...) \ No newline at end of file diff --git a/docs2/api/methods/set_passport_data_errors.rst b/docs2/api/methods/set_passport_data_errors.rst new file mode 100644 index 00000000..64b616d7 --- /dev/null +++ b/docs2/api/methods/set_passport_data_errors.rst @@ -0,0 +1,57 @@ +##################### +setPassportDataErrors +##################### + +Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. + +Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_passport_data_errors + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_passport_data_errors(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetPassportDataErrors` +- :code:`from aiogram.api.methods import SetPassportDataErrors` +- :code:`from aiogram.api.methods.set_passport_data_errors import SetPassportDataErrors` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetPassportDataErrors(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetPassportDataErrors(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetPassportDataErrors(...) \ No newline at end of file diff --git a/docs2/api/methods/set_sticker_position_in_set.rst b/docs2/api/methods/set_sticker_position_in_set.rst new file mode 100644 index 00000000..ec1ed029 --- /dev/null +++ b/docs2/api/methods/set_sticker_position_in_set.rst @@ -0,0 +1,55 @@ +####################### +setStickerPositionInSet +####################### + +Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_sticker_position_in_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_sticker_position_in_set(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetStickerPositionInSet` +- :code:`from aiogram.api.methods import SetStickerPositionInSet` +- :code:`from aiogram.api.methods.set_sticker_position_in_set import SetStickerPositionInSet` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetStickerPositionInSet(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetStickerPositionInSet(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetStickerPositionInSet(...) \ No newline at end of file diff --git a/docs2/api/methods/set_sticker_set_thumb.rst b/docs2/api/methods/set_sticker_set_thumb.rst new file mode 100644 index 00000000..97f5d130 --- /dev/null +++ b/docs2/api/methods/set_sticker_set_thumb.rst @@ -0,0 +1,55 @@ +################## +setStickerSetThumb +################## + +Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_sticker_set_thumb + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_sticker_set_thumb(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetStickerSetThumb` +- :code:`from aiogram.api.methods import SetStickerSetThumb` +- :code:`from aiogram.api.methods.set_sticker_set_thumb import SetStickerSetThumb` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetStickerSetThumb(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetStickerSetThumb(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetStickerSetThumb(...) \ No newline at end of file diff --git a/docs2/api/methods/set_webhook.rst b/docs2/api/methods/set_webhook.rst new file mode 100644 index 00000000..38196ccf --- /dev/null +++ b/docs2/api/methods/set_webhook.rst @@ -0,0 +1,67 @@ +########## +setWebhook +########## + +Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. + +If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/. Since nobody else knows your bot's token, you can be pretty sure it's us. + +Notes + +1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. + +2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. + +3. Ports currently supported for Webhooks: 443, 80, 88, 8443. + +NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to Webhooks. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.set_webhook + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.set_webhook(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import SetWebhook` +- :code:`from aiogram.api.methods import SetWebhook` +- :code:`from aiogram.api.methods.set_webhook import SetWebhook` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await SetWebhook(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(SetWebhook(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return SetWebhook(...) \ No newline at end of file diff --git a/docs2/api/methods/stop_message_live_location.rst b/docs2/api/methods/stop_message_live_location.rst new file mode 100644 index 00000000..f5135490 --- /dev/null +++ b/docs2/api/methods/stop_message_live_location.rst @@ -0,0 +1,55 @@ +####################### +stopMessageLiveLocation +####################### + +Use this method to stop updating a live location message before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned. + +Returns: :obj:`Union[Message, bool]` + +.. automodule:: aiogram.api.methods.stop_message_live_location + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Union[Message, bool] = await bot.stop_message_live_location(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import StopMessageLiveLocation` +- :code:`from aiogram.api.methods import StopMessageLiveLocation` +- :code:`from aiogram.api.methods.stop_message_live_location import StopMessageLiveLocation` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Union[Message, bool] = await StopMessageLiveLocation(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Union[Message, bool] = await bot(StopMessageLiveLocation(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return StopMessageLiveLocation(...) \ No newline at end of file diff --git a/docs2/api/methods/stop_poll.rst b/docs2/api/methods/stop_poll.rst new file mode 100644 index 00000000..fcc4e019 --- /dev/null +++ b/docs2/api/methods/stop_poll.rst @@ -0,0 +1,55 @@ +######## +stopPoll +######## + +Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned. + +Returns: :obj:`Poll` + +.. automodule:: aiogram.api.methods.stop_poll + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Poll = await bot.stop_poll(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import StopPoll` +- :code:`from aiogram.api.methods import StopPoll` +- :code:`from aiogram.api.methods.stop_poll import StopPoll` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: Poll = await StopPoll(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: Poll = await bot(StopPoll(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return StopPoll(...) \ No newline at end of file diff --git a/docs2/api/methods/unban_chat_member.rst b/docs2/api/methods/unban_chat_member.rst new file mode 100644 index 00000000..89af3302 --- /dev/null +++ b/docs2/api/methods/unban_chat_member.rst @@ -0,0 +1,55 @@ +############### +unbanChatMember +############### + +Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.unban_chat_member + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.unban_chat_member(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import UnbanChatMember` +- :code:`from aiogram.api.methods import UnbanChatMember` +- :code:`from aiogram.api.methods.unban_chat_member import UnbanChatMember` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await UnbanChatMember(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(UnbanChatMember(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return UnbanChatMember(...) \ No newline at end of file diff --git a/docs2/api/methods/unpin_chat_message.rst b/docs2/api/methods/unpin_chat_message.rst new file mode 100644 index 00000000..d364453d --- /dev/null +++ b/docs2/api/methods/unpin_chat_message.rst @@ -0,0 +1,55 @@ +################ +unpinChatMessage +################ + +Use this method to unpin 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. + +Returns: :obj:`bool` + +.. automodule:: aiogram.api.methods.unpin_chat_message + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.unpin_chat_message(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import UnpinChatMessage` +- :code:`from aiogram.api.methods import UnpinChatMessage` +- :code:`from aiogram.api.methods.unpin_chat_message import UnpinChatMessage` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: bool = await UnpinChatMessage(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: bool = await bot(UnpinChatMessage(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: + + return UnpinChatMessage(...) \ No newline at end of file diff --git a/docs2/api/methods/upload_sticker_file.rst b/docs2/api/methods/upload_sticker_file.rst new file mode 100644 index 00000000..03ad6d5a --- /dev/null +++ b/docs2/api/methods/upload_sticker_file.rst @@ -0,0 +1,49 @@ +################# +uploadStickerFile +################# + +Use this method to upload a .PNG file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. + +Returns: :obj:`File` + +.. automodule:: aiogram.api.methods.upload_sticker_file + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: File = await bot.upload_sticker_file(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods import UploadStickerFile` +- :code:`from aiogram.api.methods import UploadStickerFile` +- :code:`from aiogram.api.methods.upload_sticker_file import UploadStickerFile` + +In handlers with current bot +---------------------------- + +.. code-block:: + + result: File = await UploadStickerFile(...) + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: + + result: File = await bot(UploadStickerFile(...)) + diff --git a/docs2/api/session/aiohttp.rst b/docs2/api/session/aiohttp.rst new file mode 100644 index 00000000..007dab69 --- /dev/null +++ b/docs2/api/session/aiohttp.rst @@ -0,0 +1,92 @@ +####### +aiohttp +####### + +AiohttpSession represents a wrapper-class around `ClientSession` from `aiohttp `_ + +Currently `AiohttpSession` is a default session used in `aiogram.Bot` + +Usage example +============= + +.. code-block:: + + from aiogram import Bot + from aiogram.api.client.session.aiohttp import AiohttpSession + + session = AiohttpSession() + Bot('42:token', session=session) + + +Proxy requests in AiohttpSession +================================ + +In order to use AiohttpSession with proxy connector you have to install `aiohttp-socks `_ + +Binding session to bot: + +.. code-block:: + from aiogram import Bot + from aiogram.api.client.session.aiohttp import AiohttpSession + + session = AiohttpSession(proxy="protocol://host:port/") + Bot(token="bot token", session=session) + + +.. note:: + + 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 :obj:`aiohttp.BasicAuth` containing +login and password. + +Consider examples: + +.. code-block:: + + from aiohttp import BasicAuth + from aiogram.api.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 + +.. code-block:: + + session = AiohttpSession(proxy="protocol://user:password@host:port") + + +.. note:: + + 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 `_ supports proxy chains, you're able to use them in aiogram + +Example of chain proxies: + +.. code-block:: + + from aiohttp import BasicAuth + from aiogram.api.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 + ) diff --git a/docs2/api/session/base.rst b/docs2/api/session/base.rst new file mode 100644 index 00000000..6a1acd19 --- /dev/null +++ b/docs2/api/session/base.rst @@ -0,0 +1,8 @@ +#### +Base +#### + +Abstract session for all client sessions + +.. autoclass:: aiogram.api.client.session.base.BaseSession + :members: diff --git a/docs2/api/session/index.rst b/docs2/api/session/index.rst new file mode 100644 index 00000000..c9ff9cd6 --- /dev/null +++ b/docs2/api/session/index.rst @@ -0,0 +1,7 @@ +############## +Client session +############## + +.. toctree:: + base + aiohttp diff --git a/docs2/api/types/animation.rst b/docs2/api/types/animation.rst new file mode 100644 index 00000000..5e140064 --- /dev/null +++ b/docs2/api/types/animation.rst @@ -0,0 +1,11 @@ +######### +Animation +######### + +This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). + +.. automodule:: aiogram.api.types.animation + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/audio.rst b/docs2/api/types/audio.rst new file mode 100644 index 00000000..5ddc7047 --- /dev/null +++ b/docs2/api/types/audio.rst @@ -0,0 +1,11 @@ +##### +Audio +##### + +This object represents an audio file to be treated as music by the Telegram clients. + +.. automodule:: aiogram.api.types.audio + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/bot_command.rst b/docs2/api/types/bot_command.rst new file mode 100644 index 00000000..f33cda94 --- /dev/null +++ b/docs2/api/types/bot_command.rst @@ -0,0 +1,11 @@ +########## +BotCommand +########## + +This object represents a bot command. + +.. automodule:: aiogram.api.types.bot_command + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/callback_game.rst b/docs2/api/types/callback_game.rst new file mode 100644 index 00000000..9cb6565f --- /dev/null +++ b/docs2/api/types/callback_game.rst @@ -0,0 +1,11 @@ +############ +CallbackGame +############ + +A placeholder, currently holds no information. Use BotFather to set up your game. + +.. automodule:: aiogram.api.types.callback_game + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/callback_query.rst b/docs2/api/types/callback_query.rst new file mode 100644 index 00000000..6ef622d1 --- /dev/null +++ b/docs2/api/types/callback_query.rst @@ -0,0 +1,13 @@ +############# +CallbackQuery +############# + +This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present. + +NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). + +.. automodule:: aiogram.api.types.callback_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/chat.rst b/docs2/api/types/chat.rst new file mode 100644 index 00000000..04240ef5 --- /dev/null +++ b/docs2/api/types/chat.rst @@ -0,0 +1,11 @@ +#### +Chat +#### + +This object represents a chat. + +.. automodule:: aiogram.api.types.chat + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/chat_member.rst b/docs2/api/types/chat_member.rst new file mode 100644 index 00000000..10bcf77f --- /dev/null +++ b/docs2/api/types/chat_member.rst @@ -0,0 +1,11 @@ +########## +ChatMember +########## + +This object contains information about one member of a chat. + +.. automodule:: aiogram.api.types.chat_member + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/chat_permissions.rst b/docs2/api/types/chat_permissions.rst new file mode 100644 index 00000000..37f611e9 --- /dev/null +++ b/docs2/api/types/chat_permissions.rst @@ -0,0 +1,11 @@ +############### +ChatPermissions +############### + +Describes actions that a non-administrator user is allowed to take in a chat. + +.. automodule:: aiogram.api.types.chat_permissions + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/chat_photo.rst b/docs2/api/types/chat_photo.rst new file mode 100644 index 00000000..74ab833c --- /dev/null +++ b/docs2/api/types/chat_photo.rst @@ -0,0 +1,11 @@ +######### +ChatPhoto +######### + +This object represents a chat photo. + +.. automodule:: aiogram.api.types.chat_photo + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/chosen_inline_result.rst b/docs2/api/types/chosen_inline_result.rst new file mode 100644 index 00000000..699ffb60 --- /dev/null +++ b/docs2/api/types/chosen_inline_result.rst @@ -0,0 +1,13 @@ +################## +ChosenInlineResult +################## + +Represents a result of an inline query that was chosen by the user and sent to their chat partner. + +Note: It is necessary to enable inline feedback via @Botfather in order to receive these objects in updates. + +.. automodule:: aiogram.api.types.chosen_inline_result + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/contact.rst b/docs2/api/types/contact.rst new file mode 100644 index 00000000..32d63abf --- /dev/null +++ b/docs2/api/types/contact.rst @@ -0,0 +1,11 @@ +####### +Contact +####### + +This object represents a phone contact. + +.. automodule:: aiogram.api.types.contact + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/dice.rst b/docs2/api/types/dice.rst new file mode 100644 index 00000000..5bfc1a91 --- /dev/null +++ b/docs2/api/types/dice.rst @@ -0,0 +1,11 @@ +#### +Dice +#### + +This object represents an animated emoji that displays a random value. + +.. automodule:: aiogram.api.types.dice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/document.rst b/docs2/api/types/document.rst new file mode 100644 index 00000000..6f68e824 --- /dev/null +++ b/docs2/api/types/document.rst @@ -0,0 +1,11 @@ +######## +Document +######## + +This object represents a general file (as opposed to photos, voice messages and audio files). + +.. automodule:: aiogram.api.types.document + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/encrypted_credentials.rst b/docs2/api/types/encrypted_credentials.rst new file mode 100644 index 00000000..fd05f0a7 --- /dev/null +++ b/docs2/api/types/encrypted_credentials.rst @@ -0,0 +1,11 @@ +#################### +EncryptedCredentials +#################### + +Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. + +.. automodule:: aiogram.api.types.encrypted_credentials + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/encrypted_passport_element.rst b/docs2/api/types/encrypted_passport_element.rst new file mode 100644 index 00000000..c0e246d2 --- /dev/null +++ b/docs2/api/types/encrypted_passport_element.rst @@ -0,0 +1,11 @@ +######################## +EncryptedPassportElement +######################## + +Contains information about documents or other Telegram Passport elements shared with the bot by the user. + +.. automodule:: aiogram.api.types.encrypted_passport_element + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/file.rst b/docs2/api/types/file.rst new file mode 100644 index 00000000..b33c628b --- /dev/null +++ b/docs2/api/types/file.rst @@ -0,0 +1,13 @@ +#### +File +#### + +This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot/. 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. + +Maximum file size to download is 20 MB + +.. automodule:: aiogram.api.types.file + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/force_reply.rst b/docs2/api/types/force_reply.rst new file mode 100644 index 00000000..66622713 --- /dev/null +++ b/docs2/api/types/force_reply.rst @@ -0,0 +1,21 @@ +########## +ForceReply +########## + +Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. + +Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll: + + + +Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish. + +Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'. + +The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions — without any extra work for the user. + +.. automodule:: aiogram.api.types.force_reply + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/game.rst b/docs2/api/types/game.rst new file mode 100644 index 00000000..e443ff2a --- /dev/null +++ b/docs2/api/types/game.rst @@ -0,0 +1,11 @@ +#### +Game +#### + +This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. + +.. automodule:: aiogram.api.types.game + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/game_high_score.rst b/docs2/api/types/game_high_score.rst new file mode 100644 index 00000000..b8453d01 --- /dev/null +++ b/docs2/api/types/game_high_score.rst @@ -0,0 +1,15 @@ +############# +GameHighScore +############# + +This object represents one row of the high scores table for a game. + +And that's about all we've got for now. + +If you've got any questions, please check out our Bot FAQ + +.. automodule:: aiogram.api.types.game_high_score + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/index.rst b/docs2/api/types/index.rst new file mode 100644 index 00000000..5cfb1974 --- /dev/null +++ b/docs2/api/types/index.rst @@ -0,0 +1,160 @@ +##### +Types +##### + +All types is also wrapped with `pydantic `_ and placed in `aiogram.api.types` package. +In this place makes some more differences with official documentations: + +- name :attr:`from` was renamed to :attr:`from_user` in due to :attr:`from` is an `keyword in python `_ +- timestamps has :class:`datetime.datetime` type instead of :class:`int` +- InputFile is used for sending files and is not use `pydantic.BaseModel` as base class + +Getting updates +=============== + +.. toctree:: + :maxdepth: 1 + + update + webhook_info + +Available types +=============== + +.. toctree:: + :maxdepth: 1 + + user + chat + message + message_entity + photo_size + animation + audio + document + video + video_note + voice + contact + dice + poll_option + poll_answer + poll + location + venue + user_profile_photos + file + reply_keyboard_markup + keyboard_button + keyboard_button_poll_type + reply_keyboard_remove + inline_keyboard_markup + inline_keyboard_button + login_url + callback_query + force_reply + chat_photo + chat_member + chat_permissions + bot_command + response_parameters + input_media + input_media_photo + input_media_video + input_media_animation + input_media_audio + input_media_document + input_file + + + +Stickers +======== + +.. toctree:: + :maxdepth: 1 + + sticker + sticker_set + mask_position + +Inline mode +=========== + +.. toctree:: + :maxdepth: 1 + + inline_query + inline_query_result + inline_query_result_article + inline_query_result_photo + inline_query_result_gif + inline_query_result_mpeg4_gif + inline_query_result_video + inline_query_result_audio + inline_query_result_voice + inline_query_result_document + inline_query_result_location + inline_query_result_venue + inline_query_result_contact + inline_query_result_game + inline_query_result_cached_photo + inline_query_result_cached_gif + inline_query_result_cached_mpeg4_gif + inline_query_result_cached_sticker + inline_query_result_cached_document + inline_query_result_cached_video + inline_query_result_cached_voice + inline_query_result_cached_audio + input_message_content + input_text_message_content + input_location_message_content + input_venue_message_content + input_contact_message_content + chosen_inline_result + +Payments +======== + +.. toctree:: + :maxdepth: 1 + + labeled_price + invoice + shipping_address + order_info + shipping_option + successful_payment + shipping_query + pre_checkout_query + +Telegram Passport +================= + +.. toctree:: + :maxdepth: 1 + + passport_data + passport_file + encrypted_passport_element + encrypted_credentials + passport_element_error + passport_element_error_data_field + passport_element_error_front_side + passport_element_error_reverse_side + passport_element_error_selfie + passport_element_error_file + passport_element_error_files + passport_element_error_translation_file + passport_element_error_translation_files + passport_element_error_unspecified + +Games +===== + +.. toctree:: + :maxdepth: 1 + + game + callback_game + game_high_score diff --git a/docs2/api/types/inline_keyboard_button.rst b/docs2/api/types/inline_keyboard_button.rst new file mode 100644 index 00000000..d7b78e8e --- /dev/null +++ b/docs2/api/types/inline_keyboard_button.rst @@ -0,0 +1,11 @@ +#################### +InlineKeyboardButton +#################### + +This object represents one button of an inline keyboard. You must use exactly one of the optional fields. + +.. automodule:: aiogram.api.types.inline_keyboard_button + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_keyboard_markup.rst b/docs2/api/types/inline_keyboard_markup.rst new file mode 100644 index 00000000..7641ae0a --- /dev/null +++ b/docs2/api/types/inline_keyboard_markup.rst @@ -0,0 +1,13 @@ +#################### +InlineKeyboardMarkup +#################### + +This object represents an inline keyboard that appears right next to the message it belongs to. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. + +.. automodule:: aiogram.api.types.inline_keyboard_markup + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query.rst b/docs2/api/types/inline_query.rst new file mode 100644 index 00000000..f9f66111 --- /dev/null +++ b/docs2/api/types/inline_query.rst @@ -0,0 +1,11 @@ +########### +InlineQuery +########### + +This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. + +.. automodule:: aiogram.api.types.inline_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result.rst b/docs2/api/types/inline_query_result.rst new file mode 100644 index 00000000..bfc571ef --- /dev/null +++ b/docs2/api/types/inline_query_result.rst @@ -0,0 +1,51 @@ +################# +InlineQueryResult +################# + +This object represents one result of an inline query. Telegram clients currently support results of the following 20 types: + + - InlineQueryResultCachedAudio + + - InlineQueryResultCachedDocument + + - InlineQueryResultCachedGif + + - InlineQueryResultCachedMpeg4Gif + + - InlineQueryResultCachedPhoto + + - InlineQueryResultCachedSticker + + - InlineQueryResultCachedVideo + + - InlineQueryResultCachedVoice + + - InlineQueryResultArticle + + - InlineQueryResultAudio + + - InlineQueryResultContact + + - InlineQueryResultGame + + - InlineQueryResultDocument + + - InlineQueryResultGif + + - InlineQueryResultLocation + + - InlineQueryResultMpeg4Gif + + - InlineQueryResultPhoto + + - InlineQueryResultVenue + + - InlineQueryResultVideo + + - InlineQueryResultVoice + +.. automodule:: aiogram.api.types.inline_query_result + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_article.rst b/docs2/api/types/inline_query_result_article.rst new file mode 100644 index 00000000..52f68420 --- /dev/null +++ b/docs2/api/types/inline_query_result_article.rst @@ -0,0 +1,11 @@ +######################## +InlineQueryResultArticle +######################## + +Represents a link to an article or web page. + +.. automodule:: aiogram.api.types.inline_query_result_article + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_audio.rst b/docs2/api/types/inline_query_result_audio.rst new file mode 100644 index 00000000..84f91fd8 --- /dev/null +++ b/docs2/api/types/inline_query_result_audio.rst @@ -0,0 +1,13 @@ +###################### +InlineQueryResultAudio +###################### + +Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_audio + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_audio.rst b/docs2/api/types/inline_query_result_cached_audio.rst new file mode 100644 index 00000000..961b4465 --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_audio.rst @@ -0,0 +1,13 @@ +############################ +InlineQueryResultCachedAudio +############################ + +Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_cached_audio + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_document.rst b/docs2/api/types/inline_query_result_cached_document.rst new file mode 100644 index 00000000..3c0a20d7 --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_document.rst @@ -0,0 +1,13 @@ +############################### +InlineQueryResultCachedDocument +############################### + +Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_cached_document + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_gif.rst b/docs2/api/types/inline_query_result_cached_gif.rst new file mode 100644 index 00000000..22979feb --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_gif.rst @@ -0,0 +1,11 @@ +########################## +InlineQueryResultCachedGif +########################## + +Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. + +.. automodule:: aiogram.api.types.inline_query_result_cached_gif + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_mpeg4_gif.rst b/docs2/api/types/inline_query_result_cached_mpeg4_gif.rst new file mode 100644 index 00000000..779927c1 --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_mpeg4_gif.rst @@ -0,0 +1,11 @@ +############################### +InlineQueryResultCachedMpeg4Gif +############################### + +Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. + +.. automodule:: aiogram.api.types.inline_query_result_cached_mpeg4_gif + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_photo.rst b/docs2/api/types/inline_query_result_cached_photo.rst new file mode 100644 index 00000000..57cb7602 --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_photo.rst @@ -0,0 +1,11 @@ +############################ +InlineQueryResultCachedPhoto +############################ + +Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. + +.. automodule:: aiogram.api.types.inline_query_result_cached_photo + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_sticker.rst b/docs2/api/types/inline_query_result_cached_sticker.rst new file mode 100644 index 00000000..3ce563a5 --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_sticker.rst @@ -0,0 +1,13 @@ +############################## +InlineQueryResultCachedSticker +############################## + +Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker. + +Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_cached_sticker + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_video.rst b/docs2/api/types/inline_query_result_cached_video.rst new file mode 100644 index 00000000..34ee707f --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_video.rst @@ -0,0 +1,11 @@ +############################ +InlineQueryResultCachedVideo +############################ + +Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. + +.. automodule:: aiogram.api.types.inline_query_result_cached_video + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_cached_voice.rst b/docs2/api/types/inline_query_result_cached_voice.rst new file mode 100644 index 00000000..5d23420b --- /dev/null +++ b/docs2/api/types/inline_query_result_cached_voice.rst @@ -0,0 +1,13 @@ +############################ +InlineQueryResultCachedVoice +############################ + +Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_cached_voice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_contact.rst b/docs2/api/types/inline_query_result_contact.rst new file mode 100644 index 00000000..bb914b78 --- /dev/null +++ b/docs2/api/types/inline_query_result_contact.rst @@ -0,0 +1,13 @@ +######################## +InlineQueryResultContact +######################## + +Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_contact + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_document.rst b/docs2/api/types/inline_query_result_document.rst new file mode 100644 index 00000000..95dfd5e4 --- /dev/null +++ b/docs2/api/types/inline_query_result_document.rst @@ -0,0 +1,13 @@ +######################### +InlineQueryResultDocument +######################### + +Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_document + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_game.rst b/docs2/api/types/inline_query_result_game.rst new file mode 100644 index 00000000..dc0aeefb --- /dev/null +++ b/docs2/api/types/inline_query_result_game.rst @@ -0,0 +1,13 @@ +##################### +InlineQueryResultGame +##################### + +Represents a Game. + +Note: This will only work in Telegram versions released after October 1, 2016. Older clients will not display any inline results if a game result is among them. + +.. automodule:: aiogram.api.types.inline_query_result_game + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_gif.rst b/docs2/api/types/inline_query_result_gif.rst new file mode 100644 index 00000000..1b77b049 --- /dev/null +++ b/docs2/api/types/inline_query_result_gif.rst @@ -0,0 +1,11 @@ +#################### +InlineQueryResultGif +#################### + +Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. + +.. automodule:: aiogram.api.types.inline_query_result_gif + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_location.rst b/docs2/api/types/inline_query_result_location.rst new file mode 100644 index 00000000..5f2398eb --- /dev/null +++ b/docs2/api/types/inline_query_result_location.rst @@ -0,0 +1,13 @@ +######################### +InlineQueryResultLocation +######################### + +Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_location + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_mpeg4_gif.rst b/docs2/api/types/inline_query_result_mpeg4_gif.rst new file mode 100644 index 00000000..8f86c6e5 --- /dev/null +++ b/docs2/api/types/inline_query_result_mpeg4_gif.rst @@ -0,0 +1,11 @@ +######################### +InlineQueryResultMpeg4Gif +######################### + +Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. + +.. automodule:: aiogram.api.types.inline_query_result_mpeg4_gif + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_photo.rst b/docs2/api/types/inline_query_result_photo.rst new file mode 100644 index 00000000..2bcced4b --- /dev/null +++ b/docs2/api/types/inline_query_result_photo.rst @@ -0,0 +1,11 @@ +###################### +InlineQueryResultPhoto +###################### + +Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. + +.. automodule:: aiogram.api.types.inline_query_result_photo + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_venue.rst b/docs2/api/types/inline_query_result_venue.rst new file mode 100644 index 00000000..ca056b56 --- /dev/null +++ b/docs2/api/types/inline_query_result_venue.rst @@ -0,0 +1,13 @@ +###################### +InlineQueryResultVenue +###################### + +Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_venue + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_video.rst b/docs2/api/types/inline_query_result_video.rst new file mode 100644 index 00000000..9e3dc1f8 --- /dev/null +++ b/docs2/api/types/inline_query_result_video.rst @@ -0,0 +1,13 @@ +###################### +InlineQueryResultVideo +###################### + +Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. + +If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. + +.. automodule:: aiogram.api.types.inline_query_result_video + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/inline_query_result_voice.rst b/docs2/api/types/inline_query_result_voice.rst new file mode 100644 index 00000000..71c6d9d2 --- /dev/null +++ b/docs2/api/types/inline_query_result_voice.rst @@ -0,0 +1,13 @@ +###################### +InlineQueryResultVoice +###################### + +Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. + +.. automodule:: aiogram.api.types.inline_query_result_voice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_contact_message_content.rst b/docs2/api/types/input_contact_message_content.rst new file mode 100644 index 00000000..0af0edc4 --- /dev/null +++ b/docs2/api/types/input_contact_message_content.rst @@ -0,0 +1,11 @@ +########################## +InputContactMessageContent +########################## + +Represents the content of a contact message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_contact_message_content + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_file.rst b/docs2/api/types/input_file.rst new file mode 100644 index 00000000..10a17f5d --- /dev/null +++ b/docs2/api/types/input_file.rst @@ -0,0 +1,11 @@ +######### +InputFile +######### + +This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser. + +.. automodule:: aiogram.api.types.input_file + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_location_message_content.rst b/docs2/api/types/input_location_message_content.rst new file mode 100644 index 00000000..b71b5e96 --- /dev/null +++ b/docs2/api/types/input_location_message_content.rst @@ -0,0 +1,11 @@ +########################### +InputLocationMessageContent +########################### + +Represents the content of a location message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_location_message_content + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_media.rst b/docs2/api/types/input_media.rst new file mode 100644 index 00000000..f7ccc7c8 --- /dev/null +++ b/docs2/api/types/input_media.rst @@ -0,0 +1,21 @@ +########## +InputMedia +########## + +This object represents the content of a media message to be sent. It should be one of + + - InputMediaAnimation + + - InputMediaDocument + + - InputMediaAudio + + - InputMediaPhoto + + - InputMediaVideo + +.. automodule:: aiogram.api.types.input_media + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_media_animation.rst b/docs2/api/types/input_media_animation.rst new file mode 100644 index 00000000..af3ad3c6 --- /dev/null +++ b/docs2/api/types/input_media_animation.rst @@ -0,0 +1,11 @@ +################### +InputMediaAnimation +################### + +Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. + +.. automodule:: aiogram.api.types.input_media_animation + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_media_audio.rst b/docs2/api/types/input_media_audio.rst new file mode 100644 index 00000000..24320cf0 --- /dev/null +++ b/docs2/api/types/input_media_audio.rst @@ -0,0 +1,11 @@ +############### +InputMediaAudio +############### + +Represents an audio file to be treated as music to be sent. + +.. automodule:: aiogram.api.types.input_media_audio + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_media_document.rst b/docs2/api/types/input_media_document.rst new file mode 100644 index 00000000..477c2481 --- /dev/null +++ b/docs2/api/types/input_media_document.rst @@ -0,0 +1,11 @@ +################## +InputMediaDocument +################## + +Represents a general file to be sent. + +.. automodule:: aiogram.api.types.input_media_document + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_media_photo.rst b/docs2/api/types/input_media_photo.rst new file mode 100644 index 00000000..a7d8dd94 --- /dev/null +++ b/docs2/api/types/input_media_photo.rst @@ -0,0 +1,11 @@ +############### +InputMediaPhoto +############### + +Represents a photo to be sent. + +.. automodule:: aiogram.api.types.input_media_photo + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_media_video.rst b/docs2/api/types/input_media_video.rst new file mode 100644 index 00000000..d2fc17c6 --- /dev/null +++ b/docs2/api/types/input_media_video.rst @@ -0,0 +1,11 @@ +############### +InputMediaVideo +############### + +Represents a video to be sent. + +.. automodule:: aiogram.api.types.input_media_video + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_message_content.rst b/docs2/api/types/input_message_content.rst new file mode 100644 index 00000000..1cfc6552 --- /dev/null +++ b/docs2/api/types/input_message_content.rst @@ -0,0 +1,19 @@ +################### +InputMessageContent +################### + +This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 4 types: + + - InputTextMessageContent + + - InputLocationMessageContent + + - InputVenueMessageContent + + - InputContactMessageContent + +.. automodule:: aiogram.api.types.input_message_content + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_text_message_content.rst b/docs2/api/types/input_text_message_content.rst new file mode 100644 index 00000000..da9dd784 --- /dev/null +++ b/docs2/api/types/input_text_message_content.rst @@ -0,0 +1,11 @@ +####################### +InputTextMessageContent +####################### + +Represents the content of a text message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_text_message_content + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/input_venue_message_content.rst b/docs2/api/types/input_venue_message_content.rst new file mode 100644 index 00000000..d7458c1b --- /dev/null +++ b/docs2/api/types/input_venue_message_content.rst @@ -0,0 +1,11 @@ +######################## +InputVenueMessageContent +######################## + +Represents the content of a venue message to be sent as the result of an inline query. + +.. automodule:: aiogram.api.types.input_venue_message_content + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/invoice.rst b/docs2/api/types/invoice.rst new file mode 100644 index 00000000..f427e2e1 --- /dev/null +++ b/docs2/api/types/invoice.rst @@ -0,0 +1,11 @@ +####### +Invoice +####### + +This object contains basic information about an invoice. + +.. automodule:: aiogram.api.types.invoice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/keyboard_button.rst b/docs2/api/types/keyboard_button.rst new file mode 100644 index 00000000..741b3da8 --- /dev/null +++ b/docs2/api/types/keyboard_button.rst @@ -0,0 +1,15 @@ +############## +KeyboardButton +############## + +This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields request_contact, request_location, and request_poll are mutually exclusive. + +Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. + +Note: request_poll option will only work in Telegram versions released after 23 January, 2020. Older clients will display unsupported message. + +.. automodule:: aiogram.api.types.keyboard_button + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/keyboard_button_poll_type.rst b/docs2/api/types/keyboard_button_poll_type.rst new file mode 100644 index 00000000..eae38e30 --- /dev/null +++ b/docs2/api/types/keyboard_button_poll_type.rst @@ -0,0 +1,11 @@ +###################### +KeyboardButtonPollType +###################### + +This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. + +.. automodule:: aiogram.api.types.keyboard_button_poll_type + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/labeled_price.rst b/docs2/api/types/labeled_price.rst new file mode 100644 index 00000000..557359c0 --- /dev/null +++ b/docs2/api/types/labeled_price.rst @@ -0,0 +1,11 @@ +############ +LabeledPrice +############ + +This object represents a portion of the price for goods or services. + +.. automodule:: aiogram.api.types.labeled_price + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/location.rst b/docs2/api/types/location.rst new file mode 100644 index 00000000..aed07d25 --- /dev/null +++ b/docs2/api/types/location.rst @@ -0,0 +1,11 @@ +######## +Location +######## + +This object represents a point on the map. + +.. automodule:: aiogram.api.types.location + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/login_url.rst b/docs2/api/types/login_url.rst new file mode 100644 index 00000000..56c9229f --- /dev/null +++ b/docs2/api/types/login_url.rst @@ -0,0 +1,15 @@ +######## +LoginUrl +######## + +This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in: + +Telegram apps support these buttons as of version 5.7. + +Sample bot: @discussbot + +.. automodule:: aiogram.api.types.login_url + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/mask_position.rst b/docs2/api/types/mask_position.rst new file mode 100644 index 00000000..11d7e71b --- /dev/null +++ b/docs2/api/types/mask_position.rst @@ -0,0 +1,11 @@ +############ +MaskPosition +############ + +This object describes the position on faces where a mask should be placed by default. + +.. automodule:: aiogram.api.types.mask_position + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/message.rst b/docs2/api/types/message.rst new file mode 100644 index 00000000..d2dfc7b6 --- /dev/null +++ b/docs2/api/types/message.rst @@ -0,0 +1,11 @@ +####### +Message +####### + +This object represents a message. + +.. automodule:: aiogram.api.types.message + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/message_entity.rst b/docs2/api/types/message_entity.rst new file mode 100644 index 00000000..87dfc66b --- /dev/null +++ b/docs2/api/types/message_entity.rst @@ -0,0 +1,11 @@ +############# +MessageEntity +############# + +This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. + +.. automodule:: aiogram.api.types.message_entity + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/order_info.rst b/docs2/api/types/order_info.rst new file mode 100644 index 00000000..cb0a66cd --- /dev/null +++ b/docs2/api/types/order_info.rst @@ -0,0 +1,11 @@ +######### +OrderInfo +######### + +This object represents information about an order. + +.. automodule:: aiogram.api.types.order_info + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_data.rst b/docs2/api/types/passport_data.rst new file mode 100644 index 00000000..e618c39f --- /dev/null +++ b/docs2/api/types/passport_data.rst @@ -0,0 +1,11 @@ +############ +PassportData +############ + +Contains information about Telegram Passport data shared with the bot by the user. + +.. automodule:: aiogram.api.types.passport_data + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error.rst b/docs2/api/types/passport_element_error.rst new file mode 100644 index 00000000..174aa734 --- /dev/null +++ b/docs2/api/types/passport_element_error.rst @@ -0,0 +1,29 @@ +#################### +PassportElementError +#################### + +This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of: + + - PassportElementErrorDataField + + - PassportElementErrorFrontSide + + - PassportElementErrorReverseSide + + - PassportElementErrorSelfie + + - PassportElementErrorFile + + - PassportElementErrorFiles + + - PassportElementErrorTranslationFile + + - PassportElementErrorTranslationFiles + + - PassportElementErrorUnspecified + +.. automodule:: aiogram.api.types.passport_element_error + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_data_field.rst b/docs2/api/types/passport_element_error_data_field.rst new file mode 100644 index 00000000..114b0982 --- /dev/null +++ b/docs2/api/types/passport_element_error_data_field.rst @@ -0,0 +1,11 @@ +############################# +PassportElementErrorDataField +############################# + +Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. + +.. automodule:: aiogram.api.types.passport_element_error_data_field + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_file.rst b/docs2/api/types/passport_element_error_file.rst new file mode 100644 index 00000000..79a7c15e --- /dev/null +++ b/docs2/api/types/passport_element_error_file.rst @@ -0,0 +1,11 @@ +######################## +PassportElementErrorFile +######################## + +Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. + +.. automodule:: aiogram.api.types.passport_element_error_file + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_files.rst b/docs2/api/types/passport_element_error_files.rst new file mode 100644 index 00000000..631c972b --- /dev/null +++ b/docs2/api/types/passport_element_error_files.rst @@ -0,0 +1,11 @@ +######################### +PassportElementErrorFiles +######################### + +Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. + +.. automodule:: aiogram.api.types.passport_element_error_files + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_front_side.rst b/docs2/api/types/passport_element_error_front_side.rst new file mode 100644 index 00000000..9437891a --- /dev/null +++ b/docs2/api/types/passport_element_error_front_side.rst @@ -0,0 +1,11 @@ +############################# +PassportElementErrorFrontSide +############################# + +Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. + +.. automodule:: aiogram.api.types.passport_element_error_front_side + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_reverse_side.rst b/docs2/api/types/passport_element_error_reverse_side.rst new file mode 100644 index 00000000..1cc1a4b3 --- /dev/null +++ b/docs2/api/types/passport_element_error_reverse_side.rst @@ -0,0 +1,11 @@ +############################### +PassportElementErrorReverseSide +############################### + +Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. + +.. automodule:: aiogram.api.types.passport_element_error_reverse_side + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_selfie.rst b/docs2/api/types/passport_element_error_selfie.rst new file mode 100644 index 00000000..4ebeed35 --- /dev/null +++ b/docs2/api/types/passport_element_error_selfie.rst @@ -0,0 +1,11 @@ +########################## +PassportElementErrorSelfie +########################## + +Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. + +.. automodule:: aiogram.api.types.passport_element_error_selfie + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_translation_file.rst b/docs2/api/types/passport_element_error_translation_file.rst new file mode 100644 index 00000000..41d50c21 --- /dev/null +++ b/docs2/api/types/passport_element_error_translation_file.rst @@ -0,0 +1,11 @@ +################################### +PassportElementErrorTranslationFile +################################### + +Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. + +.. automodule:: aiogram.api.types.passport_element_error_translation_file + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_translation_files.rst b/docs2/api/types/passport_element_error_translation_files.rst new file mode 100644 index 00000000..f82a2663 --- /dev/null +++ b/docs2/api/types/passport_element_error_translation_files.rst @@ -0,0 +1,11 @@ +#################################### +PassportElementErrorTranslationFiles +#################################### + +Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. + +.. automodule:: aiogram.api.types.passport_element_error_translation_files + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_element_error_unspecified.rst b/docs2/api/types/passport_element_error_unspecified.rst new file mode 100644 index 00000000..3556729a --- /dev/null +++ b/docs2/api/types/passport_element_error_unspecified.rst @@ -0,0 +1,11 @@ +############################### +PassportElementErrorUnspecified +############################### + +Represents an issue in an unspecified place. The error is considered resolved when new data is added. + +.. automodule:: aiogram.api.types.passport_element_error_unspecified + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/passport_file.rst b/docs2/api/types/passport_file.rst new file mode 100644 index 00000000..358e12a7 --- /dev/null +++ b/docs2/api/types/passport_file.rst @@ -0,0 +1,11 @@ +############ +PassportFile +############ + +This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. + +.. automodule:: aiogram.api.types.passport_file + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/photo_size.rst b/docs2/api/types/photo_size.rst new file mode 100644 index 00000000..6503bab3 --- /dev/null +++ b/docs2/api/types/photo_size.rst @@ -0,0 +1,11 @@ +######### +PhotoSize +######### + +This object represents one size of a photo or a file / sticker thumbnail. + +.. automodule:: aiogram.api.types.photo_size + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/poll.rst b/docs2/api/types/poll.rst new file mode 100644 index 00000000..f5cb8f73 --- /dev/null +++ b/docs2/api/types/poll.rst @@ -0,0 +1,11 @@ +#### +Poll +#### + +This object contains information about a poll. + +.. automodule:: aiogram.api.types.poll + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/poll_answer.rst b/docs2/api/types/poll_answer.rst new file mode 100644 index 00000000..ddd56d32 --- /dev/null +++ b/docs2/api/types/poll_answer.rst @@ -0,0 +1,11 @@ +########## +PollAnswer +########## + +This object represents an answer of a user in a non-anonymous poll. + +.. automodule:: aiogram.api.types.poll_answer + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/poll_option.rst b/docs2/api/types/poll_option.rst new file mode 100644 index 00000000..c5159c94 --- /dev/null +++ b/docs2/api/types/poll_option.rst @@ -0,0 +1,11 @@ +########## +PollOption +########## + +This object contains information about one answer option in a poll. + +.. automodule:: aiogram.api.types.poll_option + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/pre_checkout_query.rst b/docs2/api/types/pre_checkout_query.rst new file mode 100644 index 00000000..757a951c --- /dev/null +++ b/docs2/api/types/pre_checkout_query.rst @@ -0,0 +1,11 @@ +################ +PreCheckoutQuery +################ + +This object contains information about an incoming pre-checkout query. + +.. automodule:: aiogram.api.types.pre_checkout_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/reply_keyboard_markup.rst b/docs2/api/types/reply_keyboard_markup.rst new file mode 100644 index 00000000..34c83b86 --- /dev/null +++ b/docs2/api/types/reply_keyboard_markup.rst @@ -0,0 +1,11 @@ +################### +ReplyKeyboardMarkup +################### + +This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). + +.. automodule:: aiogram.api.types.reply_keyboard_markup + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/reply_keyboard_remove.rst b/docs2/api/types/reply_keyboard_remove.rst new file mode 100644 index 00000000..2dddb8d7 --- /dev/null +++ b/docs2/api/types/reply_keyboard_remove.rst @@ -0,0 +1,11 @@ +################### +ReplyKeyboardRemove +################### + +Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). + +.. automodule:: aiogram.api.types.reply_keyboard_remove + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/response_parameters.rst b/docs2/api/types/response_parameters.rst new file mode 100644 index 00000000..93b13fb5 --- /dev/null +++ b/docs2/api/types/response_parameters.rst @@ -0,0 +1,11 @@ +################## +ResponseParameters +################## + +Contains information about why a request was unsuccessful. + +.. automodule:: aiogram.api.types.response_parameters + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/shipping_address.rst b/docs2/api/types/shipping_address.rst new file mode 100644 index 00000000..8a4d4571 --- /dev/null +++ b/docs2/api/types/shipping_address.rst @@ -0,0 +1,11 @@ +############### +ShippingAddress +############### + +This object represents a shipping address. + +.. automodule:: aiogram.api.types.shipping_address + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/shipping_option.rst b/docs2/api/types/shipping_option.rst new file mode 100644 index 00000000..cba2de77 --- /dev/null +++ b/docs2/api/types/shipping_option.rst @@ -0,0 +1,11 @@ +############## +ShippingOption +############## + +This object represents one shipping option. + +.. automodule:: aiogram.api.types.shipping_option + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/shipping_query.rst b/docs2/api/types/shipping_query.rst new file mode 100644 index 00000000..bc7a3514 --- /dev/null +++ b/docs2/api/types/shipping_query.rst @@ -0,0 +1,11 @@ +############# +ShippingQuery +############# + +This object contains information about an incoming shipping query. + +.. automodule:: aiogram.api.types.shipping_query + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/sticker.rst b/docs2/api/types/sticker.rst new file mode 100644 index 00000000..3b6b4e1d --- /dev/null +++ b/docs2/api/types/sticker.rst @@ -0,0 +1,11 @@ +####### +Sticker +####### + +This object represents a sticker. + +.. automodule:: aiogram.api.types.sticker + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/sticker_set.rst b/docs2/api/types/sticker_set.rst new file mode 100644 index 00000000..2f19ce47 --- /dev/null +++ b/docs2/api/types/sticker_set.rst @@ -0,0 +1,11 @@ +########## +StickerSet +########## + +This object represents a sticker set. + +.. automodule:: aiogram.api.types.sticker_set + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/successful_payment.rst b/docs2/api/types/successful_payment.rst new file mode 100644 index 00000000..240b3cea --- /dev/null +++ b/docs2/api/types/successful_payment.rst @@ -0,0 +1,11 @@ +################# +SuccessfulPayment +################# + +This object contains basic information about a successful payment. + +.. automodule:: aiogram.api.types.successful_payment + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/update.rst b/docs2/api/types/update.rst new file mode 100644 index 00000000..88beec50 --- /dev/null +++ b/docs2/api/types/update.rst @@ -0,0 +1,13 @@ +###### +Update +###### + +This object represents an incoming update. + +At most one of the optional parameters can be present in any given update. + +.. automodule:: aiogram.api.types.update + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/user.rst b/docs2/api/types/user.rst new file mode 100644 index 00000000..7e47d251 --- /dev/null +++ b/docs2/api/types/user.rst @@ -0,0 +1,11 @@ +#### +User +#### + +This object represents a Telegram user or bot. + +.. automodule:: aiogram.api.types.user + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/user_profile_photos.rst b/docs2/api/types/user_profile_photos.rst new file mode 100644 index 00000000..f1d4516e --- /dev/null +++ b/docs2/api/types/user_profile_photos.rst @@ -0,0 +1,11 @@ +################# +UserProfilePhotos +################# + +This object represent a user's profile pictures. + +.. automodule:: aiogram.api.types.user_profile_photos + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/venue.rst b/docs2/api/types/venue.rst new file mode 100644 index 00000000..31c99522 --- /dev/null +++ b/docs2/api/types/venue.rst @@ -0,0 +1,11 @@ +##### +Venue +##### + +This object represents a venue. + +.. automodule:: aiogram.api.types.venue + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/video.rst b/docs2/api/types/video.rst new file mode 100644 index 00000000..bb0ed56a --- /dev/null +++ b/docs2/api/types/video.rst @@ -0,0 +1,11 @@ +##### +Video +##### + +This object represents a video file. + +.. automodule:: aiogram.api.types.video + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/video_note.rst b/docs2/api/types/video_note.rst new file mode 100644 index 00000000..e8177d09 --- /dev/null +++ b/docs2/api/types/video_note.rst @@ -0,0 +1,11 @@ +######### +VideoNote +######### + +This object represents a video message (available in Telegram apps as of v.4.0). + +.. automodule:: aiogram.api.types.video_note + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/voice.rst b/docs2/api/types/voice.rst new file mode 100644 index 00000000..bf101e94 --- /dev/null +++ b/docs2/api/types/voice.rst @@ -0,0 +1,11 @@ +##### +Voice +##### + +This object represents a voice note. + +.. automodule:: aiogram.api.types.voice + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/types/webhook_info.rst b/docs2/api/types/webhook_info.rst new file mode 100644 index 00000000..d7c1f788 --- /dev/null +++ b/docs2/api/types/webhook_info.rst @@ -0,0 +1,11 @@ +########### +WebhookInfo +########### + +Contains information about the current status of a webhook. + +.. automodule:: aiogram.api.types.webhook_info + :members: + :member-order: bysource + :special-members: __init__ + :undoc-members: True \ No newline at end of file diff --git a/docs2/api/upload_file.rst b/docs2/api/upload_file.rst new file mode 100644 index 00000000..9e63754b --- /dev/null +++ b/docs2/api/upload_file.rst @@ -0,0 +1,94 @@ +################### +How to upload file? +################### + +As says `official Telegram Bot API documentation `_ +there are three ways to send files (photos, stickers, audio, media, etc.): + +If the file is already stored somewhere on the Telegram servers or file is available by the URL, +you don't need to reupload it. + +But if you need to upload new file just use subclasses of `InputFile `__. + +Here is available three different builtin types of input file: + +- :obj:`FSInputFile` - `uploading from file system <#upload-from-file-system>`__ +- :obj:`BufferedInputFile` - `uploading from buffer <#upload-from-buffer>`__ +- :obj:`URLInputFile` - `uploading from URL <#upload-from-url>`__ + +.. warning:: + + **Be respectful with Telegram** + + Instances of `InputFile` is reusable. + That's mean you can create instance of InputFile and sent this file multiple times but Telegram + is not recommend to do that and when you upload file once just save their `file_id` + and use it in next times. + +Upload from file system +======================= + +By first step you will need to import InputFile wrapper: + +.. code-block:: + + from aiogram.types import FSInputFile + +Then you can use it: + +.. code-block:: + + cat = FSInputFile("cat.png") + agenda = FSInputFile("my-document.pdf", filename="agenda-2019-11-19.pdf") + + +.. autoclass:: aiogram.api.types.input_file.FSInputFile + :members: + + +Upload from buffer +================== + +Files can be also passed from buffer +(For example you generate image using `Pillow `_ +and the want's to sent it to the Telegram): + +Import wrapper: + +.. code-block:: + + from aiogram.types import BufferedInputFile + +And then you can use it: + +.. code-block:: + + text_file = BufferedInputFile(b"Hello, world!", filename="file.txt") + +.. autoclass:: aiogram.api.types.input_file.BufferedInputFile + :members: + +Upload from url +=============== + +If you need to upload a file from another server, but the direct link is bound to your server's IP, +or you want to bypass native `upload limits `_ +by URL, you can use :obj:`URLInputFile`. + +Import wrapper: + +.. code-block:: + + from aiogram.types import URLInputFile + +And then you can use it: + +.. code-block:: + + image = URLInputFile( + "https://www.python.org/static/community_logos/python-powered-h-140x182.png", + filename="python-logo.png" + ) + +.. autoclass:: aiogram.api.types.input_file.URLInputFile + :members: diff --git a/docs2/conf.py b/docs2/conf.py new file mode 100644 index 00000000..03e0cda7 --- /dev/null +++ b/docs2/conf.py @@ -0,0 +1,57 @@ +import datetime + +import aiogram + +project = "aiogram" +author = "aiogram Team" +copyright = f"{datetime.date.today().year}, {author}" +release = aiogram.__version__ +api_version = aiogram.__api_version__ + +templates_path = ["_templates"] +html_theme = "sphinx_rtd_theme" +html_icon = "_static/logo.png" +html_static_path = ["_static"] +todo_include_todos = True +# pygments_style = "sphinx" +htmlhelp_basename = project +html_theme_options = { + 'collapse_navigation': False, +} + +extensions = [ + "sphinx_rtd_theme", + "sphinx.ext.todo", + "sphinx.ext.viewcode", + "sphinx.ext.autodoc", + "sphinx.ext.ifconfig", + "sphinx-prompt", + "sphinx_substitution_extensions", +] + +rst_prolog = f""" +.. |api_version| replace:: {aiogram.__api_version__} +""" + +language = None +locale_dirs = ["locales"] + +exclude_patterns = [] +source_suffix = ".rst" +master_doc = "index" + +latex_documents = [ + (master_doc, f"{project}.tex", f"{project} Documentation", author, "manual"), +] +man_pages = [(master_doc, project, f"{project} Documentation", [author], 1)] +texinfo_documents = [ + ( + master_doc, + project, + f"{project} Documentation", + author, + project, + "Modern and fully asynchronous framework for Telegram Bot API", + "Miscellaneous", + ), +] diff --git a/docs2/dispatcher/dispatcher.rst b/docs2/dispatcher/dispatcher.rst new file mode 100644 index 00000000..798d74da --- /dev/null +++ b/docs2/dispatcher/dispatcher.rst @@ -0,0 +1,72 @@ +########## +Dispathcer +########## + +Dispatcher is root :obj:`Router` and in code Dispatcher can be used directly for routing updates or attach another routers into dispatcher. + +Here is only listed base information about Dispatcher. All about writing handlers, filters and etc. you can found in next pages: + +- `Router `__ +- `Observer `__ + + +.. autoclass:: aiogram.dispatcher.dispatcher.Dispatcher + :members: __init__, feed_update, feed_raw_update, feed_webhook_update, start_polling, run_polling + + +Simple usage +============ + +Example: + +.. code-block:: python + + dp = Dispatcher() + + @dp.message() + async def message_handler(message: types.Message) -> None: + await SendMessage(chat_id=message.from_user.id, text=message.text) + + +Including routers + +Example: + + +.. code-block:: python + + dp = Dispatcher() + router1 = Router() + dp.include_router(router1) + +Handling updates +================ + +All updates can be propagated to the dispatcher by :obj:`Dispatcher.feed_update(bot=..., update=...)` method: + +.. code-block:: python + + bot = Bot(...) + dp = Dispathcher() + + ... + + result = await dp.feed_update(bot=bot, update=incoming_update) + +Polling +======= + +.. warning:: + + not yet docummented + +... + +Webhook +======= + +.. warning:: + + not yet docummented + +... diff --git a/docs2/dispatcher/index.rst b/docs2/dispatcher/index.rst new file mode 100644 index 00000000..36b27ec8 --- /dev/null +++ b/docs2/dispatcher/index.rst @@ -0,0 +1,22 @@ +=============== +Handling events +=============== + +*aiogram* imcludes Dispatcher mechanism. +Dispatcher is needed for handling incoming updates from Telegram. + +With dispatcher you can do: + +- Handle incoming updates; +- Filter incoming events before it will be processed by specific handler; +- Modify event and related data in middlewares; +- Separate bot functionality between different handlers, modules and packages + +Dispatcher is also separated into two entities - Router and Dispatcher. +Dispatcher is subclass of router and should be always is root router. + +.. toctree:: + + observer + router + dispatcher diff --git a/docs2/dispatcher/observer.rst b/docs2/dispatcher/observer.rst new file mode 100644 index 00000000..44cc10df --- /dev/null +++ b/docs2/dispatcher/observer.rst @@ -0,0 +1,26 @@ +######## +Observer +######## + +Observer is used for filtering and handling different events. That is part of internal API with some public methods and is recommended to don't use methods is not listed here. + +In `aiogram` framework is available two variants of observer: + +- `EventObserver <#eventobserver>`__ +- `TelegramEventObserver <#telegrameventobserver>`__ + + +EventObserver +============= + +.. autoclass:: aiogram.dispatcher.event.event.EventObserver + :members: register, trigger, __call__ + :member-order: bysource + + +TelegramEventObserver +===================== + +.. autoclass:: aiogram.dispatcher.event.telegram.TelegramEventObserver + :members: register, trigger, __call__, bind_filter, middleware, outer_middleware + :member-order: bysource diff --git a/docs2/dispatcher/router.rst b/docs2/dispatcher/router.rst new file mode 100644 index 00000000..3e1a1b69 --- /dev/null +++ b/docs2/dispatcher/router.rst @@ -0,0 +1,181 @@ +###### +Router +###### + +.. autoclass:: aiogram.dispatcher.router.Router + :members: __init__, include_router + :show-inheritance: + + +Event observers +=============== + +.. warning:: + + All handlers is always should be an asynchronous. + Name of handler function is not important. Event argument name is also is not important but is recommended to don't overlap the name with contextual data in due to function can not accept two arguments with the same name. + +Here is list of available observers and examples how to register handlers (In examples used only @decorator-style): + +For examples used decorator-style registering handlers but if you dont like @decorators just use :obj:`.register(...)` method instead. + +Update +------ + +.. code-block:: python + + @router.update() + async def message_handler(update: types.Update) -> Any: pass + +.. note:: + + By default Router is already have an update handler which route all event types to another observers. + + +Message +------- + +.. code-block:: python + + @router.message() + async def message_handler(message: types.Message) -> Any: pass + + +Edited message +-------------- + +.. code-block:: python + + @router.edited_message() + async def edited_message_handler(edited_message: types.Message) -> Any: pass + +Channel post +------------ + +.. code-block:: python + + @router.channel_post() + async def channel_post_handler(channel_post: types.Message) -> Any: pass + +Edited channel post +------------------- + +.. code-block:: python + + @router.edited_channel_post() + async def edited_channel_post_handler(edited_channel_post: types.Message) -> Any: pass + + +Inline query +------------ + +.. code-block:: python + + @router.inline_query() + async def inline_query_handler(inline_query: types.Message) -> Any: pass + +Chosen inline query +------------------- + +.. code-block:: python + + @router.chosen_inline_result() + async def chosen_inline_result_handler(chosen_inline_result: types.ChosenInlineResult) -> Any: pass + +Callback query +-------------- + +.. code-block:: python + + @router.callback_query() + async def callback_query_handler(callback_query: types.CallbackQuery) -> Any: pass + +Shipping query +-------------- + +.. code-block:: python + + @router.shipping_query() + async def shipping_query_handler(shipping_query: types.ShippingQuery) -> Any: pass + +Pre checkout query +------------------ + +.. code-block:: python + + @router.pre_checkout_query() + async def pre_checkout_query_handler(pre_checkout_query: types.PreCheckoutQuery) -> Any: pass + +Poll +---- + +.. code-block:: python + + @router.poll() + async def poll_handler(poll: types.Poll) -> Any: pass + +Poll answer +----------- + +.. code-block:: python + + @router.poll_answer() + async def poll_answer_handler(poll_answer: types.PollAnswer) -> Any: pass + +Errors +------ + +.. code-block:: python + + @router.errors() + async def error_handler(exception: Exception) -> Any: pass + +Is useful for handling errors from other handlers + + +Nested routers +============== + +.. warning:: + + Routers by the way can be nested to an another routers with some limitations: + + 1. Router **CAN NOT** include itself + 1. Routers **CAN NOT** be used for circular including (router 1 include router 2, router 2 include router 3, router 3 include router 1) + + +Example: + +.. code-block:: python + :caption: module_2.py + :name: module_2 + + router2 = Router() + + @router2.message() + ... + + +.. code-block:: python + :caption: module_12.py + :name: module_1 + + from module_2 import router2 + + + router1 = Router() + router1.include_router(router2) + + +How it works? +------------- + +For example dispatcher has 2 routers, last one router is also have one nested router: + +.. image:: ../_static/nested_routers_example.png + :alt: Nested routers example + +In this case update propagation flow will have form: + +.. image:: ../_static/update_propagation_flow.png + :alt: Nested routers example diff --git a/docs2/index.rst b/docs2/index.rst new file mode 100644 index 00000000..8775c17a --- /dev/null +++ b/docs2/index.rst @@ -0,0 +1,83 @@ +####### +aiogram +####### + +.. danger:: + This version still in development! + +.. image:: https://img.shields.io/pypi/l/aiogram.svg + :target: https://opensource.org/licenses/MIT + :alt: MIT License + +.. image:: https://img.shields.io/pypi/pyversions/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: Supported python versions + +.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-4.9-blue.svg?logo=telegram + :target: https://core.telegram.org/bots/api + :alt: Telegram Bot API + +.. image:: https://github.com/aiogram/aiogram/workflows/Tests/badge.svg?branch=dev-3.x + :target: https://github.com/aiogram/aiogram/actions + :alt: Tests + +.. image:: https://img.shields.io/pypi/v/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: PyPi Package Version + +.. image:: https://img.shields.io/pypi/status/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: PyPi status + +.. image:: https://img.shields.io/pypi/dm/aiogram.svg + :target: https://pypi.python.org/pypi/aiogram + :alt: Downloads + +.. image:: https://img.shields.io/badge/telegram-aiogram-blue.svg + :target: https://t.me/aiogram_live + :alt: [Telegram] aiogram live + + +**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 (`asyncio docs `_, :pep:`492`) +- Has type hints (:pep:`484`) and can be used with `mypy `_ +- Supports `Telegram Bot API `_ |api_version| +- Telegram Bot API integration code was `autogenerated `_ and can be easy re-generated when API was updated +- Updates router (Blueprints) +- Finite State Machine +- Middlewares +- Provides `Replies into Webhook `_ + +.. warning:: + + 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 `_ + - `Russian language `_ + +Simple usage +------------ + +.. literalinclude:: ../examples/echo_bot.py + +Contents +======== + +.. toctree:: + :maxdepth: 3 + + install + api/index + dispatcher/index diff --git a/docs2/install.rst b/docs2/install.rst new file mode 100644 index 00000000..d6ea8c79 --- /dev/null +++ b/docs2/install.rst @@ -0,0 +1,54 @@ +############ +Installation +############ + +Stable (2.x) +============ + +Using PIP +--------- + +.. code-block:: bash + + pip install -U aiogram + + +Using poetry +------------ + +.. code-block:: bash + + poetry add aiogram + + +Using Pipenv +------------ + +.. code-block:: bash + + pipenv install aiogram + +Using AUR +--------- +*aiogram* is also available in Arch User Repository, so you can install this framework on any +Arch-based distribution like ArchLinux, Antergos, Manjaro, etc. To do this, use your favorite +AUR-helper and install `python-aiogram `_ package. + + +Development build (3.x) +======================= + +From private PyPi index +----------------------- + +On every push to the `dev-3.x` branch GitHub Actions build the package and publish +to the `2038.host `_ server with seems like official PyPi files structure. +That's mean you can always install latest (may be unstable) build via next command: + +.. code-block:: bash + + pip install --extra-index-url https://dev-docs.aiogram.dev/simple --pre aiogram + + +In this repository available only last success build. All previous builds is always removes +before uploading new one. Also before building this package all tests is also pass. diff --git a/docs2/make.bat b/docs2/make.bat new file mode 100644 index 00000000..922152e9 --- /dev/null +++ b/docs2/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs2/requirements.txt b/docs2/requirements.txt new file mode 100644 index 00000000..9003de3f --- /dev/null +++ b/docs2/requirements.txt @@ -0,0 +1,3 @@ +sphinx-intl +typing-extensions +Sphinx-Substitution-Extensions diff --git a/examples/echo_bot.py b/examples/echo_bot.py new file mode 100644 index 00000000..2ab06c78 --- /dev/null +++ b/examples/echo_bot.py @@ -0,0 +1,41 @@ +from typing import Any + +from aiogram import Bot, Dispatcher, types +from aiogram.dispatcher.handler import MessageHandler + +TOKEN = "42:TOKEN" +dp = Dispatcher() + + +@dp.message(commands=["start"]) +class MyHandler(MessageHandler): + """ + This handler receive messages with `/start` command + + Usage of Class-based handlers + """ + + async def handle(self) -> Any: + await self.event.answer(f"Hello, {self.from_user.full_name}!") + + +@dp.message(content_types=[types.ContentType.ANY]) +async def echo_handler(message: types.Message, bot: Bot) -> Any: + """ + Handler will forward received message back to the sender + + Usage of Function-based handlers + """ + + await bot.forward_message( + from_chat_id=message.chat.id, chat_id=message.chat.id, message_id=message.message_id + ) + + +def main() -> None: + bot = Bot(TOKEN, parse_mode="HTML") + dp.run_polling(bot) + + +if __name__ == "__main__": + main() diff --git a/poetry.lock b/poetry.lock index d519761f..178432ef 100644 --- a/poetry.lock +++ b/poetry.lock @@ -140,23 +140,6 @@ optional = false python-versions = "*" version = "0.2.0" -[[package]] -category = "dev" -description = "Screen-scraping library" -name = "beautifulsoup4" -optional = false -python-versions = "*" -version = "4.9.3" - -[package.dependencies] -[package.dependencies.soupsieve] -python = ">=3.0" -version = ">1.2" - -[package.extras] -html5lib = ["html5lib"] -lxml = ["lxml"] - [[package]] category = "dev" description = "The uncompromising code formatter." @@ -333,14 +316,6 @@ optional = false python-versions = "*" version = "0.3.0" -[[package]] -category = "dev" -description = "Docutils -- Python Documentation Utilities" -name = "docutils" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.16" - [[package]] category = "dev" description = "A platform independent file lock." @@ -380,22 +355,6 @@ importlib-metadata = "*" jinja2 = ">=2.9.0" pygments = ">=2.2.0" -[[package]] -category = "dev" -description = "A clean customisable Sphinx documentation theme." -name = "furo" -optional = false -python-versions = ">=3.5" -version = "2020.11.15b17" - -[package.dependencies] -beautifulsoup4 = "*" -sphinx = ">3.0" - -[package.extras] -doc = ["myst-parser", "sphinx-inline-tabs"] -test = ["pytest", "pytest-cov", "pytest-xdist"] - [[package]] category = "dev" description = "Clean single-source support for Python 3 and 2" @@ -442,14 +401,6 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "2.9" -[[package]] -category = "dev" -description = "Getting image size from png/jpeg/jpeg2000/gif file" -name = "imagesize" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.2.0" - [[package]] category = "dev" description = "Read metadata from Python packages" @@ -1303,126 +1254,6 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" version = "1.15.0" -[[package]] -category = "dev" -description = "This package provides 26 stemmers for 25 languages generated from Snowball algorithms." -name = "snowballstemmer" -optional = false -python-versions = "*" -version = "2.0.0" - -[[package]] -category = "dev" -description = "A modern CSS selector implementation for Beautiful Soup." -marker = "python_version >= \"3.0\"" -name = "soupsieve" -optional = false -python-versions = ">=3.5" -version = "2.0.1" - -[[package]] -category = "dev" -description = "Python documentation generator" -name = "sphinx" -optional = false -python-versions = ">=3.5" -version = "3.3.1" - -[package.dependencies] -Jinja2 = ">=2.3" -Pygments = ">=2.0" -alabaster = ">=0.7,<0.8" -babel = ">=1.3" -colorama = ">=0.3.5" -docutils = ">=0.12" -imagesize = "*" -packaging = "*" -requests = ">=2.5.0" -setuptools = "*" -snowballstemmer = ">=1.1" -sphinxcontrib-applehelp = "*" -sphinxcontrib-devhelp = "*" -sphinxcontrib-htmlhelp = "*" -sphinxcontrib-jsmath = "*" -sphinxcontrib-qthelp = "*" -sphinxcontrib-serializinghtml = "*" - -[package.extras] -docs = ["sphinxcontrib-websupport"] -lint = ["flake8 (>=3.5.0)", "flake8-import-order", "mypy (>=0.790)", "docutils-stubs"] -test = ["pytest", "pytest-cov", "html5lib", "typed-ast", "cython"] - -[[package]] -category = "dev" -description = "sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books" -name = "sphinxcontrib-applehelp" -optional = false -python-versions = ">=3.5" -version = "1.0.2" - -[package.extras] -lint = ["flake8", "mypy", "docutils-stubs"] -test = ["pytest"] - -[[package]] -category = "dev" -description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document." -name = "sphinxcontrib-devhelp" -optional = false -python-versions = ">=3.5" -version = "1.0.2" - -[package.extras] -lint = ["flake8", "mypy", "docutils-stubs"] -test = ["pytest"] - -[[package]] -category = "dev" -description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" -name = "sphinxcontrib-htmlhelp" -optional = false -python-versions = ">=3.5" -version = "1.0.3" - -[package.extras] -lint = ["flake8", "mypy", "docutils-stubs"] -test = ["pytest", "html5lib"] - -[[package]] -category = "dev" -description = "A sphinx extension which renders display math in HTML via JavaScript" -name = "sphinxcontrib-jsmath" -optional = false -python-versions = ">=3.5" -version = "1.0.1" - -[package.extras] -test = ["pytest", "flake8", "mypy"] - -[[package]] -category = "dev" -description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document." -name = "sphinxcontrib-qthelp" -optional = false -python-versions = ">=3.5" -version = "1.0.3" - -[package.extras] -lint = ["flake8", "mypy", "docutils-stubs"] -test = ["pytest"] - -[[package]] -category = "dev" -description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)." -name = "sphinxcontrib-serializinghtml" -optional = false -python-versions = ">=3.5" -version = "1.1.4" - -[package.extras] -lint = ["flake8", "mypy", "docutils-stubs"] -test = ["pytest"] - [[package]] category = "dev" description = "Python Library for Tom's Obvious, Minimal Language" @@ -1580,7 +1411,7 @@ fast = ["uvloop"] proxy = ["aiohttp-socks"] [metadata] -content-hash = "80408d8f77e71b544fdcc1d00472e5afd33edf8e4de03516bd5aa9962cf8a68a" +content-hash = "152bb9b155a00baadd3c8b9fa21f08af719180bddccb8ad6c3dd6548c3e71e3e" python-versions = "^3.7" [metadata.files] @@ -1606,10 +1437,6 @@ aiohttp-socks = [ {file = "aiohttp_socks-0.3.9-py3-none-any.whl", hash = "sha256:ccd483d7677d7ba80b7ccb738a9be27a3ad6dce4b2756509bc71c9d679d96105"}, {file = "aiohttp_socks-0.3.9.tar.gz", hash = "sha256:5e5638d0e472baa441eab7990cf19e034960cc803f259748cc359464ccb3c2d6"}, ] -alabaster = [ - {file = "alabaster-0.7.12-py2.py3-none-any.whl", hash = "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359"}, - {file = "alabaster-0.7.12.tar.gz", hash = "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"}, -] appdirs = [ {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, @@ -1649,11 +1476,6 @@ backcall = [ {file = "backcall-0.2.0-py2.py3-none-any.whl", hash = "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255"}, {file = "backcall-0.2.0.tar.gz", hash = "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e"}, ] -beautifulsoup4 = [ - {file = "beautifulsoup4-4.9.3-py2-none-any.whl", hash = "sha256:4c98143716ef1cb40bf7f39a8e3eec8f8b009509e74904ba3a7b315431577e35"}, - {file = "beautifulsoup4-4.9.3-py3-none-any.whl", hash = "sha256:fff47e031e34ec82bf17e00da8f592fe7de69aeea38be00523c04623c04fb666"}, - {file = "beautifulsoup4-4.9.3.tar.gz", hash = "sha256:84729e322ad1d5b4d25f805bfa05b902dd96450f43842c4e99067d5e1369eb25"}, -] black = [ {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, @@ -1785,10 +1607,6 @@ decorator = [ distlib = [ {file = "distlib-0.3.0.zip", hash = "sha256:2e166e231a26b36d6dfe35a48c4464346620f8645ed0ace01ee31822b288de21"}, ] -docutils = [ - {file = "docutils-0.16-py2.py3-none-any.whl", hash = "sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af"}, - {file = "docutils-0.16.tar.gz", hash = "sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"}, -] filelock = [ {file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"}, {file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"}, @@ -1801,10 +1619,6 @@ flake8-html = [ {file = "flake8-html-0.4.1.tar.gz", hash = "sha256:2fb436cbfe1e109275bc8fb7fdd0cb00e67b3b48cfeb397309b6b2c61eeb4cb4"}, {file = "flake8_html-0.4.1-py2.py3-none-any.whl", hash = "sha256:17324eb947e7006807e4184ee26953e67baf421b3cf9e646a38bfec34eec5a94"}, ] -furo = [ - {file = "furo-2020.11.15b17-py3-none-any.whl", hash = "sha256:0186e01b9be564679f15d8fda313baff633ae11d5bd28147ac8e4668eb143d62"}, - {file = "furo-2020.11.15b17.tar.gz", hash = "sha256:f34cb10ca26967b03e7511349974d720bc49709835b022944ca6c881221f1f2c"}, -] future = [ {file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"}, ] @@ -1820,10 +1634,6 @@ idna = [ {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"}, {file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"}, ] -imagesize = [ - {file = "imagesize-1.2.0-py2.py3-none-any.whl", hash = "sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1"}, - {file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"}, -] importlib-metadata = [ {file = "importlib_metadata-1.1.3-py2.py3-none-any.whl", hash = "sha256:7c7f8ac40673f507f349bef2eed21a0e5f01ddf5b2a7356a6c65eb2099b53764"}, {file = "importlib_metadata-1.1.3.tar.gz", hash = "sha256:7a99fb4084ffe6dae374961ba7a6521b79c1d07c658ab3a28aa264ee1d1b14e3"}, @@ -2221,42 +2031,6 @@ six = [ {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, ] -snowballstemmer = [ - {file = "snowballstemmer-2.0.0-py2.py3-none-any.whl", hash = "sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0"}, - {file = "snowballstemmer-2.0.0.tar.gz", hash = "sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"}, -] -soupsieve = [ - {file = "soupsieve-2.0.1-py3-none-any.whl", hash = "sha256:1634eea42ab371d3d346309b93df7870a88610f0725d47528be902a0d95ecc55"}, - {file = "soupsieve-2.0.1.tar.gz", hash = "sha256:a59dc181727e95d25f781f0eb4fd1825ff45590ec8ff49eadfd7f1a537cc0232"}, -] -sphinx = [ - {file = "Sphinx-3.3.1-py3-none-any.whl", hash = "sha256:d4e59ad4ea55efbb3c05cde3bfc83bfc14f0c95aa95c3d75346fcce186a47960"}, - {file = "Sphinx-3.3.1.tar.gz", hash = "sha256:1e8d592225447104d1172be415bc2972bd1357e3e12fdc76edf2261105db4300"}, -] -sphinxcontrib-applehelp = [ - {file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"}, - {file = "sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a"}, -] -sphinxcontrib-devhelp = [ - {file = "sphinxcontrib-devhelp-1.0.2.tar.gz", hash = "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"}, - {file = "sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e"}, -] -sphinxcontrib-htmlhelp = [ - {file = "sphinxcontrib-htmlhelp-1.0.3.tar.gz", hash = "sha256:e8f5bb7e31b2dbb25b9cc435c8ab7a79787ebf7f906155729338f3156d93659b"}, - {file = "sphinxcontrib_htmlhelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:3c0bc24a2c41e340ac37c85ced6dafc879ab485c095b1d65d2461ac2f7cca86f"}, -] -sphinxcontrib-jsmath = [ - {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"}, - {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"}, -] -sphinxcontrib-qthelp = [ - {file = "sphinxcontrib-qthelp-1.0.3.tar.gz", hash = "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"}, - {file = "sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"}, -] -sphinxcontrib-serializinghtml = [ - {file = "sphinxcontrib-serializinghtml-1.1.4.tar.gz", hash = "sha256:eaa0eccc86e982a9b939b2b82d12cc5d013385ba5eadcc7e4fed23f4405f77bc"}, - {file = "sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl", hash = "sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a"}, -] toml = [ {file = "toml-0.10.1-py2.py3-none-any.whl", hash = "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"}, {file = "toml-0.10.1.tar.gz", hash = "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f"}, diff --git a/pyproject.toml b/pyproject.toml index 98af5650..f6558956 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ aiofiles = "^0.4.0" uvloop = {version = "^0.14.0", markers = "sys_platform == 'darwin' or sys_platform == 'linux'", optional = true} async_lru = "^1.0" aiohttp-socks = {version = "^0.3.8", optional = true} +typing-extensions = {version = "^3.7.4", python = "<3.8"} [tool.poetry.dev-dependencies] uvloop = {version = "^0.14.0", markers = "sys_platform == 'darwin' or sys_platform == 'linux'"} @@ -70,6 +71,11 @@ packaging = "^20.3" typing-extensions = "^3.7.4" poetry = "^1.0.5" furo = "^2020.11.15-beta.17" +sphinx = "^3.1.0" +sphinx-intl = "^2.0.1" +sphinx-reload = "^0.2.0" +sphinx-rtd-theme = "^0.4.3" +Sphinx-Substitution-Extensions = "^2020.5.30" [tool.poetry.extras] fast = ["uvloop"]