mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 14:46:29 +01:00
Improve Type Hinting for Arguments with Default Values in Bot
(#3942)
This commit is contained in:
parent
300ec920a1
commit
cbe808e471
7 changed files with 106 additions and 136 deletions
|
@ -93,14 +93,7 @@ from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue
|
|||
from telegram._utils.files import is_local_file, parse_file_input
|
||||
from telegram._utils.logging import get_logger
|
||||
from telegram._utils.repr import build_repr_with_selected_attrs
|
||||
from telegram._utils.types import (
|
||||
CorrectOptionID,
|
||||
DVInput,
|
||||
FileInput,
|
||||
JSONDict,
|
||||
ODVInput,
|
||||
ReplyMarkup,
|
||||
)
|
||||
from telegram._utils.types import CorrectOptionID, FileInput, JSONDict, ODVInput, ReplyMarkup
|
||||
from telegram._utils.warnings import warn
|
||||
from telegram._webhookinfo import WebhookInfo
|
||||
from telegram.constants import InlineQueryLimit
|
||||
|
@ -798,7 +791,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -933,7 +926,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
chat_id: Union[int, str],
|
||||
from_chat_id: Union[str, int],
|
||||
message_id: int,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
*,
|
||||
|
@ -999,7 +992,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
chat_id: Union[int, str],
|
||||
photo: Union[FileInput, "PhotoSize"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1113,7 +1106,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
performer: Optional[str] = None,
|
||||
title: Optional[str] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1237,7 +1230,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
chat_id: Union[int, str],
|
||||
document: Union[FileInput, "Document"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1356,7 +1349,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
self,
|
||||
chat_id: Union[int, str],
|
||||
sticker: Union[FileInput, "Sticker"],
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1444,7 +1437,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
video: Union[FileInput, "Video"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
width: Optional[int] = None,
|
||||
|
@ -1583,7 +1576,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
video_note: Union[FileInput, "VideoNote"],
|
||||
duration: Optional[int] = None,
|
||||
length: Optional[int] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1698,7 +1691,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
height: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1826,7 +1819,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
voice: Union[FileInput, "Voice"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -2070,7 +2063,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
chat_id: Union[int, str],
|
||||
latitude: Optional[float] = None,
|
||||
longitude: Optional[float] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
live_period: Optional[int] = None,
|
||||
|
@ -2331,7 +2324,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
title: Optional[str] = None,
|
||||
address: Optional[str] = None,
|
||||
foursquare_id: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
foursquare_type: Optional[str] = None,
|
||||
|
@ -2455,7 +2448,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
phone_number: Optional[str] = None,
|
||||
first_name: Optional[str] = None,
|
||||
last_name: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
vcard: Optional[str] = None,
|
||||
|
@ -2556,7 +2549,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
self,
|
||||
chat_id: int,
|
||||
game_short_name: str,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -4187,7 +4180,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
need_email: Optional[bool] = None,
|
||||
need_shipping_address: Optional[bool] = None,
|
||||
is_flexible: Optional[bool] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
provider_data: Optional[Union[str, object]] = None,
|
||||
|
@ -6760,9 +6753,9 @@ CUSTOM_EMOJI_IDENTIFIER_LIMIT` custom emoji identifiers can be specified.
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
|
|
@ -26,7 +26,7 @@ from telegram._message import Message
|
|||
from telegram._telegramobject import TelegramObject
|
||||
from telegram._user import User
|
||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||
from telegram._utils.types import DVInput, JSONDict, ODVInput, ReplyMarkup
|
||||
from telegram._utils.types import JSONDict, ODVInput, ReplyMarkup
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from telegram import (
|
||||
|
@ -725,9 +725,9 @@ class CallbackQuery(TelegramObject):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
|
|
@ -33,14 +33,7 @@ from telegram._utils import enum
|
|||
from telegram._utils.argumentparsing import parse_sequence_arg
|
||||
from telegram._utils.datetime import extract_tzinfo_from_defaults, from_timestamp
|
||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||
from telegram._utils.types import (
|
||||
CorrectOptionID,
|
||||
DVInput,
|
||||
FileInput,
|
||||
JSONDict,
|
||||
ODVInput,
|
||||
ReplyMarkup,
|
||||
)
|
||||
from telegram._utils.types import CorrectOptionID, FileInput, JSONDict, ODVInput, ReplyMarkup
|
||||
from telegram.helpers import escape_markdown
|
||||
from telegram.helpers import mention_html as helpers_mention_html
|
||||
from telegram.helpers import mention_markdown as helpers_mention_markdown
|
||||
|
@ -1326,7 +1319,7 @@ class Chat(TelegramObject):
|
|||
text: str,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1457,7 +1450,7 @@ class Chat(TelegramObject):
|
|||
self,
|
||||
photo: Union[FileInput, "PhotoSize"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1510,7 +1503,7 @@ class Chat(TelegramObject):
|
|||
phone_number: Optional[str] = None,
|
||||
first_name: Optional[str] = None,
|
||||
last_name: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
vcard: Optional[str] = None,
|
||||
|
@ -1562,7 +1555,7 @@ class Chat(TelegramObject):
|
|||
performer: Optional[str] = None,
|
||||
title: Optional[str] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1617,7 +1610,7 @@ class Chat(TelegramObject):
|
|||
self,
|
||||
document: Union[FileInput, "Document"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1712,7 +1705,7 @@ class Chat(TelegramObject):
|
|||
async def send_game(
|
||||
self,
|
||||
game_short_name: str,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1769,7 +1762,7 @@ class Chat(TelegramObject):
|
|||
need_email: Optional[bool] = None,
|
||||
need_shipping_address: Optional[bool] = None,
|
||||
is_flexible: Optional[bool] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
provider_data: Optional[Union[str, object]] = None,
|
||||
|
@ -1847,7 +1840,7 @@ class Chat(TelegramObject):
|
|||
self,
|
||||
latitude: Optional[float] = None,
|
||||
longitude: Optional[float] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
live_period: Optional[int] = None,
|
||||
|
@ -1905,7 +1898,7 @@ class Chat(TelegramObject):
|
|||
height: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1960,7 +1953,7 @@ class Chat(TelegramObject):
|
|||
async def send_sticker(
|
||||
self,
|
||||
sticker: Union[FileInput, "Sticker"],
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2008,7 +2001,7 @@ class Chat(TelegramObject):
|
|||
title: Optional[str] = None,
|
||||
address: Optional[str] = None,
|
||||
foursquare_id: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
foursquare_type: Optional[str] = None,
|
||||
|
@ -2064,7 +2057,7 @@ class Chat(TelegramObject):
|
|||
video: Union[FileInput, "Video"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
width: Optional[int] = None,
|
||||
|
@ -2126,7 +2119,7 @@ class Chat(TelegramObject):
|
|||
video_note: Union[FileInput, "VideoNote"],
|
||||
duration: Optional[int] = None,
|
||||
length: Optional[int] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2176,7 +2169,7 @@ class Chat(TelegramObject):
|
|||
voice: Union[FileInput, "Voice"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -2294,9 +2287,9 @@ class Chat(TelegramObject):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
@ -2344,9 +2337,9 @@ class Chat(TelegramObject):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
@ -2391,7 +2384,7 @@ class Chat(TelegramObject):
|
|||
self,
|
||||
from_chat_id: Union[str, int],
|
||||
message_id: int,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
*,
|
||||
|
@ -2433,7 +2426,7 @@ class Chat(TelegramObject):
|
|||
self,
|
||||
chat_id: Union[int, str],
|
||||
message_id: int,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
*,
|
||||
|
|
|
@ -61,7 +61,6 @@ from telegram._utils.datetime import extract_tzinfo_from_defaults, from_timestam
|
|||
from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue
|
||||
from telegram._utils.types import (
|
||||
CorrectOptionID,
|
||||
DVInput,
|
||||
FileInput,
|
||||
JSONDict,
|
||||
MarkdownVersion,
|
||||
|
@ -1061,7 +1060,7 @@ class Message(TelegramObject):
|
|||
text: str,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1115,7 +1114,7 @@ class Message(TelegramObject):
|
|||
self,
|
||||
text: str,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1179,7 +1178,7 @@ class Message(TelegramObject):
|
|||
self,
|
||||
text: str,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1239,7 +1238,7 @@ class Message(TelegramObject):
|
|||
self,
|
||||
text: str,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1357,7 +1356,7 @@ class Message(TelegramObject):
|
|||
self,
|
||||
photo: Union[FileInput, "PhotoSize"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1419,7 +1418,7 @@ class Message(TelegramObject):
|
|||
performer: Optional[str] = None,
|
||||
title: Optional[str] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1481,7 +1480,7 @@ class Message(TelegramObject):
|
|||
self,
|
||||
document: Union[FileInput, "Document"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1546,7 +1545,7 @@ class Message(TelegramObject):
|
|||
height: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1609,7 +1608,7 @@ class Message(TelegramObject):
|
|||
async def reply_sticker(
|
||||
self,
|
||||
sticker: Union[FileInput, "Sticker"],
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1662,7 +1661,7 @@ class Message(TelegramObject):
|
|||
video: Union[FileInput, "Video"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
width: Optional[int] = None,
|
||||
|
@ -1731,7 +1730,7 @@ class Message(TelegramObject):
|
|||
video_note: Union[FileInput, "VideoNote"],
|
||||
duration: Optional[int] = None,
|
||||
length: Optional[int] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1789,7 +1788,7 @@ class Message(TelegramObject):
|
|||
voice: Union[FileInput, "Voice"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1848,7 +1847,7 @@ class Message(TelegramObject):
|
|||
self,
|
||||
latitude: Optional[float] = None,
|
||||
longitude: Optional[float] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
live_period: Optional[int] = None,
|
||||
|
@ -1912,7 +1911,7 @@ class Message(TelegramObject):
|
|||
title: Optional[str] = None,
|
||||
address: Optional[str] = None,
|
||||
foursquare_id: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
foursquare_type: Optional[str] = None,
|
||||
|
@ -1975,7 +1974,7 @@ class Message(TelegramObject):
|
|||
phone_number: Optional[str] = None,
|
||||
first_name: Optional[str] = None,
|
||||
last_name: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
vcard: Optional[str] = None,
|
||||
|
@ -2184,7 +2183,7 @@ class Message(TelegramObject):
|
|||
async def reply_game(
|
||||
self,
|
||||
game_short_name: str,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2250,7 +2249,7 @@ class Message(TelegramObject):
|
|||
need_email: Optional[bool] = None,
|
||||
need_shipping_address: Optional[bool] = None,
|
||||
is_flexible: Optional[bool] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
provider_data: Optional[Union[str, object]] = None,
|
||||
|
@ -2336,7 +2335,7 @@ class Message(TelegramObject):
|
|||
async def forward(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
*,
|
||||
|
@ -2389,9 +2388,9 @@ class Message(TelegramObject):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
@ -2445,9 +2444,9 @@ class Message(TelegramObject):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
|
|
@ -25,14 +25,7 @@ from telegram._inline.inlinekeyboardbutton import InlineKeyboardButton
|
|||
from telegram._menubutton import MenuButton
|
||||
from telegram._telegramobject import TelegramObject
|
||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||
from telegram._utils.types import (
|
||||
CorrectOptionID,
|
||||
DVInput,
|
||||
FileInput,
|
||||
JSONDict,
|
||||
ODVInput,
|
||||
ReplyMarkup,
|
||||
)
|
||||
from telegram._utils.types import CorrectOptionID, FileInput, JSONDict, ODVInput, ReplyMarkup
|
||||
from telegram.helpers import mention_html as helpers_mention_html
|
||||
from telegram.helpers import mention_markdown as helpers_mention_markdown
|
||||
|
||||
|
@ -391,7 +384,7 @@ class User(TelegramObject):
|
|||
text: str,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -441,7 +434,7 @@ class User(TelegramObject):
|
|||
self,
|
||||
photo: Union[FileInput, "PhotoSize"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -551,7 +544,7 @@ class User(TelegramObject):
|
|||
performer: Optional[str] = None,
|
||||
title: Optional[str] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -648,7 +641,7 @@ class User(TelegramObject):
|
|||
phone_number: Optional[str] = None,
|
||||
first_name: Optional[str] = None,
|
||||
last_name: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
vcard: Optional[str] = None,
|
||||
|
@ -745,7 +738,7 @@ class User(TelegramObject):
|
|||
self,
|
||||
document: Union[FileInput, "Document"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -801,7 +794,7 @@ class User(TelegramObject):
|
|||
async def send_game(
|
||||
self,
|
||||
game_short_name: str,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -861,7 +854,7 @@ class User(TelegramObject):
|
|||
need_email: Optional[bool] = None,
|
||||
need_shipping_address: Optional[bool] = None,
|
||||
is_flexible: Optional[bool] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
provider_data: Optional[Union[str, object]] = None,
|
||||
|
@ -942,7 +935,7 @@ class User(TelegramObject):
|
|||
self,
|
||||
latitude: Optional[float] = None,
|
||||
longitude: Optional[float] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
live_period: Optional[int] = None,
|
||||
|
@ -1003,7 +996,7 @@ class User(TelegramObject):
|
|||
height: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1061,7 +1054,7 @@ class User(TelegramObject):
|
|||
async def send_sticker(
|
||||
self,
|
||||
sticker: Union[FileInput, "Sticker"],
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1110,7 +1103,7 @@ class User(TelegramObject):
|
|||
video: Union[FileInput, "Video"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
width: Optional[int] = None,
|
||||
|
@ -1177,7 +1170,7 @@ class User(TelegramObject):
|
|||
title: Optional[str] = None,
|
||||
address: Optional[str] = None,
|
||||
foursquare_id: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
foursquare_type: Optional[str] = None,
|
||||
|
@ -1236,7 +1229,7 @@ class User(TelegramObject):
|
|||
video_note: Union[FileInput, "VideoNote"],
|
||||
duration: Optional[int] = None,
|
||||
length: Optional[int] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -1289,7 +1282,7 @@ class User(TelegramObject):
|
|||
voice: Union[FileInput, "Voice"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -1413,9 +1406,9 @@ class User(TelegramObject):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
@ -1466,9 +1459,9 @@ class User(TelegramObject):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
|
|
@ -86,14 +86,7 @@ from telegram._utils.datetime import to_timestamp
|
|||
from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue
|
||||
from telegram._utils.logging import get_logger
|
||||
from telegram._utils.repr import build_repr_with_selected_attrs
|
||||
from telegram._utils.types import (
|
||||
CorrectOptionID,
|
||||
DVInput,
|
||||
FileInput,
|
||||
JSONDict,
|
||||
ODVInput,
|
||||
ReplyMarkup,
|
||||
)
|
||||
from telegram._utils.types import CorrectOptionID, FileInput, JSONDict, ODVInput, ReplyMarkup
|
||||
from telegram.ext._callbackdatacache import CallbackDataCache
|
||||
from telegram.ext._utils.types import RLARGS
|
||||
from telegram.request import BaseRequest
|
||||
|
@ -686,9 +679,9 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
|
@ -1518,7 +1511,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
chat_id: Union[int, str],
|
||||
from_chat_id: Union[str, int],
|
||||
message_id: int,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
message_thread_id: Optional[int] = None,
|
||||
*,
|
||||
|
@ -2174,7 +2167,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
height: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2225,7 +2218,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
performer: Optional[str] = None,
|
||||
title: Optional[str] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -2297,7 +2290,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
phone_number: Optional[str] = None,
|
||||
first_name: Optional[str] = None,
|
||||
last_name: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
vcard: Optional[str] = None,
|
||||
|
@ -2372,7 +2365,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
chat_id: Union[int, str],
|
||||
document: Union[FileInput, "Document"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -2417,7 +2410,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
self,
|
||||
chat_id: int,
|
||||
game_short_name: str,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2466,7 +2459,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
need_email: Optional[bool] = None,
|
||||
need_shipping_address: Optional[bool] = None,
|
||||
is_flexible: Optional[bool] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional["InlineKeyboardMarkup"] = None,
|
||||
provider_data: Optional[Union[str, object]] = None,
|
||||
|
@ -2526,7 +2519,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
chat_id: Union[int, str],
|
||||
latitude: Optional[float] = None,
|
||||
longitude: Optional[float] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
live_period: Optional[int] = None,
|
||||
|
@ -2614,7 +2607,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
entities: Optional[Sequence["MessageEntity"]] = None,
|
||||
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2652,7 +2645,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
chat_id: Union[int, str],
|
||||
photo: Union[FileInput, "PhotoSize"],
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
@ -2751,7 +2744,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
self,
|
||||
chat_id: Union[int, str],
|
||||
sticker: Union[FileInput, "Sticker"],
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2791,7 +2784,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
title: Optional[str] = None,
|
||||
address: Optional[str] = None,
|
||||
foursquare_id: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
foursquare_type: Optional[str] = None,
|
||||
|
@ -2839,7 +2832,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
video: Union[FileInput, "Video"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
width: Optional[int] = None,
|
||||
|
@ -2893,7 +2886,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
video_note: Union[FileInput, "VideoNote"],
|
||||
duration: Optional[int] = None,
|
||||
length: Optional[int] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
|
@ -2935,7 +2928,7 @@ class ExtBot(Bot, Generic[RLARGS]):
|
|||
voice: Union[FileInput, "Voice"],
|
||||
duration: Optional[int] = None,
|
||||
caption: Optional[str] = None,
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[ReplyMarkup] = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
|
|
|
@ -28,7 +28,7 @@ from bs4 import BeautifulSoup, PageElement, Tag
|
|||
|
||||
import telegram
|
||||
from telegram._utils.defaultvalue import DefaultValue
|
||||
from telegram._utils.types import DVInput, FileInput, ODVInput
|
||||
from telegram._utils.types import FileInput, ODVInput
|
||||
from telegram.ext import Defaults
|
||||
from tests.auxil.envvars import RUN_TEST_OFFICIAL
|
||||
|
||||
|
@ -433,11 +433,10 @@ def check_param_type(
|
|||
# Special case for when the parameter is a default value parameter
|
||||
for name, _ in inspect.getmembers(Defaults, lambda x: isinstance(x, property)):
|
||||
if name in ptb_param.name: # no strict == since we have a param: `explanation_parse_mode`
|
||||
# Check if it's DVInput or ODVInput
|
||||
for param_type in [DVInput, ODVInput]:
|
||||
parsed = param_type[mapped_type]
|
||||
if ptb_annotation == parsed:
|
||||
return True
|
||||
# Check if it's ODVInput
|
||||
parsed = ODVInput[mapped_type]
|
||||
if (ptb_annotation | None) == parsed: # We have to add back None in our annotation
|
||||
return True
|
||||
return False
|
||||
|
||||
# Special case for send_* methods where we accept more types than the official API:
|
||||
|
|
Loading…
Reference in a new issue