Reworked bot-wide defaults (#1392)

* Reworked defaults

* Added changelog and partial docs
This commit is contained in:
Alex Root Junior 2024-01-27 17:19:45 +02:00 committed by GitHub
parent 1281bf551a
commit 24f59da70d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
140 changed files with 608 additions and 530 deletions

View file

@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
InlineKeyboardMarkup,
MessageEntity,
@ -14,7 +14,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
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"""
caption: Optional[str] = None
"""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."""
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*"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -77,10 +76,10 @@ class CopyMessage(TelegramMethod[MessageId]):
message_id: int,
message_thread_id: Optional[int] = 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,
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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -2,6 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..client.default import Default
from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity
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"""
caption: Optional[str] = None
"""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."""
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*"""
@ -42,7 +43,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
message_id: Optional[int] = None,
inline_message_id: 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,
reply_markup: Optional[InlineKeyboardMarkup] = None,
**__pydantic_kwargs: Any,

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
InlineKeyboardMarkup,
@ -11,7 +12,6 @@ from ..types import (
Message,
MessageEntity,
)
from ..types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW
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"""
inline_message_id: Optional[str] = None
"""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."""
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*"""
@ -41,8 +41,8 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
"""Link preview generation options for the message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
disable_web_page_preview: Optional[bool] = Field(
UNSET_DISABLE_WEB_PAGE_PREVIEW, json_schema_extra={"deprecated": True}
disable_web_page_preview: Optional[Union[bool, Default]] = Field(
Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True}
)
"""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,
message_id: Optional[int] = 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,
link_preview_options: Optional[LinkPreviewOptions] = 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,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -2,6 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..client.default import Default
from ..types import Message
from ..types.base import UNSET_PROTECT_CONTENT
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"""
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."""
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"""
if TYPE_CHECKING:
@ -42,7 +43,7 @@ class ForwardMessage(TelegramMethod[Message]):
message_id: int,
message_thread_id: Optional[int] = 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,
) -> None:
# DO NOT EDIT MANUALLY!!!

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
@ -15,7 +16,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
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>`"""
caption: Optional[str] = None
"""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."""
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*"""
@ -53,7 +53,7 @@ class SendAnimation(TelegramMethod[Message]):
"""Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -89,11 +89,11 @@ class SendAnimation(TelegramMethod[Message]):
height: Optional[int] = None,
thumbnail: Optional[InputFile] = 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,
has_spoiler: 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
InlineKeyboardMarkup,
InputFile,
@ -15,7 +15,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
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"""
caption: Optional[str] = None
"""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."""
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*"""
@ -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>`"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -84,14 +83,14 @@ class SendAudio(TelegramMethod[Message]):
audio: Union[InputFile, str],
message_thread_id: Optional[int] = 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,
duration: Optional[int] = None,
performer: Optional[str] = None,
title: Optional[str] = None,
thumbnail: Optional[InputFile] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
@ -12,7 +13,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
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"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -75,7 +75,7 @@ class SendContact(TelegramMethod[Message]):
last_name: Optional[str] = None,
vcard: Optional[str] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
@ -12,7 +13,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
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 '🎲'"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -66,7 +66,7 @@ class SendDice(TelegramMethod[Message]):
message_thread_id: Optional[int] = None,
emoji: Optional[str] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
@ -15,7 +16,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
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>`"""
caption: Optional[str] = None
"""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."""
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*"""
@ -47,7 +47,7 @@ class SendDocument(TelegramMethod[Message]):
"""Disables automatic server-side content type detection for files uploaded using multipart/form-data"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -80,11 +80,11 @@ class SendDocument(TelegramMethod[Message]):
message_thread_id: Optional[int] = None,
thumbnail: Optional[InputFile] = 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,
disable_content_type_detection: 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -1,11 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import InlineKeyboardMarkup, Message, ReplyParameters
from ..types.base import UNSET_PROTECT_CONTENT
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"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -57,7 +57,7 @@ class SendGame(TelegramMethod[Message]):
game_short_name: str,
message_thread_id: Optional[int] = 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_markup: Optional[InlineKeyboardMarkup] = None,
allow_sending_without_reply: Optional[bool] = None,

View file

@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import InlineKeyboardMarkup, LabeledPrice, Message, ReplyParameters
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -67,7 +67,7 @@ class SendInvoice(TelegramMethod[Message]):
"""Pass :code:`True` if the final price depends on the shipping method"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -117,7 +117,7 @@ class SendInvoice(TelegramMethod[Message]):
send_email_to_provider: Optional[bool] = None,
is_flexible: 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_markup: Optional[InlineKeyboardMarkup] = None,
allow_sending_without_reply: Optional[bool] = None,

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
@ -12,7 +13,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -44,7 +44,7 @@ class SendLocation(TelegramMethod[Message]):
"""For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -81,7 +81,7 @@ class SendLocation(TelegramMethod[Message]):
heading: Optional[int] = None,
proximity_alert_radius: Optional[int] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
InputMediaAudio,
InputMediaDocument,
@ -12,7 +13,6 @@ from ..types import (
Message,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -34,7 +34,7 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None
"""Sends messages `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 messages from forwarding and saving"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -64,7 +64,7 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
],
message_thread_id: Optional[int] = 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,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,

View file

@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
InlineKeyboardMarkup,
LinkPreviewOptions,
@ -15,7 +15,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW, UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -35,15 +34,15 @@ class SendMessage(TelegramMethod[Message]):
"""Text of the message to be sent, 1-4096 characters after entities parsing"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
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."""
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*"""
link_preview_options: Optional[LinkPreviewOptions] = None
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default("link_preview")
"""Link preview generation options for the message"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -58,8 +57,8 @@ class SendMessage(TelegramMethod[Message]):
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
disable_web_page_preview: Optional[bool] = Field(
UNSET_DISABLE_WEB_PAGE_PREVIEW, json_schema_extra={"deprecated": True}
disable_web_page_preview: Optional[Union[bool, Default]] = Field(
Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True}
)
"""Disables link previews for links in this message
@ -81,17 +80,21 @@ class SendMessage(TelegramMethod[Message]):
chat_id: Union[int, str],
text: str,
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,
link_preview_options: Optional[LinkPreviewOptions] = None,
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default(
"link_preview"
),
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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = 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,
**__pydantic_kwargs: Any,
) -> None:

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
@ -15,7 +16,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -37,7 +37,7 @@ class SendPhoto(TelegramMethod[Message]):
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
caption: Optional[str] = None
"""Photo caption (may also be used when resending photos 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 photo caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
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*"""
@ -45,7 +45,7 @@ class SendPhoto(TelegramMethod[Message]):
"""Pass :code:`True` if the photo needs to be covered with a spoiler animation"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -77,11 +77,11 @@ class SendPhoto(TelegramMethod[Message]):
photo: Union[InputFile, str],
message_thread_id: Optional[int] = 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,
has_spoiler: 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
@ -15,7 +16,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -47,7 +47,7 @@ class SendPoll(TelegramMethod[Message]):
"""0-based identifier of the correct answer option, required for polls in quiz mode"""
explanation: Optional[str] = None
"""Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing"""
explanation_parse_mode: Optional[str] = UNSET_PARSE_MODE
explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the explanation. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
explanation_entities: Optional[List[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead of *parse_mode*"""
@ -59,7 +59,7 @@ class SendPoll(TelegramMethod[Message]):
"""Pass :code:`True` if the poll needs to be immediately closed. This can be useful for poll preview."""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -96,13 +96,13 @@ class SendPoll(TelegramMethod[Message]):
allows_multiple_answers: Optional[bool] = None,
correct_option_id: Optional[int] = 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,
open_period: Optional[int] = None,
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
is_closed: 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
@ -13,7 +14,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -37,7 +37,7 @@ class SendSticker(TelegramMethod[Message]):
"""Emoji associated with the sticker; only for just uploaded stickers"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -70,7 +70,7 @@ class SendSticker(TelegramMethod[Message]):
message_thread_id: Optional[int] = None,
emoji: Optional[str] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
@ -12,7 +13,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -48,7 +48,7 @@ class SendVenue(TelegramMethod[Message]):
"""Google Places type of the venue. (See `supported types <https://developers.google.com/places/web-service/supported_types>`_.)"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -87,7 +87,7 @@ class SendVenue(TelegramMethod[Message]):
google_place_id: Optional[str] = None,
google_place_type: Optional[str] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
@ -15,7 +16,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -45,7 +45,7 @@ class SendVideo(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>`"""
caption: Optional[str] = None
"""Video caption (may also be used when resending videos 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 video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
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*"""
@ -55,7 +55,7 @@ class SendVideo(TelegramMethod[Message]):
"""Pass :code:`True` if the uploaded video is suitable for streaming"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -91,12 +91,12 @@ class SendVideo(TelegramMethod[Message]):
height: Optional[int] = None,
thumbnail: Optional[InputFile] = 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,
has_spoiler: Optional[bool] = None,
supports_streaming: 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ForceReply,
InlineKeyboardMarkup,
@ -13,7 +14,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -41,7 +41,7 @@ class SendVideoNote(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>`"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -76,7 +76,7 @@ class SendVideoNote(TelegramMethod[Message]):
length: Optional[int] = None,
thumbnail: Optional[InputFile] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]

View file

@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
UNSET_PARSE_MODE,
ForceReply,
@ -15,7 +16,6 @@ from ..types import (
ReplyKeyboardRemove,
ReplyParameters,
)
from ..types.base import UNSET_PROTECT_CONTENT
from .base import TelegramMethod
@ -37,7 +37,7 @@ class SendVoice(TelegramMethod[Message]):
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
caption: Optional[str] = None
"""Voice message 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 voice message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
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*"""
@ -45,7 +45,7 @@ class SendVoice(TelegramMethod[Message]):
"""Duration of the voice message in seconds"""
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."""
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"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
@ -77,11 +77,11 @@ class SendVoice(TelegramMethod[Message]):
voice: Union[InputFile, str],
message_thread_id: Optional[int] = 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,
duration: Optional[int] = 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_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]