mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 07:50:32 +00:00
Reworked bot-wide defaults (#1392)
* Reworked defaults * Added changelog and partial docs
This commit is contained in:
parent
1281bf551a
commit
24f59da70d
140 changed files with 608 additions and 530 deletions
2
.butcher/methods/copyMessage/default.yml
Normal file
2
.butcher/methods/copyMessage/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
1
.butcher/methods/editMessageCaption/default.yml
Normal file
1
.butcher/methods/editMessageCaption/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
2
.butcher/methods/editMessageText/default.yml
Normal file
2
.butcher/methods/editMessageText/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
disable_web_page_preview: link_preview_is_disabled
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
disable_web_page_preview:
|
|
||||||
value: UNSET_DISABLE_WEB_PAGE_PREVIEW
|
|
||||||
1
.butcher/methods/forwardMessage/default.yml
Normal file
1
.butcher/methods/forwardMessage/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
2
.butcher/methods/sendAnimation/default.yml
Normal file
2
.butcher/methods/sendAnimation/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
annotations:
|
annotations:
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
thumbnail:
|
thumbnail:
|
||||||
parsed_type:
|
parsed_type:
|
||||||
type: entity
|
type: entity
|
||||||
|
|
|
||||||
2
.butcher/methods/sendAudio/default.yml
Normal file
2
.butcher/methods/sendAudio/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
annotations:
|
annotations:
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
thumbnail:
|
thumbnail:
|
||||||
parsed_type:
|
parsed_type:
|
||||||
type: entity
|
type: entity
|
||||||
|
|
|
||||||
1
.butcher/methods/sendContact/default.yml
Normal file
1
.butcher/methods/sendContact/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
1
.butcher/methods/sendDice/default.yml
Normal file
1
.butcher/methods/sendDice/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
2
.butcher/methods/sendDocument/default.yml
Normal file
2
.butcher/methods/sendDocument/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
annotations:
|
annotations:
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
thumbnail:
|
thumbnail:
|
||||||
parsed_type:
|
parsed_type:
|
||||||
type: entity
|
type: entity
|
||||||
|
|
|
||||||
1
.butcher/methods/sendGame/default.yml
Normal file
1
.butcher/methods/sendGame/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
1
.butcher/methods/sendInvoice/default.yml
Normal file
1
.butcher/methods/sendInvoice/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
1
.butcher/methods/sendLocation/default.yml
Normal file
1
.butcher/methods/sendLocation/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
1
.butcher/methods/sendMediaGroup/default.yml
Normal file
1
.butcher/methods/sendMediaGroup/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
4
.butcher/methods/sendMessage/default.yml
Normal file
4
.butcher/methods/sendMessage/default.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
disable_web_page_preview: link_preview_is_disabled
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
link_preview_options: link_preview
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
disable_web_page_preview:
|
|
||||||
value: UNSET_DISABLE_WEB_PAGE_PREVIEW
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
2
.butcher/methods/sendPhoto/default.yml
Normal file
2
.butcher/methods/sendPhoto/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
2
.butcher/methods/sendPoll/default.yml
Normal file
2
.butcher/methods/sendPoll/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
explanation_parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
annotations:
|
annotations:
|
||||||
explanation_parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
close_date:
|
close_date:
|
||||||
parsed_type:
|
parsed_type:
|
||||||
type: union
|
type: union
|
||||||
|
|
|
||||||
1
.butcher/methods/sendSticker/default.yml
Normal file
1
.butcher/methods/sendSticker/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
1
.butcher/methods/sendVenue/default.yml
Normal file
1
.butcher/methods/sendVenue/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
2
.butcher/methods/sendVideo/default.yml
Normal file
2
.butcher/methods/sendVideo/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
annotations:
|
annotations:
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
thumbnail:
|
thumbnail:
|
||||||
parsed_type:
|
parsed_type:
|
||||||
type: entity
|
type: entity
|
||||||
|
|
|
||||||
1
.butcher/methods/sendVideoNote/default.yml
Normal file
1
.butcher/methods/sendVideoNote/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
annotations:
|
annotations:
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
thumbnail:
|
thumbnail:
|
||||||
parsed_type:
|
parsed_type:
|
||||||
type: entity
|
type: entity
|
||||||
|
|
|
||||||
2
.butcher/methods/sendVoice/default.yml
Normal file
2
.butcher/methods/sendVoice/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
protect_content: protect_content
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
protect_content:
|
|
||||||
value: UNSET_PROTECT_CONTENT
|
|
||||||
1
.butcher/types/InlineQueryResultAudio/default.yml
Normal file
1
.butcher/types/InlineQueryResultAudio/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultCachedAudio/default.yml
Normal file
1
.butcher/types/InlineQueryResultCachedAudio/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultCachedGif/default.yml
Normal file
1
.butcher/types/InlineQueryResultCachedGif/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultCachedPhoto/default.yml
Normal file
1
.butcher/types/InlineQueryResultCachedPhoto/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultCachedVideo/default.yml
Normal file
1
.butcher/types/InlineQueryResultCachedVideo/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultCachedVoice/default.yml
Normal file
1
.butcher/types/InlineQueryResultCachedVoice/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultDocument/default.yml
Normal file
1
.butcher/types/InlineQueryResultDocument/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultGif/default.yml
Normal file
1
.butcher/types/InlineQueryResultGif/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultMpeg4Gif/default.yml
Normal file
1
.butcher/types/InlineQueryResultMpeg4Gif/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultPhoto/default.yml
Normal file
1
.butcher/types/InlineQueryResultPhoto/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultVideo/default.yml
Normal file
1
.butcher/types/InlineQueryResultVideo/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InlineQueryResultVoice/default.yml
Normal file
1
.butcher/types/InlineQueryResultVoice/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
.butcher/types/InputMediaAnimation/default.yml
Normal file
1
.butcher/types/InputMediaAnimation/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -15,5 +15,3 @@ annotations:
|
||||||
references:
|
references:
|
||||||
category: types
|
category: types
|
||||||
name: InputFile
|
name: InputFile
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
|
|
|
||||||
1
.butcher/types/InputMediaAudio/default.yml
Normal file
1
.butcher/types/InputMediaAudio/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -15,5 +15,3 @@ annotations:
|
||||||
references:
|
references:
|
||||||
category: types
|
category: types
|
||||||
name: InputFile
|
name: InputFile
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
|
|
|
||||||
1
.butcher/types/InputMediaDocument/default.yml
Normal file
1
.butcher/types/InputMediaDocument/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -15,5 +15,3 @@ annotations:
|
||||||
references:
|
references:
|
||||||
category: types
|
category: types
|
||||||
name: InputFile
|
name: InputFile
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
|
|
|
||||||
1
.butcher/types/InputMediaPhoto/default.yml
Normal file
1
.butcher/types/InputMediaPhoto/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -9,5 +9,3 @@ annotations:
|
||||||
references:
|
references:
|
||||||
category: types
|
category: types
|
||||||
name: InputFile
|
name: InputFile
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
|
|
|
||||||
1
.butcher/types/InputMediaVideo/default.yml
Normal file
1
.butcher/types/InputMediaVideo/default.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -15,5 +15,3 @@ annotations:
|
||||||
references:
|
references:
|
||||||
category: types
|
category: types
|
||||||
name: InputFile
|
name: InputFile
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
|
|
|
||||||
2
.butcher/types/InputTextMessageContent/default.yml
Normal file
2
.butcher/types/InputTextMessageContent/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
disable_web_page_preview: disable_web_page_preview
|
||||||
|
parse_mode: parse_mode
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
annotations:
|
|
||||||
parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
disable_web_page_preview:
|
|
||||||
value: UNSET_DISABLE_WEB_PAGE_PREVIEW
|
|
||||||
4
.butcher/types/LinkPreviewOptions/default.yml
Normal file
4
.butcher/types/LinkPreviewOptions/default.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
is_disabled: link_preview_is_disabled
|
||||||
|
prefer_small_media: link_preview_prefer_small_media
|
||||||
|
prefer_large_media: link_preview_prefer_large_media
|
||||||
|
show_above_text: link_preview_show_above_text
|
||||||
2
.butcher/types/ReplyParameters/default.yml
Normal file
2
.butcher/types/ReplyParameters/default.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
quote_parse_mode: parse_mode
|
||||||
|
allow_sending_without_reply: allow_sending_without_reply
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
annotations:
|
|
||||||
quote_parse_mode:
|
|
||||||
value: UNSET_PARSE_MODE
|
|
||||||
1
CHANGES/1392.feature.rst
Normal file
1
CHANGES/1392.feature.rst
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Reworked bot-wide globals like :code:`parse_mode`, :code:`disable_web_page_preview`, and others to be more flexible.
|
||||||
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||||
import datetime
|
import datetime
|
||||||
import io
|
import io
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import warnings
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
|
|
@ -143,7 +144,6 @@ from ..methods import (
|
||||||
UploadStickerFile,
|
UploadStickerFile,
|
||||||
)
|
)
|
||||||
from ..types import (
|
from ..types import (
|
||||||
UNSET_PARSE_MODE,
|
|
||||||
BotCommand,
|
BotCommand,
|
||||||
BotCommandScopeAllChatAdministrators,
|
BotCommandScopeAllChatAdministrators,
|
||||||
BotCommandScopeAllGroupChats,
|
BotCommandScopeAllGroupChats,
|
||||||
|
|
@ -233,7 +233,7 @@ from ..types import (
|
||||||
UserProfilePhotos,
|
UserProfilePhotos,
|
||||||
WebhookInfo,
|
WebhookInfo,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW, UNSET_PROTECT_CONTENT
|
from .default import Default, DefaultBotProperties
|
||||||
from .session.aiohttp import AiohttpSession
|
from .session.aiohttp import AiohttpSession
|
||||||
from .session.base import BaseSession
|
from .session.base import BaseSession
|
||||||
|
|
||||||
|
|
@ -248,6 +248,7 @@ class Bot:
|
||||||
parse_mode: Optional[str] = None,
|
parse_mode: Optional[str] = None,
|
||||||
disable_web_page_preview: Optional[bool] = None,
|
disable_web_page_preview: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = None,
|
protect_content: Optional[bool] = None,
|
||||||
|
default: Optional[DefaultBotProperties] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Bot class
|
Bot class
|
||||||
|
|
@ -261,6 +262,8 @@ class Bot:
|
||||||
If specified it will be propagated into the API methods at runtime.
|
If specified it will be propagated into the API methods at runtime.
|
||||||
:param protect_content: Default protect_content mode.
|
:param protect_content: Default protect_content mode.
|
||||||
If specified it will be propagated into the API methods at runtime.
|
If specified it will be propagated into the API methods at runtime.
|
||||||
|
:param default: Default bot properties.
|
||||||
|
If specified it will be propagated into the API methods at runtime.
|
||||||
:raise TokenValidationError: When token has invalid format this exception will be raised
|
:raise TokenValidationError: When token has invalid format this exception will be raised
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -268,11 +271,29 @@ class Bot:
|
||||||
|
|
||||||
if session is None:
|
if session is None:
|
||||||
session = AiohttpSession()
|
session = AiohttpSession()
|
||||||
|
if default is None:
|
||||||
|
default = DefaultBotProperties(
|
||||||
|
parse_mode=parse_mode,
|
||||||
|
link_preview_is_disabled=disable_web_page_preview,
|
||||||
|
protect_content=protect_content,
|
||||||
|
)
|
||||||
|
|
||||||
self.session = session
|
self.session = session
|
||||||
self.parse_mode = parse_mode
|
if (
|
||||||
self.disable_web_page_preview = disable_web_page_preview
|
parse_mode is not None
|
||||||
self.protect_content = protect_content
|
or disable_web_page_preview is not None
|
||||||
|
or protect_content is not None
|
||||||
|
):
|
||||||
|
warnings.warn(
|
||||||
|
"Passing `parse_mode`, `disable_web_page_preview` or `protect_content` "
|
||||||
|
"to Bot initializer is deprecated. This arguments will be removed in 3.5.0 version\n"
|
||||||
|
"Use `default=DefaultBotProperties(...)` instead.",
|
||||||
|
category=DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.default = default
|
||||||
|
|
||||||
self.__token = token
|
self.__token = token
|
||||||
self._me: Optional[User] = None
|
self._me: Optional[User] = None
|
||||||
|
|
||||||
|
|
@ -805,10 +826,10 @@ class Bot:
|
||||||
message_id: int,
|
message_id: int,
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -1302,7 +1323,7 @@ class Bot:
|
||||||
message_id: Optional[int] = None,
|
message_id: Optional[int] = None,
|
||||||
inline_message_id: Optional[str] = None,
|
inline_message_id: Optional[str] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||||
request_timeout: Optional[int] = None,
|
request_timeout: Optional[int] = None,
|
||||||
|
|
@ -1451,11 +1472,13 @@ class Bot:
|
||||||
chat_id: Optional[Union[int, str]] = None,
|
chat_id: Optional[Union[int, str]] = None,
|
||||||
message_id: Optional[int] = None,
|
message_id: Optional[int] = None,
|
||||||
inline_message_id: Optional[str] = None,
|
inline_message_id: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
entities: Optional[List[MessageEntity]] = None,
|
entities: Optional[List[MessageEntity]] = None,
|
||||||
link_preview_options: Optional[LinkPreviewOptions] = None,
|
link_preview_options: Optional[LinkPreviewOptions] = None,
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||||
disable_web_page_preview: Optional[bool] = UNSET_DISABLE_WEB_PAGE_PREVIEW,
|
disable_web_page_preview: Optional[Union[bool, Default]] = Default(
|
||||||
|
"link_preview_is_disabled"
|
||||||
|
),
|
||||||
request_timeout: Optional[int] = None,
|
request_timeout: Optional[int] = None,
|
||||||
) -> Union[Message, bool]:
|
) -> Union[Message, bool]:
|
||||||
"""
|
"""
|
||||||
|
|
@ -1518,7 +1541,7 @@ class Bot:
|
||||||
message_id: int,
|
message_id: int,
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
request_timeout: Optional[int] = None,
|
request_timeout: Optional[int] = None,
|
||||||
) -> Message:
|
) -> Message:
|
||||||
"""
|
"""
|
||||||
|
|
@ -2137,11 +2160,11 @@ class Bot:
|
||||||
height: Optional[int] = None,
|
height: Optional[int] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
has_spoiler: Optional[bool] = None,
|
has_spoiler: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2203,14 +2226,14 @@ class Bot:
|
||||||
audio: Union[InputFile, str],
|
audio: Union[InputFile, str],
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
duration: Optional[int] = None,
|
duration: Optional[int] = None,
|
||||||
performer: Optional[str] = None,
|
performer: Optional[str] = None,
|
||||||
title: Optional[str] = None,
|
title: Optional[str] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2304,7 +2327,7 @@ class Bot:
|
||||||
last_name: Optional[str] = None,
|
last_name: Optional[str] = None,
|
||||||
vcard: Optional[str] = None,
|
vcard: Optional[str] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2356,7 +2379,7 @@ class Bot:
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
emoji: Optional[str] = None,
|
emoji: Optional[str] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2403,11 +2426,11 @@ class Bot:
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
disable_content_type_detection: Optional[bool] = None,
|
disable_content_type_detection: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2463,7 +2486,7 @@ class Bot:
|
||||||
game_short_name: str,
|
game_short_name: str,
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||||
allow_sending_without_reply: Optional[bool] = None,
|
allow_sending_without_reply: Optional[bool] = None,
|
||||||
|
|
@ -2527,7 +2550,7 @@ class Bot:
|
||||||
send_email_to_provider: Optional[bool] = None,
|
send_email_to_provider: Optional[bool] = None,
|
||||||
is_flexible: Optional[bool] = None,
|
is_flexible: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||||
allow_sending_without_reply: Optional[bool] = None,
|
allow_sending_without_reply: Optional[bool] = None,
|
||||||
|
|
@ -2616,7 +2639,7 @@ class Bot:
|
||||||
heading: Optional[int] = None,
|
heading: Optional[int] = None,
|
||||||
proximity_alert_radius: Optional[int] = None,
|
proximity_alert_radius: Optional[int] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2672,7 +2695,7 @@ class Bot:
|
||||||
media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]],
|
media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]],
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
allow_sending_without_reply: Optional[bool] = None,
|
allow_sending_without_reply: Optional[bool] = None,
|
||||||
reply_to_message_id: Optional[int] = None,
|
reply_to_message_id: Optional[int] = None,
|
||||||
|
|
@ -2712,17 +2735,21 @@ class Bot:
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
text: str,
|
text: str,
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
entities: Optional[List[MessageEntity]] = None,
|
entities: Optional[List[MessageEntity]] = None,
|
||||||
link_preview_options: Optional[LinkPreviewOptions] = None,
|
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default(
|
||||||
|
"link_preview"
|
||||||
|
),
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
] = None,
|
] = None,
|
||||||
allow_sending_without_reply: Optional[bool] = None,
|
allow_sending_without_reply: Optional[bool] = None,
|
||||||
disable_web_page_preview: Optional[bool] = UNSET_DISABLE_WEB_PAGE_PREVIEW,
|
disable_web_page_preview: Optional[Union[bool, Default]] = Default(
|
||||||
|
"link_preview_is_disabled"
|
||||||
|
),
|
||||||
reply_to_message_id: Optional[int] = None,
|
reply_to_message_id: Optional[int] = None,
|
||||||
request_timeout: Optional[int] = None,
|
request_timeout: Optional[int] = None,
|
||||||
) -> Message:
|
) -> Message:
|
||||||
|
|
@ -2771,11 +2798,11 @@ class Bot:
|
||||||
photo: Union[InputFile, str],
|
photo: Union[InputFile, str],
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
has_spoiler: Optional[bool] = None,
|
has_spoiler: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2834,13 +2861,13 @@ class Bot:
|
||||||
allows_multiple_answers: Optional[bool] = None,
|
allows_multiple_answers: Optional[bool] = None,
|
||||||
correct_option_id: Optional[int] = None,
|
correct_option_id: Optional[int] = None,
|
||||||
explanation: Optional[str] = None,
|
explanation: Optional[str] = None,
|
||||||
explanation_parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
explanation_entities: Optional[List[MessageEntity]] = None,
|
explanation_entities: Optional[List[MessageEntity]] = None,
|
||||||
open_period: Optional[int] = None,
|
open_period: Optional[int] = None,
|
||||||
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||||
is_closed: Optional[bool] = None,
|
is_closed: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2909,7 +2936,7 @@ class Bot:
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
emoji: Optional[str] = None,
|
emoji: Optional[str] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -2964,7 +2991,7 @@ class Bot:
|
||||||
google_place_id: Optional[str] = None,
|
google_place_id: Optional[str] = None,
|
||||||
google_place_type: Optional[str] = None,
|
google_place_type: Optional[str] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -3028,12 +3055,12 @@ class Bot:
|
||||||
height: Optional[int] = None,
|
height: Optional[int] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
has_spoiler: Optional[bool] = None,
|
has_spoiler: Optional[bool] = None,
|
||||||
supports_streaming: Optional[bool] = None,
|
supports_streaming: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -3100,7 +3127,7 @@ class Bot:
|
||||||
length: Optional[int] = None,
|
length: Optional[int] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
@ -3152,11 +3179,11 @@ class Bot:
|
||||||
voice: Union[InputFile, str],
|
voice: Union[InputFile, str],
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
duration: Optional[int] = None,
|
duration: Optional[int] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
|
||||||
84
aiogram/client/default.py
Normal file
84
aiogram/client/default.py
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import TYPE_CHECKING, Any, Dict, Optional
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from aiogram.types import LinkPreviewOptions
|
||||||
|
|
||||||
|
|
||||||
|
# @dataclass ??
|
||||||
|
class Default:
|
||||||
|
# Is not a dataclass because of JSON serialization.
|
||||||
|
|
||||||
|
__slots__ = ("_name",)
|
||||||
|
|
||||||
|
def __init__(self, name: str) -> None:
|
||||||
|
self._name = name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self) -> str:
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return f"Default({self._name!r})"
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
return f"<{self}>"
|
||||||
|
|
||||||
|
|
||||||
|
_dataclass_properties: Dict[str, Any] = {}
|
||||||
|
if sys.version_info >= (3, 10):
|
||||||
|
# Speedup attribute access for dataclasses in Python 3.10+
|
||||||
|
_dataclass_properties.update({"slots": True, "kw_only": True})
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(**_dataclass_properties)
|
||||||
|
class DefaultBotProperties:
|
||||||
|
"""
|
||||||
|
Default bot properties.
|
||||||
|
"""
|
||||||
|
|
||||||
|
parse_mode: Optional[str] = None
|
||||||
|
"""Default parse mode for messages."""
|
||||||
|
disable_notification: Optional[bool] = None
|
||||||
|
"""Sends the message silently. Users will receive a notification with no sound."""
|
||||||
|
protect_content: Optional[bool] = None
|
||||||
|
"""Protects content from copying."""
|
||||||
|
allow_sending_without_reply: Optional[bool] = None
|
||||||
|
"""Allows to send messages without reply."""
|
||||||
|
|
||||||
|
link_preview: Optional[LinkPreviewOptions] = None
|
||||||
|
"""Link preview settings."""
|
||||||
|
link_preview_is_disabled: Optional[bool] = None
|
||||||
|
"""Disables link preview."""
|
||||||
|
link_preview_prefer_small_media: Optional[bool] = None
|
||||||
|
"""Prefer small media in link preview."""
|
||||||
|
link_preview_prefer_large_media: Optional[bool] = None
|
||||||
|
"""Prefer large media in link preview."""
|
||||||
|
link_preview_show_above_text: Optional[bool] = None
|
||||||
|
"""Show link preview above text."""
|
||||||
|
|
||||||
|
def __post_init__(self) -> None:
|
||||||
|
has_any_link_preview_option = any(
|
||||||
|
(
|
||||||
|
self.link_preview_is_disabled,
|
||||||
|
self.link_preview_prefer_small_media,
|
||||||
|
self.link_preview_prefer_large_media,
|
||||||
|
self.link_preview_show_above_text,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if has_any_link_preview_option and self.link_preview is None:
|
||||||
|
from ..types import LinkPreviewOptions
|
||||||
|
|
||||||
|
self.link_preview = LinkPreviewOptions(
|
||||||
|
is_disabled=self.link_preview_is_disabled,
|
||||||
|
prefer_small_media=self.link_preview_prefer_small_media,
|
||||||
|
prefer_large_media=self.link_preview_prefer_large_media,
|
||||||
|
show_above_text=self.link_preview_show_above_text,
|
||||||
|
)
|
||||||
|
|
||||||
|
def __getitem__(self, item: str) -> Any:
|
||||||
|
return getattr(self, item, None)
|
||||||
|
|
@ -6,7 +6,6 @@ from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
AsyncGenerator,
|
AsyncGenerator,
|
||||||
AsyncIterator,
|
|
||||||
Dict,
|
Dict,
|
||||||
Iterable,
|
Iterable,
|
||||||
List,
|
List,
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ from aiogram.exceptions import (
|
||||||
|
|
||||||
from ...methods import Response, TelegramMethod
|
from ...methods import Response, TelegramMethod
|
||||||
from ...methods.base import TelegramType
|
from ...methods.base import TelegramType
|
||||||
from ...types import UNSET_PARSE_MODE, InputFile
|
from ...types import InputFile
|
||||||
from ...types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW, UNSET_PROTECT_CONTENT
|
from ..default import Default
|
||||||
from ..telegram import PRODUCTION, TelegramAPIServer
|
from ..telegram import PRODUCTION, TelegramAPIServer
|
||||||
from .middlewares.manager import RequestMiddlewareManager
|
from .middlewares.manager import RequestMiddlewareManager
|
||||||
|
|
||||||
|
|
@ -191,18 +191,9 @@ class BaseSession(abc.ABC):
|
||||||
return None
|
return None
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
return value
|
return value
|
||||||
if value is UNSET_PARSE_MODE:
|
if isinstance(value, Default):
|
||||||
return self.prepare_value(
|
default_value = bot.default[value.name]
|
||||||
bot.parse_mode, bot=bot, files=files, _dumps_json=_dumps_json
|
return self.prepare_value(default_value, bot=bot, files=files, _dumps_json=_dumps_json)
|
||||||
)
|
|
||||||
if value is UNSET_DISABLE_WEB_PAGE_PREVIEW:
|
|
||||||
return self.prepare_value(
|
|
||||||
bot.disable_web_page_preview, bot=bot, files=files, _dumps_json=_dumps_json
|
|
||||||
)
|
|
||||||
if value is UNSET_PROTECT_CONTENT:
|
|
||||||
return self.prepare_value(
|
|
||||||
bot.protect_content, bot=bot, files=files, _dumps_json=_dumps_json
|
|
||||||
)
|
|
||||||
if isinstance(value, InputFile):
|
if isinstance(value, InputFile):
|
||||||
key = secrets.token_urlsafe(10)
|
key = secrets.token_urlsafe(10)
|
||||||
files[key] = value
|
files[key] = value
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import (
|
from ..types import (
|
||||||
UNSET_PARSE_MODE,
|
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
MessageEntity,
|
MessageEntity,
|
||||||
|
|
@ -14,7 +14,6 @@ from ..types import (
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
ReplyParameters,
|
ReplyParameters,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -38,13 +37,13 @@ class CopyMessage(TelegramMethod[MessageId]):
|
||||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||||
caption: Optional[str] = None
|
caption: Optional[str] = None
|
||||||
"""New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"""
|
"""New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"""
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||||
"""Mode for parsing entities in the new caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
"""Mode for parsing entities in the new caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||||
caption_entities: Optional[List[MessageEntity]] = None
|
caption_entities: Optional[List[MessageEntity]] = None
|
||||||
"""A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of *parse_mode*"""
|
"""A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of *parse_mode*"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the sent message from forwarding and saving"""
|
"""Protects the contents of the sent message from forwarding and saving"""
|
||||||
reply_parameters: Optional[ReplyParameters] = None
|
reply_parameters: Optional[ReplyParameters] = None
|
||||||
"""Description of the message to reply to"""
|
"""Description of the message to reply to"""
|
||||||
|
|
@ -77,10 +76,10 @@ class CopyMessage(TelegramMethod[MessageId]):
|
||||||
message_id: int,
|
message_id: int,
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity
|
from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
@ -24,7 +25,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
|
||||||
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
|
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
|
||||||
caption: Optional[str] = None
|
caption: Optional[str] = None
|
||||||
"""New caption of the message, 0-1024 characters after entities parsing"""
|
"""New caption of the message, 0-1024 characters after entities parsing"""
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||||
"""Mode for parsing entities in the message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
"""Mode for parsing entities in the message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||||
caption_entities: Optional[List[MessageEntity]] = None
|
caption_entities: Optional[List[MessageEntity]] = None
|
||||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||||
|
|
@ -42,7 +43,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
|
||||||
message_id: Optional[int] = None,
|
message_id: Optional[int] = None,
|
||||||
inline_message_id: Optional[str] = None,
|
inline_message_id: Optional[str] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||||
**__pydantic_kwargs: Any,
|
**__pydantic_kwargs: Any,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import (
|
from ..types import (
|
||||||
UNSET_PARSE_MODE,
|
UNSET_PARSE_MODE,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -11,7 +12,6 @@ from ..types import (
|
||||||
Message,
|
Message,
|
||||||
MessageEntity,
|
MessageEntity,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
||||||
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
|
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
|
||||||
inline_message_id: Optional[str] = None
|
inline_message_id: Optional[str] = None
|
||||||
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
|
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||||
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||||
entities: Optional[List[MessageEntity]] = None
|
entities: Optional[List[MessageEntity]] = None
|
||||||
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
|
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
|
||||||
|
|
@ -41,8 +41,8 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
||||||
"""Link preview generation options for the message"""
|
"""Link preview generation options for the message"""
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||||
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
|
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
|
||||||
disable_web_page_preview: Optional[bool] = Field(
|
disable_web_page_preview: Optional[Union[bool, Default]] = Field(
|
||||||
UNSET_DISABLE_WEB_PAGE_PREVIEW, json_schema_extra={"deprecated": True}
|
Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True}
|
||||||
)
|
)
|
||||||
"""Disables link previews for links in this message
|
"""Disables link previews for links in this message
|
||||||
|
|
||||||
|
|
@ -60,11 +60,13 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
||||||
chat_id: Optional[Union[int, str]] = None,
|
chat_id: Optional[Union[int, str]] = None,
|
||||||
message_id: Optional[int] = None,
|
message_id: Optional[int] = None,
|
||||||
inline_message_id: Optional[str] = None,
|
inline_message_id: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
entities: Optional[List[MessageEntity]] = None,
|
entities: Optional[List[MessageEntity]] = None,
|
||||||
link_preview_options: Optional[LinkPreviewOptions] = None,
|
link_preview_options: Optional[LinkPreviewOptions] = None,
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||||
disable_web_page_preview: Optional[bool] = UNSET_DISABLE_WEB_PAGE_PREVIEW,
|
disable_web_page_preview: Optional[Union[bool, Default]] = Default(
|
||||||
|
"link_preview_is_disabled"
|
||||||
|
),
|
||||||
**__pydantic_kwargs: Any,
|
**__pydantic_kwargs: Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
# DO NOT EDIT MANUALLY!!!
|
# DO NOT EDIT MANUALLY!!!
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import Message
|
from ..types import Message
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
from ..types.base import UNSET_PROTECT_CONTENT
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
@ -27,7 +28,7 @@ class ForwardMessage(TelegramMethod[Message]):
|
||||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the forwarded message from forwarding and saving"""
|
"""Protects the contents of the forwarded message from forwarding and saving"""
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
@ -42,7 +43,7 @@ class ForwardMessage(TelegramMethod[Message]):
|
||||||
message_id: int,
|
message_id: int,
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
**__pydantic_kwargs: Any,
|
**__pydantic_kwargs: Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
# DO NOT EDIT MANUALLY!!!
|
# DO NOT EDIT MANUALLY!!!
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import (
|
from ..types import (
|
||||||
UNSET_PARSE_MODE,
|
UNSET_PARSE_MODE,
|
||||||
ForceReply,
|
ForceReply,
|
||||||
|
|
@ -15,7 +16,6 @@ from ..types import (
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
ReplyParameters,
|
ReplyParameters,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ class SendAnimation(TelegramMethod[Message]):
|
||||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
|
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
|
||||||
caption: Optional[str] = None
|
caption: Optional[str] = None
|
||||||
"""Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing"""
|
"""Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing"""
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||||
"""Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
"""Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||||
caption_entities: Optional[List[MessageEntity]] = None
|
caption_entities: Optional[List[MessageEntity]] = None
|
||||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||||
|
|
@ -53,7 +53,7 @@ class SendAnimation(TelegramMethod[Message]):
|
||||||
"""Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
|
"""Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the sent message from forwarding and saving"""
|
"""Protects the contents of the sent message from forwarding and saving"""
|
||||||
reply_parameters: Optional[ReplyParameters] = None
|
reply_parameters: Optional[ReplyParameters] = None
|
||||||
"""Description of the message to reply to"""
|
"""Description of the message to reply to"""
|
||||||
|
|
@ -89,11 +89,11 @@ class SendAnimation(TelegramMethod[Message]):
|
||||||
height: Optional[int] = None,
|
height: Optional[int] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
has_spoiler: Optional[bool] = None,
|
has_spoiler: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import (
|
from ..types import (
|
||||||
UNSET_PARSE_MODE,
|
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
InputFile,
|
InputFile,
|
||||||
|
|
@ -15,7 +15,6 @@ from ..types import (
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
ReplyParameters,
|
ReplyParameters,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -38,7 +37,7 @@ class SendAudio(TelegramMethod[Message]):
|
||||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||||
caption: Optional[str] = None
|
caption: Optional[str] = None
|
||||||
"""Audio caption, 0-1024 characters after entities parsing"""
|
"""Audio caption, 0-1024 characters after entities parsing"""
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||||
"""Mode for parsing entities in the audio caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
"""Mode for parsing entities in the audio caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||||
caption_entities: Optional[List[MessageEntity]] = None
|
caption_entities: Optional[List[MessageEntity]] = None
|
||||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||||
|
|
@ -52,7 +51,7 @@ class SendAudio(TelegramMethod[Message]):
|
||||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
|
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the sent message from forwarding and saving"""
|
"""Protects the contents of the sent message from forwarding and saving"""
|
||||||
reply_parameters: Optional[ReplyParameters] = None
|
reply_parameters: Optional[ReplyParameters] = None
|
||||||
"""Description of the message to reply to"""
|
"""Description of the message to reply to"""
|
||||||
|
|
@ -84,14 +83,14 @@ class SendAudio(TelegramMethod[Message]):
|
||||||
audio: Union[InputFile, str],
|
audio: Union[InputFile, str],
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
duration: Optional[int] = None,
|
duration: Optional[int] = None,
|
||||||
performer: Optional[str] = None,
|
performer: Optional[str] = None,
|
||||||
title: Optional[str] = None,
|
title: Optional[str] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -12,7 +13,6 @@ from ..types import (
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
ReplyParameters,
|
ReplyParameters,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ class SendContact(TelegramMethod[Message]):
|
||||||
"""Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_, 0-2048 bytes"""
|
"""Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_, 0-2048 bytes"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the sent message from forwarding and saving"""
|
"""Protects the contents of the sent message from forwarding and saving"""
|
||||||
reply_parameters: Optional[ReplyParameters] = None
|
reply_parameters: Optional[ReplyParameters] = None
|
||||||
"""Description of the message to reply to"""
|
"""Description of the message to reply to"""
|
||||||
|
|
@ -75,7 +75,7 @@ class SendContact(TelegramMethod[Message]):
|
||||||
last_name: Optional[str] = None,
|
last_name: Optional[str] = None,
|
||||||
vcard: Optional[str] = None,
|
vcard: Optional[str] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -12,7 +13,6 @@ from ..types import (
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
ReplyParameters,
|
ReplyParameters,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ class SendDice(TelegramMethod[Message]):
|
||||||
"""Emoji on which the dice throw animation is based. Currently, must be one of '🎲', '🎯', '🏀', '⚽', '🎳', or '🎰'. Dice can have values 1-6 for '🎲', '🎯' and '🎳', values 1-5 for '🏀' and '⚽', and values 1-64 for '🎰'. Defaults to '🎲'"""
|
"""Emoji on which the dice throw animation is based. Currently, must be one of '🎲', '🎯', '🏀', '⚽', '🎳', or '🎰'. Dice can have values 1-6 for '🎲', '🎯' and '🎳', values 1-5 for '🏀' and '⚽', and values 1-64 for '🎰'. Defaults to '🎲'"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the sent message from forwarding"""
|
"""Protects the contents of the sent message from forwarding"""
|
||||||
reply_parameters: Optional[ReplyParameters] = None
|
reply_parameters: Optional[ReplyParameters] = None
|
||||||
"""Description of the message to reply to"""
|
"""Description of the message to reply to"""
|
||||||
|
|
@ -66,7 +66,7 @@ class SendDice(TelegramMethod[Message]):
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
emoji: Optional[str] = None,
|
emoji: Optional[str] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import (
|
from ..types import (
|
||||||
UNSET_PARSE_MODE,
|
UNSET_PARSE_MODE,
|
||||||
ForceReply,
|
ForceReply,
|
||||||
|
|
@ -15,7 +16,6 @@ from ..types import (
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
ReplyParameters,
|
ReplyParameters,
|
||||||
)
|
)
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ class SendDocument(TelegramMethod[Message]):
|
||||||
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
|
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
|
||||||
caption: Optional[str] = None
|
caption: Optional[str] = None
|
||||||
"""Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing"""
|
"""Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing"""
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||||
"""Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
"""Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||||
caption_entities: Optional[List[MessageEntity]] = None
|
caption_entities: Optional[List[MessageEntity]] = None
|
||||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||||
|
|
@ -47,7 +47,7 @@ class SendDocument(TelegramMethod[Message]):
|
||||||
"""Disables automatic server-side content type detection for files uploaded using multipart/form-data"""
|
"""Disables automatic server-side content type detection for files uploaded using multipart/form-data"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the sent message from forwarding and saving"""
|
"""Protects the contents of the sent message from forwarding and saving"""
|
||||||
reply_parameters: Optional[ReplyParameters] = None
|
reply_parameters: Optional[ReplyParameters] = None
|
||||||
"""Description of the message to reply to"""
|
"""Description of the message to reply to"""
|
||||||
|
|
@ -80,11 +80,11 @@ class SendDocument(TelegramMethod[Message]):
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
thumbnail: Optional[InputFile] = None,
|
thumbnail: Optional[InputFile] = None,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
parse_mode: Optional[str] = UNSET_PARSE_MODE,
|
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
|
||||||
caption_entities: Optional[List[MessageEntity]] = None,
|
caption_entities: Optional[List[MessageEntity]] = None,
|
||||||
disable_content_type_detection: Optional[bool] = None,
|
disable_content_type_detection: Optional[bool] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[
|
reply_markup: Optional[
|
||||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Optional
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from ..client.default import Default
|
||||||
from ..types import InlineKeyboardMarkup, Message, ReplyParameters
|
from ..types import InlineKeyboardMarkup, Message, ReplyParameters
|
||||||
from ..types.base import UNSET_PROTECT_CONTENT
|
|
||||||
from .base import TelegramMethod
|
from .base import TelegramMethod
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ class SendGame(TelegramMethod[Message]):
|
||||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||||
disable_notification: Optional[bool] = None
|
disable_notification: Optional[bool] = None
|
||||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||||
"""Protects the contents of the sent message from forwarding and saving"""
|
"""Protects the contents of the sent message from forwarding and saving"""
|
||||||
reply_parameters: Optional[ReplyParameters] = None
|
reply_parameters: Optional[ReplyParameters] = None
|
||||||
"""Description of the message to reply to"""
|
"""Description of the message to reply to"""
|
||||||
|
|
@ -57,7 +57,7 @@ class SendGame(TelegramMethod[Message]):
|
||||||
game_short_name: str,
|
game_short_name: str,
|
||||||
message_thread_id: Optional[int] = None,
|
message_thread_id: Optional[int] = None,
|
||||||
disable_notification: Optional[bool] = None,
|
disable_notification: Optional[bool] = None,
|
||||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
|
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||||
reply_parameters: Optional[ReplyParameters] = None,
|
reply_parameters: Optional[ReplyParameters] = None,
|
||||||
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
||||||
allow_sending_without_reply: Optional[bool] = None,
|
allow_sending_without_reply: Optional[bool] = None,
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue