diff --git a/.github/workflows/docs-admonitions.yml b/.github/workflows/doc-tests.yml similarity index 79% rename from .github/workflows/docs-admonitions.yml rename to .github/workflows/doc-tests.yml index 845b526a1e2..38fd0dfd9c3 100644 --- a/.github/workflows/docs-admonitions.yml +++ b/.github/workflows/doc-tests.yml @@ -1,11 +1,11 @@ -name: Test Admonitions Generation +name: Test Admonitions & Attributes Generation on: pull_request: types: [synchronize, reopened, ready_for_review] paths: - src/telegram/** - docs/** - - .github/workflows/docs-admonitions.yml + - .github/workflows/doc-tests.yml push: branches: - master @@ -13,8 +13,8 @@ on: permissions: {} jobs: - test-admonitions: - name: Test Admonitions Generation + test-admonitions-attributes: + name: Test Admonitions & Attributes Generation runs-on: ${{matrix.os}} permissions: # for uploading artifacts @@ -38,5 +38,5 @@ jobs: run: | python -W ignore -m pip install --upgrade pip python -W ignore -m pip install .[all] --group all - - name: Test autogeneration of admonitions - run: pytest -v --tb=short tests/docs/admonition_inserter.py \ No newline at end of file + - name: Test autogeneration of admonitions and attributes + run: pytest -v --tb=short tests/docs/admonition_inserter.py tests/docs/attribute_inserter.py \ No newline at end of file diff --git a/changes/unreleased/5240.iJXyH8RNWNNQpC47SfNHzw.toml b/changes/unreleased/5240.iJXyH8RNWNNQpC47SfNHzw.toml index 24424c4695a..ee33f17335e 100644 --- a/changes/unreleased/5240.iJXyH8RNWNNQpC47SfNHzw.toml +++ b/changes/unreleased/5240.iJXyH8RNWNNQpC47SfNHzw.toml @@ -1,6 +1,10 @@ -documentation = "Documentation Improvements" +documentation = """Documentation Improvements + +* Autogenerate "Attributes" section for easier maintainence and reliability. +""" pull_requests = [ { uid = "5240", author_uids = ["harshil21", "Poolitzer"] }, { uid = "5241", author_uids = ["harshil21"] }, + { uid = "5245", author_uids = ["harshil21"] }, ] \ No newline at end of file diff --git a/docs/auxil/attribute_inserter.py b/docs/auxil/attribute_inserter.py new file mode 100644 index 00000000000..6be052df046 --- /dev/null +++ b/docs/auxil/attribute_inserter.py @@ -0,0 +1,258 @@ +# A library that provides a Python interface to the Telegram Bot API +# Copyright (C) 2015-2026 +# Leandro Toledo de Souza +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser Public License for more details. +# +# You should have received a copy of the GNU Lesser Public License +# along with this program. If not, see [http://www.gnu.org/licenses/]. +"""Automatic generation of ``Attributes:`` section entries from ``Args:`` in class docstrings.""" + +import inspect +import re +import warnings +from dataclasses import dataclass + +from telegram import TelegramObject + +ENTRY_PATTERN: re.Pattern[str] = re.compile(r"^ (\w+) \((.+)\):\s*(.*)") + +KNOWN_SECTION_TITLES: frozenset[str] = frozenset( + { + "Args", + "Attributes", + "Returns", + "Raises", + "Note", + "Notes", + "Example", + "Examples", + "Keyword Args", + "Keyword Arguments", + } +) + + +def _is_section_header(line: str) -> bool: + return line.endswith(":") and line[:-1] in KNOWN_SECTION_TITLES + + +def _is_col0_noncontent(line: str) -> bool: + """Non-blank col-0 line that is not a section header (e.g. RST substitution definitions).""" + return bool(line) and not line[0].isspace() and not _is_section_header(line) + + +def _save_entry( + entries: dict[str, "DocstringEntry"], + name: str, + raw_type: str, + raw_lines: list[str], +) -> None: + lines = list(raw_lines) + while lines and lines[-1] == "": + lines.pop() + + is_optional = raw_type.endswith(", optional") + type_str = raw_type.removesuffix(", optional") if is_optional else raw_type + + entries[name] = DocstringEntry( + name=name, + type_str=type_str, + is_optional=is_optional, + all_lines=tuple(lines), + ) + + +@dataclass(frozen=True, slots=True) +class DocstringEntry: + name: str + type_str: str + is_optional: bool + all_lines: tuple[str, ...] + + def to_attribute_lines(self) -> list[str]: + if not self.all_lines: + warnings.warn( + f"DocstringEntry {self.name!r} has no lines; skipping attribute generation.", + stacklevel=2, + ) + return [] + + m = ENTRY_PATTERN.match(self.all_lines[0]) + if m is None: + warnings.warn( + f"DocstringEntry {self.name!r}: first line does not match the entry pattern " + f"({self.all_lines[0]!r}); returning raw lines unchanged.", + stacklevel=2, + ) + return list(self.all_lines) + + desc: str = m.group(3) + new_type = self.type_str.replace("Sequence[", "tuple[") + new_desc = f"Optional. {desc}" if self.is_optional else desc + return [f" {self.name} ({new_type}): {new_desc}", *self.all_lines[1:]] + + +@dataclass(slots=True) +class DocstringSection: + title: str + entries: dict[str, DocstringEntry] + start_idx: int + end_idx: int + + +class DocstringParser: + """Parse a Google-style docstring (list of lines) into sections and entries.""" + + __slots__ = ("_lines", "_sections") + + def __init__(self, lines: list[str]) -> None: + self._lines = lines + self._sections: dict[str, DocstringSection] | None = None + + @property + def sections(self) -> dict[str, DocstringSection]: + if self._sections is None: + self._sections = self._parse() + return self._sections + + def get_section(self, title: str) -> DocstringSection | None: + return self.sections.get(title) + + def _parse(self) -> dict[str, DocstringSection]: + sections: dict[str, DocstringSection] = {} + lines = self._lines + n = len(lines) + i = 0 + + while i < n: + line = lines[i] + if _is_section_header(line): + title = line[:-1] + start_idx = i + i += 1 + entries, end_idx = self._parse_section_entries(i, n) + i = end_idx + sections[title] = DocstringSection( + title=title, + entries=entries, + start_idx=start_idx, + end_idx=end_idx, + ) + else: + i += 1 + + return sections + + def _parse_section_entries( + self, + start: int, + end: int, + ) -> tuple[dict[str, DocstringEntry], int]: + entries: dict[str, DocstringEntry] = {} + current_name: str | None = None + current_raw_type: str = "" + current_lines: list[str] = [] + + lines = self._lines + i = start + + while i < end: + line = lines[i] + + # RST substitution definitions and other on-section content end the section. + if _is_section_header(line) or _is_col0_noncontent(line): + break + + m = ENTRY_PATTERN.match(line) + if m: + if current_name is not None: + _save_entry(entries, current_name, current_raw_type, current_lines) + current_name = m.group(1) + current_raw_type = m.group(2) + current_lines = [line] + elif current_name is not None: + current_lines.append(line) + + i += 1 + + if current_name is not None: + _save_entry(entries, current_name, current_raw_type, current_lines) + + return entries, i + + +class AttributeInserter: + """Inserts auto-generated ``Attributes:`` entries into class docstrings.""" + + def insert_attributes(self, obj: type, lines: list[str]) -> None: + """Insert missing attribute entries derived from the ``Args:`` section in-place.""" + parser = DocstringParser(lines) + + args_section = parser.get_section("Args") + attrs_section = parser.get_section("Attributes") + + already_documented: set[str] = ( + set(attrs_section.entries.keys()) if attrs_section is not None else set() + ) + args_entries: dict[str, DocstringEntry] = ( + args_section.entries if args_section is not None else {} + ) + args_names: set[str] = set(args_entries.keys()) + + properties_on_class: set[str] = { + name for name, _ in inspect.getmembers(obj, lambda o: isinstance(o, property)) + } + + # Warn about own public slots that have no documentation source. + # Get slots from TGObject if it's a TGObj subclass: + if issubclass(obj, TelegramObject): + all_slots = { + s + for c in obj.__mro__[:-1] + if issubclass(c, TelegramObject) + for s in c.__slots__ + if not s.startswith("_") + } + all_slots.remove("api_kwargs") + else: + all_slots = (s for s in getattr(obj, "__slots__", ()) if not s.startswith("_")) + for slot in all_slots: + if ( + slot not in already_documented + and slot not in args_names + and slot not in properties_on_class + ): + raise RuntimeError( + f"Class {obj.__qualname__!r}: public slot {slot!r} has no documentation " + f"source. Please add it to the 'Attributes:' section manually.", + ) + + new_attr_lines: list[str] = [] + for name, entry in args_entries.items(): + if name in already_documented or name in properties_on_class: + continue + new_attr_lines.extend(entry.to_attribute_lines()) + new_attr_lines.append("") + + if not new_attr_lines: + return + + if attrs_section is not None: + insert_idx = attrs_section.end_idx + while insert_idx > attrs_section.start_idx + 1 and lines[insert_idx - 1] == "": + insert_idx -= 1 + lines[insert_idx:insert_idx] = new_attr_lines + else: + if lines and lines[-1].strip(): + lines.append("") + lines.append("Attributes:") + lines.extend(new_attr_lines) diff --git a/docs/auxil/bot_insertion.py b/docs/auxil/bot_insertion.py index 008f5413856..b507a3c46cb 100644 --- a/docs/auxil/bot_insertion.py +++ b/docs/auxil/bot_insertion.py @@ -91,23 +91,7 @@ ] -def find_insert_pos_for_kwargs(lines: list[str]) -> int: - """Finds the correct position to insert the keyword arguments and returns the index.""" - for idx, value in reversed(list(enumerate(lines))): # reversed since :returns: is at the end - if value.startswith("Returns"): - return idx - return False - - -def find_insert_pos_for_raises(lines: list[str]) -> int: - """Finds the correct position to insert the Raises block and returns the index.""" - if "Raises:" in lines: - return -1 # Don't insert if there's already a Raises block - return len(lines) # Insert at the end if there's no Raises block - - def check_timeout_and_api_kwargs_presence(obj: object) -> int: - """Checks if the method has timeout and api_kwargs keyword only parameters.""" sig = inspect.signature(obj) params_to_check = ( "read_timeout", diff --git a/docs/auxil/sphinx_hooks.py b/docs/auxil/sphinx_hooks.py index 1f0082369ad..e4876b3a281 100644 --- a/docs/auxil/sphinx_hooks.py +++ b/docs/auxil/sphinx_hooks.py @@ -27,11 +27,10 @@ import telegram import telegram.ext from docs.auxil.admonition_inserter import AdmonitionInserter +from docs.auxil.attribute_inserter import AttributeInserter, DocstringParser from docs.auxil.bot_insertion import ( RAISES_BLOCK, check_timeout_and_api_kwargs_presence, - find_insert_pos_for_kwargs, - find_insert_pos_for_raises, get_updates_read_timeout_addition, keyword_args, media_write_timeout_change, @@ -44,6 +43,7 @@ ADMONITION_INSERTER = AdmonitionInserter() +ATTRIBUTE_INSERTER = AttributeInserter() # Some base classes are implementation detail # We want to instead show *their* base class @@ -112,11 +112,12 @@ def autodoc_process_docstring( ): # Logic for inserting keyword args into docstrings: # ------------------------------------------------- - insert_index = find_insert_pos_for_kwargs(lines) - if not insert_index: + returns_section = DocstringParser(lines).get_section("Returns") + if not returns_section: raise ValueError( f"Couldn't find the correct position to insert the keyword args for {obj}." ) + insert_index = returns_section.start_idx get_updates: bool = method_name == "get_updates" # The below can be done in 1 line with itertools.chain, but this must be modified in-place @@ -140,10 +141,8 @@ def autodoc_process_docstring( # Logic for inserting Raises: # ------------------------------------------------- # We will only insert the Raises block if there isn't already one. - - insert_index = find_insert_pos_for_raises(lines) - if insert_index != -1: - lines[insert_index:insert_index] = RAISES_BLOCK + if DocstringParser(lines).get_section("Raises") is None: + lines.extend(RAISES_BLOCK) # Logic for inserting "Shortcuts" admonition: # ------------------------------------------- @@ -154,7 +153,12 @@ def autodoc_process_docstring( # 2-4) Insert "Returned in", "Available in", "Use in" admonitions into classes # (where applicable) - if what == "class": + if what in ("class", "exception"): + # Auto-generate Attributes section entries from Args before admonitions are inserted + ATTRIBUTE_INSERTER.insert_attributes( + obj=typing.cast("type", obj), + lines=lines, + ) ADMONITION_INSERTER.insert_admonitions( obj=typing.cast("type", obj), # since "what" == class, we know it's not just object docstring_lines=lines, diff --git a/src/telegram/_birthdate.py b/src/telegram/_birthdate.py index 73e6c3c2d32..6730ff463e5 100644 --- a/src/telegram/_birthdate.py +++ b/src/telegram/_birthdate.py @@ -37,12 +37,6 @@ class Birthdate(TelegramObject): day (:obj:`int`): Day of the user's birth; 1-31. month (:obj:`int`): Month of the user's birth; 1-12. year (:obj:`int`, optional): Year of the user's birth. - - Attributes: - day (:obj:`int`): Day of the user's birth; 1-31. - month (:obj:`int`): Month of the user's birth; 1-12. - year (:obj:`int`): Optional. Year of the user's birth. - """ __slots__ = ("day", "month", "year") diff --git a/src/telegram/_bot.py b/src/telegram/_bot.py index 571c7390041..1bce56fc00d 100644 --- a/src/telegram/_bot.py +++ b/src/telegram/_bot.py @@ -4681,6 +4681,7 @@ async def get_updates( """Use this method to receive incoming updates using long polling. Note: + 1. This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response. diff --git a/src/telegram/_botcommand.py b/src/telegram/_botcommand.py index 6b697128427..5c03b054c43 100644 --- a/src/telegram/_botcommand.py +++ b/src/telegram/_botcommand.py @@ -39,15 +39,6 @@ class BotCommand(TelegramObject): description (:obj:`str`): Description of the command; :tg-const:`telegram.BotCommand.MIN_DESCRIPTION`- :tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters. - - Attributes: - command (:obj:`str`): Text of the command; :tg-const:`telegram.BotCommand.MIN_COMMAND`- - :tg-const:`telegram.BotCommand.MAX_COMMAND` characters. Can contain only lowercase - English letters, digits and underscores. - description (:obj:`str`): Description of the command; - :tg-const:`telegram.BotCommand.MIN_DESCRIPTION`- - :tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters. - """ __slots__ = ("command", "description") diff --git a/src/telegram/_botcommandscope.py b/src/telegram/_botcommandscope.py index cde05a79ac6..809ddb088c6 100644 --- a/src/telegram/_botcommandscope.py +++ b/src/telegram/_botcommandscope.py @@ -55,9 +55,6 @@ class BotCommandScope(TelegramObject): Args: type (:obj:`str`): Scope type. - - Attributes: - type (:obj:`str`): Scope type. """ __slots__ = ("type",) @@ -195,7 +192,6 @@ class BotCommandScopeChat(BotCommandScope): Attributes: type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT`. - chat_id (:obj:`str` | :obj:`int`): |chat_id_group| """ __slots__ = ("chat_id",) @@ -222,7 +218,6 @@ class BotCommandScopeChatAdministrators(BotCommandScope): chat_id (:obj:`str` | :obj:`int`): |chat_id_group| Attributes: type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT_ADMINISTRATORS`. - chat_id (:obj:`str` | :obj:`int`): |chat_id_group| """ __slots__ = ("chat_id",) @@ -251,8 +246,6 @@ class BotCommandScopeChatMember(BotCommandScope): Attributes: type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT_MEMBER`. - chat_id (:obj:`str` | :obj:`int`): |chat_id_group| - user_id (:obj:`int`): Unique identifier of the target user. """ __slots__ = ("chat_id", "user_id") diff --git a/src/telegram/_botdescription.py b/src/telegram/_botdescription.py index e7fe7211cb3..f6f33d64d59 100644 --- a/src/telegram/_botdescription.py +++ b/src/telegram/_botdescription.py @@ -32,10 +32,6 @@ class BotDescription(TelegramObject): Args: description (:obj:`str`): The bot's description. - - Attributes: - description (:obj:`str`): The bot's description. - """ __slots__ = ("description",) @@ -59,10 +55,6 @@ class BotShortDescription(TelegramObject): Args: short_description (:obj:`str`): The bot's short description. - - Attributes: - short_description (:obj:`str`): The bot's short description. - """ __slots__ = ("short_description",) diff --git a/src/telegram/_botname.py b/src/telegram/_botname.py index 42021df472e..6631e92aae4 100644 --- a/src/telegram/_botname.py +++ b/src/telegram/_botname.py @@ -35,10 +35,6 @@ class BotName(TelegramObject): Args: name (:obj:`str`): The bot's name. - - Attributes: - name (:obj:`str`): The bot's name. - """ __slots__ = ("name",) diff --git a/src/telegram/_business.py b/src/telegram/_business.py index 5b2026c62d0..cd08fdf9899 100644 --- a/src/telegram/_business.py +++ b/src/telegram/_business.py @@ -84,37 +84,6 @@ class BusinessBotRights(TelegramObject): transfer gifts. can_manage_stories (:obj:`bool`, optional): True, if the bot can post, edit and delete stories on behalf of the business account. - - Attributes: - can_reply (:obj:`bool`): Optional. True, if the bot can send and edit messages in the - private chats that had incoming messages in the last 24 hours. - can_read_messages (:obj:`bool`): Optional. True, if the bot can mark incoming private - messages as read. - can_delete_sent_messages (:obj:`bool`): Optional. True, if the bot can delete messages - sent by the bot. - can_delete_all_messages (:obj:`bool`): Optional. True, if the bot can delete all private - messages in managed chats. - can_edit_name (:obj:`bool`): Optional. True, if the bot can edit the first and last name - of the business account. - can_edit_bio (:obj:`bool`): Optional. True, if the bot can edit the bio of the - business account. - can_edit_profile_photo (:obj:`bool`): Optional. True, if the bot can edit the profile - photo of the business account. - can_edit_username (:obj:`bool`): Optional. True, if the bot can edit the username of the - business account. - can_change_gift_settings (:obj:`bool`): Optional. True, if the bot can change the privacy - settings pertaining to gifts for the business account. - can_view_gifts_and_stars (:obj:`bool`): Optional. True, if the bot can view gifts and the - amount of Telegram Stars owned by the business account. - can_convert_gifts_to_stars (:obj:`bool`): Optional. True, if the bot can convert regular - gifts owned by the business account to Telegram Stars. - can_transfer_and_upgrade_gifts (:obj:`bool`): Optional. True, if the bot can transfer and - upgrade gifts owned by the business account. - can_transfer_stars (:obj:`bool`): Optional. True, if the bot can transfer Telegram Stars - received by the business account to its own account, or use them to upgrade and - transfer gifts. - can_manage_stories (:obj:`bool`): Optional. True, if the bot can post, edit and delete - stories on behalf of the business account. """ __slots__ = ( @@ -214,17 +183,6 @@ class BusinessConnection(TelegramObject): rights (:class:`BusinessBotRights`, optional): Rights of the business bot. .. versionadded:: 22.1 - - Attributes: - id (:obj:`str`): Unique identifier of the business connection. - user (:class:`telegram.User`): Business account user that created the business connection. - user_chat_id (:obj:`int`): Identifier of a private chat with the user who created the - business connection. - date (:obj:`datetime.datetime`): Date the connection was established in Unix time. - is_enabled (:obj:`bool`): True, if the connection is active. - rights (:class:`BusinessBotRights`): Optional. Rights of the business bot. - - .. versionadded:: 22.1 """ __slots__ = ( @@ -297,13 +255,6 @@ class BusinessMessagesDeleted(TelegramObject): may not have access to the chat or the corresponding user. message_ids (Sequence[:obj:`int`]): A list of identifiers of the deleted messages in the chat of the business account. - - Attributes: - business_connection_id (:obj:`str`): Unique identifier of the business connection. - chat (:class:`telegram.Chat`): Information about a chat in the business account. The bot - may not have access to the chat or the corresponding user. - message_ids (tuple[:obj:`int`]): A list of identifiers of the deleted messages in the - chat of the business account. """ __slots__ = ( @@ -357,11 +308,6 @@ class BusinessIntro(TelegramObject): title (:obj:`str`, optional): Title text of the business intro. message (:obj:`str`, optional): Message text of the business intro. sticker (:class:`telegram.Sticker`, optional): Sticker of the business intro. - - Attributes: - title (:obj:`str`): Optional. Title text of the business intro. - message (:obj:`str`): Optional. Message text of the business intro. - sticker (:class:`telegram.Sticker`): Optional. Sticker of the business intro. """ __slots__ = ( @@ -410,10 +356,6 @@ class BusinessLocation(TelegramObject): Args: address (:obj:`str`): Address of the business. location (:class:`telegram.Location`, optional): Location of the business. - - Attributes: - address (:obj:`str`): Address of the business. - location (:class:`telegram.Location`): Optional. Location of the business. """ __slots__ = ( @@ -478,14 +420,6 @@ class BusinessOpeningHoursInterval(TelegramObject): closing_minute (:obj:`int`): The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60 - - Attributes: - opening_minute (:obj:`int`): The minute's sequence number in a week, starting on Monday, - marking the start of the time interval during which the business is open; - 0 - 7 * 24 * 60. - closing_minute (:obj:`int`): The minute's - sequence number in a week, starting on Monday, marking the end of the time interval - during which the business is open; 0 - 8 * 24 * 60 """ __slots__ = ("_closing_time", "_opening_time", "closing_minute", "opening_minute") @@ -553,12 +487,6 @@ class BusinessOpeningHours(TelegramObject): hours are defined. opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of time intervals describing business opening hours. - - Attributes: - time_zone_name (:obj:`str`): Unique name of the time zone for which the opening - hours are defined. - opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of - time intervals describing business opening hours. """ __slots__ = ("_cached_zone_info", "opening_hours", "time_zone_name") @@ -572,7 +500,7 @@ def __init__( ): super().__init__(api_kwargs=api_kwargs) self.time_zone_name: str = time_zone_name - self.opening_hours: Sequence[BusinessOpeningHoursInterval] = parse_sequence_arg( + self.opening_hours: tuple[BusinessOpeningHoursInterval, ...] = parse_sequence_arg( opening_hours ) diff --git a/src/telegram/_callbackquery.py b/src/telegram/_callbackquery.py index 9004de89388..338f35b88f0 100644 --- a/src/telegram/_callbackquery.py +++ b/src/telegram/_callbackquery.py @@ -91,16 +91,6 @@ class CallbackQuery(TelegramObject): the unique identifier for the game. Attributes: - id (:obj:`str`): Unique identifier for this query. - from_user (:class:`telegram.User`): Sender. - chat_instance (:obj:`str`): Global identifier, uniquely corresponding to the chat to which - the message with the callback button was sent. Useful for high scores in games. - message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message sent by the bot - with the callback button that originated the query. - - .. versionchanged:: 20.8 - Objects may be of type :class:`telegram.MaybeInaccessibleMessage` since Bot API - 7.0. data (:obj:`str` | :obj:`object`): Optional. Data associated with the callback button. Be aware that the message, which originated the query, can contain no callback buttons with this data. @@ -108,12 +98,6 @@ class CallbackQuery(TelegramObject): Tip: The value here is the same as the value passed in :paramref:`telegram.InlineKeyboardButton.callback_data`. - inline_message_id (:obj:`str`): Optional. Identifier of the message sent via the bot in - inline mode, that originated the query. - game_short_name (:obj:`str`): Optional. Short name of a Game to be returned, serves as - the unique identifier for the game. - - """ __slots__ = ( diff --git a/src/telegram/_chat.py b/src/telegram/_chat.py index 764da868e7e..1d4f34ce53f 100644 --- a/src/telegram/_chat.py +++ b/src/telegram/_chat.py @@ -4091,24 +4091,6 @@ class Chat(_ChatBase): .. versionadded:: 22.4 - Attributes: - id (:obj:`int`): Unique identifier for this chat. - type (:obj:`str`): Type of chat, can be either :attr:`PRIVATE`, :attr:`GROUP`, - :attr:`SUPERGROUP` or :attr:`CHANNEL`. - title (:obj:`str`): Optional. Title, for supergroups, channels and group chats. - username (:obj:`str`): Optional. Username, for private chats, supergroups and channels if - available. - first_name (:obj:`str`): Optional. First name of the other party in a private chat. - last_name (:obj:`str`): Optional. Last name of the other party in a private chat. - is_forum (:obj:`bool`): Optional. :obj:`True`, if the supergroup chat is a forum - (has topics_ enabled). - - .. versionadded:: 20.0 - is_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the chat is the direct messages - chat of a channel. - - .. versionadded:: 22.4 - .. _topics: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups """ diff --git a/src/telegram/_chatadministratorrights.py b/src/telegram/_chatadministratorrights.py index 09b4b70adf6..e9b5e514d43 100644 --- a/src/telegram/_chatadministratorrights.py +++ b/src/telegram/_chatadministratorrights.py @@ -113,64 +113,6 @@ class ChatAdministratorRights(TelegramObject): tags of regular members; for groups and supergroups only. If omitted defaults to the value of :attr:`can_pin_messages`. - .. versionadded:: 22.7 - - Attributes: - is_anonymous (:obj:`bool`): :obj:`True`, if the user's presence in the chat is hidden. - can_manage_chat (:obj:`bool`): :obj:`True`, if the administrator can access the chat event - log, get boost list, see hidden supergroup and channel members, report spam messages - and ignore slow mode. Implied by any other administrator privilege. - can_delete_messages (:obj:`bool`): :obj:`True`, if the administrator can delete messages of - other users. - can_manage_video_chats (:obj:`bool`): :obj:`True`, if the administrator can manage video - chats. - can_restrict_members (:obj:`bool`): :obj:`True`, if the administrator can restrict, ban or - unban chat members, or access supergroup statistics. - can_promote_members (:obj:`bool`): :obj:`True`, if the administrator can add new - administrators with a subset of their own privileges or demote administrators that he - has promoted, directly or indirectly (promoted by administrators that were appointed by - the user.) - can_change_info (:obj:`bool`): :obj:`True`, if the user is allowed to change the chat title - ,photo and other settings. - can_invite_users (:obj:`bool`): :obj:`True`, if the user is allowed to invite new users to - the chat. - can_post_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can post - messages in the channel, or access channel statistics; for channels only. - can_edit_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can edit - messages of other users and can pin messages; for channels only. - can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin - messages; for groups and supergroups only. - can_post_stories (:obj:`bool`): :obj:`True`, if the administrator can post - stories to the chat. - - .. versionadded:: 20.6 - .. versionchanged:: 21.0 - |non_optional_story_argument| - can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit stories posted - by other users, post stories to the chat page, pin chat stories, and access the chat's - story archive - - .. versionadded:: 20.6 - .. versionchanged:: 21.0 - |non_optional_story_argument| - can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete - stories posted by other users. - - .. versionadded:: 20.6 - .. versionchanged:: 21.0 - |non_optional_story_argument| - can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed - to create, rename, close, and reopen forum topics; for supergroups only. - - .. versionadded:: 20.0 - can_manage_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can - manage direct messages of the channel and decline suggested posts; for channels only. - - .. versionadded:: 22.4 - can_manage_tags (:obj:`bool`): Optional. :obj:`True`, if the administrator can edit the - tags of regular members; for groups and supergroups only. If omitted defaults to the - value of :attr:`can_pin_messages`. - .. versionadded:: 22.7 """ diff --git a/src/telegram/_chatbackground.py b/src/telegram/_chatbackground.py index 5b71259d58e..0da40a23f10 100644 --- a/src/telegram/_chatbackground.py +++ b/src/telegram/_chatbackground.py @@ -48,11 +48,6 @@ class BackgroundFill(TelegramObject): type (:obj:`str`): Type of the background fill. Can be one of: :attr:`~telegram.BackgroundFill.SOLID`, :attr:`~telegram.BackgroundFill.GRADIENT` or :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`. - - Attributes: - type (:obj:`str`): Type of the background fill. Can be one of: - :attr:`~telegram.BackgroundFill.SOLID`, :attr:`~telegram.BackgroundFill.GRADIENT` - or :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`. """ __slots__ = ("type",) @@ -111,7 +106,6 @@ class BackgroundFillSolid(BackgroundFill): Attributes: type (:obj:`str`): Type of the background fill. Always :attr:`~telegram.BackgroundFill.SOLID`. - color (:obj:`int`): The color of the background fill in the `RGB24` format. """ __slots__ = ("color",) @@ -151,11 +145,6 @@ class BackgroundFillGradient(BackgroundFill): Attributes: type (:obj:`str`): Type of the background fill. Always :attr:`~telegram.BackgroundFill.GRADIENT`. - top_color (:obj:`int`): Top color of the gradient in the `RGB24` format. - bottom_color (:obj:`int`): Bottom color of the gradient in the `RGB24` format. - rotation_angle (:obj:`int`): Clockwise rotation angle of the background - fill in degrees; - 0-:tg-const:`telegram.constants.BackgroundFillLimit.MAX_ROTATION_ANGLE`. """ __slots__ = ("bottom_color", "rotation_angle", "top_color") @@ -194,8 +183,6 @@ class BackgroundFillFreeformGradient(BackgroundFill): Attributes: type (:obj:`str`): Type of the background fill. Always :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`. - colors (Sequence[:obj:`int`]): A list of the 3 or 4 base colors that are used to - generate the freeform gradient in the `RGB24` format """ __slots__ = ("colors",) @@ -232,13 +219,6 @@ class BackgroundType(TelegramObject): :attr:`~telegram.BackgroundType.FILL`, :attr:`~telegram.BackgroundType.WALLPAPER` :attr:`~telegram.BackgroundType.PATTERN` or :attr:`~telegram.BackgroundType.CHAT_THEME`. - - Attributes: - type (:obj:`str`): Type of the background. Can be one of: - :attr:`~telegram.BackgroundType.FILL`, :attr:`~telegram.BackgroundType.WALLPAPER` - :attr:`~telegram.BackgroundType.PATTERN` or - :attr:`~telegram.BackgroundType.CHAT_THEME`. - """ __slots__ = ("type",) @@ -307,10 +287,6 @@ class BackgroundTypeFill(BackgroundType): Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.FILL`. - fill (:class:`telegram.BackgroundFill`): The background fill. - dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a - percentage; - 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`. """ __slots__ = ("dark_theme_dimming", "fill") @@ -353,14 +329,6 @@ class BackgroundTypeWallpaper(BackgroundType): Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.WALLPAPER`. - document (:class:`telegram.Document`): Document with the wallpaper - dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a - percentage; - 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`. - is_blurred (:obj:`bool`): Optional. :obj:`True`, if the wallpaper is downscaled to fit - in a 450x450 square and then box-blurred with radius 12 - is_moving (:obj:`bool`): Optional. :obj:`True`, if the background moves slightly - when the device is tilted """ __slots__ = ("dark_theme_dimming", "document", "is_blurred", "is_moving") @@ -414,17 +382,6 @@ class BackgroundTypePattern(BackgroundType): Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.PATTERN`. - document (:class:`telegram.Document`): Document with the pattern. - fill (:class:`telegram.BackgroundFill`): The background fill that is combined with - the pattern. - intensity (:obj:`int`): Intensity of the pattern when it is shown above the filled - background; - 0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_INTENSITY`. - is_inverted (:obj:`int`): Optional. :obj:`True`, if the background fill must be applied - only to the pattern itself. All other pixels are black in this case. For dark - themes only. - is_moving (:obj:`bool`): Optional. :obj:`True`, if the background moves slightly - when the device is tilted. """ __slots__ = ( @@ -474,7 +431,6 @@ class BackgroundTypeChatTheme(BackgroundType): Attributes: type (:obj:`str`): Type of the background. Always :attr:`~telegram.BackgroundType.CHAT_THEME`. - theme_name (:obj:`str`): Name of the chat theme, which is usually an emoji. """ __slots__ = ("theme_name",) @@ -504,9 +460,6 @@ class ChatBackground(TelegramObject): Args: type (:class:`telegram.BackgroundType`): Type of the background. - - Attributes: - type (:class:`telegram.BackgroundType`): Type of the background. """ __slots__ = ("type",) diff --git a/src/telegram/_chatboost.py b/src/telegram/_chatboost.py index 2386f2e6a5c..dbe22a5b69c 100644 --- a/src/telegram/_chatboost.py +++ b/src/telegram/_chatboost.py @@ -47,10 +47,6 @@ class ChatBoostAdded(TelegramObject): Args: boost_count (:obj:`int`): Number of boosts added by the user. - - Attributes: - boost_count (:obj:`int`): Number of boosts added by the user. - """ __slots__ = ("boost_count",) @@ -85,11 +81,6 @@ class ChatBoostSource(TelegramObject): source (:obj:`str`): The source of the chat boost. Can be one of: :attr:`~telegram.ChatBoostSource.PREMIUM`, :attr:`~telegram.ChatBoostSource.GIFT_CODE`, or :attr:`~telegram.ChatBoostSource.GIVEAWAY`. - - Attributes: - source (:obj:`str`): The source of the chat boost. Can be one of: - :attr:`~telegram.ChatBoostSource.PREMIUM`, :attr:`~telegram.ChatBoostSource.GIFT_CODE`, - or :attr:`~telegram.ChatBoostSource.GIVEAWAY`. """ __slots__ = ("source",) @@ -143,7 +134,6 @@ class ChatBoostSourcePremium(ChatBoostSource): Attributes: source (:obj:`str`): The source of the chat boost. Always :attr:`~telegram.ChatBoostSource.PREMIUM`. - user (:class:`telegram.User`): User that boosted the chat. """ __slots__ = ("user",) @@ -169,7 +159,6 @@ class ChatBoostSourceGiftCode(ChatBoostSource): Attributes: source (:obj:`str`): The source of the chat boost. Always :attr:`~telegram.ChatBoostSource.GIFT_CODE`. - user (:class:`telegram.User`): User for which the gift code was created. """ __slots__ = ("user",) @@ -205,15 +194,6 @@ class ChatBoostSourceGiveaway(ChatBoostSource): Attributes: source (:obj:`str`): Source of the boost. Always :attr:`~telegram.ChatBoostSource.GIVEAWAY`. - giveaway_message_id (:obj:`int`): Identifier of a message in the chat with the giveaway; - the message could have been deleted already. May be 0 if the message isn't sent yet. - user (:class:`telegram.User`): Optional. User that won the prize in the giveaway if any. - prize_star_count (:obj:`int`): Optional. The number of Telegram Stars to be split between - giveaway winners; for Telegram Star giveaways only. - - .. versionadded:: 21.6 - is_unclaimed (:obj:`bool`): Optional. :obj:`True`, if the giveaway was completed, but - there was no user to win the prize. """ __slots__ = ("giveaway_message_id", "is_unclaimed", "prize_star_count", "user") @@ -247,14 +227,6 @@ class ChatBoost(TelegramObject): .. versionadded:: 20.8 Args: - boost_id (:obj:`str`): Unique identifier of the boost. - add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted. - expiration_date (:obj:`datetime.datetime`): Point in time when the boost - will automatically expire, unless the booster's Telegram Premium subscription is - prolonged. - source (:class:`telegram.ChatBoostSource`): Source of the added boost. - - Attributes: boost_id (:obj:`str`): Unique identifier of the boost. add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted. |datetime_localization| @@ -309,10 +281,6 @@ class ChatBoostUpdated(TelegramObject): Args: chat (:class:`telegram.Chat`): Chat which was boosted. boost (:class:`telegram.ChatBoost`): Information about the chat boost. - - Attributes: - chat (:class:`telegram.Chat`): Chat which was boosted. - boost (:class:`telegram.ChatBoost`): Information about the chat boost. """ __slots__ = ("boost", "chat") @@ -352,12 +320,6 @@ class ChatBoostRemoved(TelegramObject): :attr:`source` are equal. Args: - chat (:class:`telegram.Chat`): Chat which was boosted. - boost_id (:obj:`str`): Unique identifier of the boost. - remove_date (:obj:`datetime.datetime`): Point in time when the boost was removed. - source (:class:`telegram.ChatBoostSource`): Source of the removed boost. - - Attributes: chat (:class:`telegram.Chat`): Chat which was boosted. boost_id (:obj:`str`): Unique identifier of the boost. remove_date (:obj:`datetime.datetime`): Point in time when the boost was removed. @@ -410,9 +372,6 @@ class UserChatBoosts(TelegramObject): Args: boosts (Sequence[:class:`telegram.ChatBoost`]): List of boosts added to the chat by the user. - - Attributes: - boosts (tuple[:class:`telegram.ChatBoost`]): List of boosts added to the chat by the user. """ __slots__ = ("boosts",) diff --git a/src/telegram/_chatfullinfo.py b/src/telegram/_chatfullinfo.py index 7142b5feb6a..8f33ebb5d05 100644 --- a/src/telegram/_chatfullinfo.py +++ b/src/telegram/_chatfullinfo.py @@ -253,129 +253,12 @@ class ChatFullInfo(_ChatBase): .. versionadded:: 22.7 - Attributes: - id (:obj:`int`): Unique identifier for this chat. - type (:obj:`str`): Type of chat, can be either :attr:`PRIVATE`, :attr:`GROUP`, - :attr:`SUPERGROUP` or :attr:`CHANNEL`. - accent_color_id (:obj:`int`): Optional. Identifier of the - :class:`accent color ` for the chat name and - backgrounds of the chat photo, reply header, and link preview. See `accent colors`_ - for more details. - - .. versionadded:: 20.8 - max_reaction_count (:obj:`int`): The maximum number of reactions that can be set on a - message in the chat. - - .. versionadded:: 21.2 - accepted_gift_types (:class:`telegram.AcceptedGiftTypes`): Information about types of - gifts that are accepted by the chat or by the corresponding user for private chats. - - .. versionadded:: 22.1 - title (:obj:`str`, optional): Title, for supergroups, channels and group chats. - username (:obj:`str`, optional): Username, for private chats, supergroups and channels if - available. - first_name (:obj:`str`, optional): First name of the other party in a private chat. - last_name (:obj:`str`, optional): Last name of the other party in a private chat. - is_forum (:obj:`bool`, optional): :obj:`True`, if the supergroup chat is a forum - (has topics_ enabled). - - .. versionadded:: 20.0 - photo (:class:`telegram.ChatPhoto`): Optional. Chat photo. - active_usernames (tuple[:obj:`str`]): Optional. If set, the list of all `active chat - usernames `_; for private chats, supergroups and channels. - - This list is empty if the chat has no active usernames or this chat instance was not - obtained via :meth:`~telegram.Bot.get_chat`. - - .. versionadded:: 20.0 - birthdate (:class:`telegram.Birthdate`): Optional. For private chats, - the date of birth of the user. - - .. versionadded:: 21.1 - business_intro (:class:`telegram.BusinessIntro`): Optional. For private chats with - business accounts, the intro of the business. - - .. versionadded:: 21.1 - business_location (:class:`telegram.BusinessLocation`): Optional. For private chats with - business accounts, the location of the business. - - .. versionadded:: 21.1 - business_opening_hours (:class:`telegram.BusinessOpeningHours`): Optional. For private - chats with business accounts, the opening hours of the business. - - .. versionadded:: 21.1 - personal_chat (:class:`telegram.Chat`): Optional. For private chats, the personal channel - of the user. - - .. versionadded:: 21.1 - available_reactions (tuple[:class:`telegram.ReactionType`]): Optional. List of available - reactions allowed in the chat. If omitted, then all of - :const:`telegram.constants.ReactionEmoji` are allowed. - - .. versionadded:: 20.8 - background_custom_emoji_id (:obj:`str`): Optional. Custom emoji identifier of emoji chosen - by the chat for the reply header and link preview background. - - .. versionadded:: 20.8 - profile_accent_color_id (:obj:`int`): Optional. Identifier of the - :class:`accent color ` for the chat's profile - background. See profile `accent colors`_ for more details. - - .. versionadded:: 20.8 - profile_background_custom_emoji_id (:obj:`str`): Optional. Custom emoji identifier of - the emoji chosen by the chat for its profile background. - - .. versionadded:: 20.8 - emoji_status_custom_emoji_id (:obj:`str`): Optional. Custom emoji identifier of emoji - status of the chat or the other party in a private chat. - - .. versionadded:: 20.0 - emoji_status_expiration_date (:class:`datetime.datetime`): Optional. Expiration date of - emoji status of the chat or the other party in a private chat, as a datetime object, - if any. - - |datetime_localization| - - .. versionadded:: 20.5 - bio (:obj:`str`): Optional. Bio of the other party in a private chat. - has_private_forwards (:obj:`bool`): Optional. :obj:`True`, if privacy settings of the other - party in the private chat allows to use ``tg://user?id=`` links only in chats - with the user. - - .. versionadded:: 13.9 - has_restricted_voice_and_video_messages (:obj:`bool`): Optional. :obj:`True`, if the - privacy settings of the other party restrict sending voice and video note messages - in the private chat. - - .. versionadded:: 20.0 - join_to_send_messages (:obj:`bool`): Optional. :obj:`True`, if users need to join - the supergroup before they can send messages. - - .. versionadded:: 20.0 - join_by_request (:obj:`bool`): Optional. :obj:`True`, if all users directly joining the - supergroup without using an invite link need to be approved by supergroup - administrators. - - .. versionadded:: 20.0 - description (:obj:`str`): Optional. Description, for groups, supergroups and channel chats. - invite_link (:obj:`str`): Optional. Primary invite link, for groups, supergroups and - channel. - pinned_message (:class:`telegram.Message`): Optional. The most recent pinned message - (by sending date). - permissions (:class:`telegram.ChatPermissions`): Optional. Default chat member permissions, - for groups and supergroups. slow_mode_delay (:obj:`int` | :class:`datetime.timedelta`): Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user. .. deprecated:: v22.2 |time-period-int-deprecated| - unrestrict_boost_count (:obj:`int`): Optional. For supergroups, the minimum number of - boosts that a non-administrator user needs to add in order to ignore slow mode and chat - permissions. - - .. versionadded:: 21.0 message_auto_delete_time (:obj:`int` | :class:`datetime.timedelta`): Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. @@ -383,65 +266,6 @@ class ChatFullInfo(_ChatBase): .. deprecated:: v22.2 |time-period-int-deprecated| - has_aggressive_anti_spam_enabled (:obj:`bool`): Optional. :obj:`True`, if aggressive - anti-spam checks are enabled in the supergroup. The field is only available to chat - administrators. - - .. versionadded:: 20.0 - has_hidden_members (:obj:`bool`): Optional. :obj:`True`, if non-administrators can only - get the list of bots and administrators in the chat. - - .. versionadded:: 20.0 - has_protected_content (:obj:`bool`): Optional. :obj:`True`, if messages from the chat can't - be forwarded to other chats. - - .. versionadded:: 13.9 - has_visible_history (:obj:`bool`): Optional. :obj:`True`, if new chat members will have - access to old messages; available only to chat administrators. - - .. versionadded:: 20.8 - sticker_set_name (:obj:`str`): Optional. For supergroups, name of Group sticker set. - can_set_sticker_set (:obj:`bool`): Optional. :obj:`True`, if the bot can change group the - sticker set. - custom_emoji_sticker_set_name (:obj:`str`): Optional. For supergroups, the name of the - group's custom emoji sticker set. Custom emoji from this set can be used by all users - and bots in the group. - - .. versionadded:: 21.0 - linked_chat_id (:obj:`int`): Optional. Unique identifier for the linked chat, i.e. the - discussion group identifier for a channel and vice versa; for supergroups and channel - chats. - location (:class:`telegram.ChatLocation`): Optional. For supergroups, the location to which - the supergroup is connected. - can_send_paid_media (:obj:`bool`): Optional. :obj:`True`, if paid media messages can be - sent or forwarded to the channel chat. The field is available only for channel chats. - - .. versionadded:: 21.4 - is_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the chat is the direct messages - chat of a channel. - - .. versionadded:: 22.4 - parent_chat (:obj:`telegram.Chat`): Optional. Information about the corresponding channel - chat; for direct messages chats only. - - .. versionadded:: 22.4 - rating (:class:`telegram.UserRating`): Optional. For private chats, the rating of the user - if any. - - .. versionadded:: 22.6 - unique_gift_colors (:class:`telegram.UniqueGiftColors`): Optional. The color scheme based - on a unique gift that must be used for the chat's name, message replies and link - previews - - .. versionadded:: 22.6 - paid_message_star_count (:obj:`int`): Optional. The number of Telegram Stars a general user - have to pay to send a message to the chat - - .. versionadded:: 22.6 - first_profile_audio (:obj:`telegram.Audio`): Optional. For private chats, the first audio - added to the profile of the user. - - .. versionadded:: 22.7 .. _accent colors: https://core.telegram.org/bots/api#accent-colors .. _topics: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups diff --git a/src/telegram/_chatinvitelink.py b/src/telegram/_chatinvitelink.py index 880349fd0fb..8e35f91fdd5 100644 --- a/src/telegram/_chatinvitelink.py +++ b/src/telegram/_chatinvitelink.py @@ -89,32 +89,6 @@ class ChatInviteLink(TelegramObject): .. versionadded:: 21.5 Attributes: - invite_link (:obj:`str`): The invite link. If the link was created by another chat - administrator, then the second part of the link will be replaced with ``'…'``. - creator (:class:`telegram.User`): Creator of the link. - creates_join_request (:obj:`bool`): :obj:`True`, if users joining the chat via - the link need to be approved by chat administrators. - - .. versionadded:: 13.8 - is_primary (:obj:`bool`): :obj:`True`, if the link is primary. - is_revoked (:obj:`bool`): :obj:`True`, if the link is revoked. - expire_date (:class:`datetime.datetime`): Optional. Date when the link will expire or - has been expired. - - .. versionchanged:: 20.3 - |datetime_localization| - member_limit (:obj:`int`): Optional. Maximum number of users that can be members - of the chat simultaneously after joining the chat via this invite link; - :tg-const:`telegram.constants.ChatInviteLinkLimit.MIN_MEMBER_LIMIT`- - :tg-const:`telegram.constants.ChatInviteLinkLimit.MAX_MEMBER_LIMIT`. - name (:obj:`str`): Optional. Invite link name. - 0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters. - - .. versionadded:: 13.8 - pending_join_request_count (:obj:`int`): Optional. Number of pending join requests - created using this link. - - .. versionadded:: 13.8 subscription_period (:obj:`int` | :class:`datetime.timedelta`): Optional. The number of seconds the subscription will be active for before the next payment. @@ -122,12 +96,6 @@ class ChatInviteLink(TelegramObject): .. deprecated:: v22.2 |time-period-int-deprecated| - subscription_price (:obj:`int`): Optional. The amount of Telegram Stars a user must pay - initially and after each subsequent subscription period to be a member of the chat - using the link. - - .. versionadded:: 21.5 - """ __slots__ = ( diff --git a/src/telegram/_chatjoinrequest.py b/src/telegram/_chatjoinrequest.py index 75c2087d794..2024b5b378e 100644 --- a/src/telegram/_chatjoinrequest.py +++ b/src/telegram/_chatjoinrequest.py @@ -62,10 +62,7 @@ class ChatJoinRequest(TelegramObject): .. versionchanged:: 20.3 |datetime_localization| user_chat_id (:obj:`int`): Identifier of a private chat with the user who sent the join - request. This number may have more than 32 significant bits and some programming - languages may have difficulty/silent defects in interpreting it. But it has at most 52 - significant bits, so a 64-bit integer or double-precision float type are safe for - storing this identifier. The bot can use this identifier for 5 minutes to send messages + request. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user. @@ -75,28 +72,12 @@ class ChatJoinRequest(TelegramObject): by the user to send the join request. Attributes: - chat (:class:`telegram.Chat`): Chat to which the request was sent. - from_user (:class:`telegram.User`): User that sent the join request. - date (:class:`datetime.datetime`): Date the request was sent. - - .. versionchanged:: 20.3 - |datetime_localization| - user_chat_id (:obj:`int`): Identifier of a private chat with the user who sent the join - request. This number may have more than 32 significant bits and some programming - languages may have difficulty/silent defects in interpreting it. But it has at most 52 - significant bits, so a 64-bit integer or double-precision float type are safe for - storing this identifier. The bot can use this identifier for 5 minutes to send messages - until the join request is processed, assuming no other administrator contacted the - user. - - .. versionadded:: 20.1 - bio (:obj:`str`): Optional. Bio of the user. invite_link (:class:`telegram.ChatInviteLink`): Optional. Chat invite link that was used by the user to send the join request. Note: When a user joins a *public* group via an invite link, this attribute may not - be present. However, this behavior is undocument and may be subject to change. + be present. However, this behavior is undocumented and may be subject to change. See `this GitHub thread `_ for some discussion. diff --git a/src/telegram/_chatlocation.py b/src/telegram/_chatlocation.py index b93cfc8a624..9deda11682a 100644 --- a/src/telegram/_chatlocation.py +++ b/src/telegram/_chatlocation.py @@ -42,13 +42,6 @@ class ChatLocation(TelegramObject): address (:obj:`str`): Location address; :tg-const:`telegram.ChatLocation.MIN_ADDRESS`- :tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner. - Attributes: - location (:class:`telegram.Location`): The location to which the supergroup is connected. - Can't be a live location. - address (:obj:`str`): Location address; - :tg-const:`telegram.ChatLocation.MIN_ADDRESS`- - :tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner. - """ __slots__ = ("address", "location") diff --git a/src/telegram/_chatmember.py b/src/telegram/_chatmember.py index be55c8469e8..8736a7292ed 100644 --- a/src/telegram/_chatmember.py +++ b/src/telegram/_chatmember.py @@ -65,14 +65,6 @@ class ChatMember(TelegramObject): :attr:`~telegram.ChatMember.ADMINISTRATOR`, :attr:`~telegram.ChatMember.OWNER`, :attr:`~telegram.ChatMember.BANNED`, :attr:`~telegram.ChatMember.LEFT`, :attr:`~telegram.ChatMember.MEMBER` or :attr:`~telegram.ChatMember.RESTRICTED`. - - Attributes: - user (:class:`telegram.User`): Information about the user. - status (:obj:`str`): The member's status in the chat. Can be - :attr:`~telegram.ChatMember.ADMINISTRATOR`, :attr:`~telegram.ChatMember.OWNER`, - :attr:`~telegram.ChatMember.BANNED`, :attr:`~telegram.ChatMember.LEFT`, - :attr:`~telegram.ChatMember.MEMBER` or :attr:`~telegram.ChatMember.RESTRICTED`. - """ __slots__ = ("status", "user") @@ -155,11 +147,6 @@ class ChatMemberOwner(ChatMember): Attributes: status (:obj:`str`): The member's status in the chat, always :tg-const:`telegram.ChatMember.OWNER`. - user (:class:`telegram.User`): Information about the user. - is_anonymous (:obj:`bool`): :obj:`True`, if the user's - presence in the chat is hidden. - custom_title (:obj:`str`): Optional. Custom title for - this user. """ __slots__ = ("custom_title", "is_anonymous") @@ -266,71 +253,6 @@ class ChatMemberAdministrator(ChatMember): Attributes: status (:obj:`str`): The member's status in the chat, always :tg-const:`telegram.ChatMember.ADMINISTRATOR`. - user (:class:`telegram.User`): Information about the user. - can_be_edited (:obj:`bool`): :obj:`True`, if the bot - is allowed to edit administrator privileges of that user. - is_anonymous (:obj:`bool`): :obj:`True`, if the user's - presence in the chat is hidden. - can_manage_chat (:obj:`bool`): :obj:`True`, if the administrator can access the chat event - log, get boost list, see hidden supergroup and channel members, report spam messages - and ignore slow mode. Implied by any other administrator privilege. - can_delete_messages (:obj:`bool`): :obj:`True`, if the - administrator can delete messages of other users. - can_manage_video_chats (:obj:`bool`): :obj:`True`, if the - administrator can manage video chats. - - .. versionadded:: 20.0 - can_restrict_members (:obj:`bool`): :obj:`True`, if the - administrator can restrict, ban or unban chat members, or access supergroup statistics. - can_promote_members (:obj:`bool`): :obj:`True`, if the administrator can add new - administrators with a subset of their own privileges or demote administrators - that they have promoted, directly or indirectly (promoted by administrators that - were appointed by the user). - can_change_info (:obj:`bool`): :obj:`True`, if the user can change - the chat title, photo and other settings. - can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite - new users to the chat. - can_post_messages (:obj:`bool`): Optional. :obj:`True`, if the - administrator can post messages in the channel or access channel statistics; - for channels only. - can_edit_messages (:obj:`bool`): Optional. :obj:`True`, if the - administrator can edit messages of other users and can pin - messages; for channels only. - can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed - to pin messages; for groups and supergroups only. - can_post_stories (:obj:`bool`): :obj:`True`, if the administrator can post - stories to the chat. - - .. versionadded:: 20.6 - .. versionchanged:: 21.0 - |non_optional_story_argument| - can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit stories posted - by other users, post stories to the chat page, pin chat stories, and access the chat's - story archive - - .. versionadded:: 20.6 - .. versionchanged:: 21.0 - |non_optional_story_argument| - can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete - stories posted by other users. - - .. versionadded:: 20.6 - .. versionchanged:: 21.0 - |non_optional_story_argument| - can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed - to create, rename, close, and reopen forum topics; for supergroups only - - .. versionadded:: 20.0 - custom_title (:obj:`str`): Optional. Custom title for this user. - can_manage_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can - manage direct messages of the channel and decline suggested posts; for channels only. - - .. versionadded:: 22.4 - can_manage_tags (:obj:`bool`): Optional. :obj:`True`, if the administrator can edit the - tags of regular members; for groups and supergroups only. If omitted defaults to the - value of :attr:`can_pin_messages`. - - .. versionadded:: 22.7 """ __slots__ = ( @@ -424,15 +346,6 @@ class ChatMemberMember(ChatMember): Attributes: status (:obj:`str`): The member's status in the chat, always :tg-const:`telegram.ChatMember.MEMBER`. - user (:class:`telegram.User`): Information about the user. - until_date (:class:`datetime.datetime`): Optional. Date when the user's subscription will - expire. - - .. versionadded:: 21.5 - tag (:obj:`str`): Optional. Tag of the member. - - .. versionadded:: 22.7 - """ __slots__ = ( @@ -524,59 +437,6 @@ class ChatMemberRestricted(ChatMember): Attributes: status (:obj:`str`): The member's status in the chat, always :tg-const:`telegram.ChatMember.RESTRICTED`. - user (:class:`telegram.User`): Information about the user. - is_member (:obj:`bool`): :obj:`True`, if the user is a - member of the chat at the moment of the request. - can_change_info (:obj:`bool`): :obj:`True`, if the user can change - the chat title, photo and other settings. - can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite - new users to the chat. - can_pin_messages (:obj:`bool`): :obj:`True`, if the user is allowed - to pin messages; groups and supergroups only. - can_send_messages (:obj:`bool`): :obj:`True`, if the user is allowed - to send text messages, contacts, locations and venues. - can_send_polls (:obj:`bool`): :obj:`True`, if the user is allowed - to send polls. - can_send_other_messages (:obj:`bool`): :obj:`True`, if the user is allowed - to send animations, games, stickers and use inline bots. - can_add_web_page_previews (:obj:`bool`): :obj:`True`, if the user is - allowed to add web page previews to their messages. - can_manage_topics (:obj:`bool`): :obj:`True`, if the user is allowed to create - forum topics. - - .. versionadded:: 20.0 - until_date (:class:`datetime.datetime`): Date when restrictions - will be lifted for this user. - - .. versionchanged:: 20.3 - |datetime_localization| - can_send_audios (:obj:`bool`): :obj:`True`, if the user is allowed to send audios. - - .. versionadded:: 20.1 - can_send_documents (:obj:`bool`): :obj:`True`, if the user is allowed to send documents. - - .. versionadded:: 20.1 - can_send_photos (:obj:`bool`): :obj:`True`, if the user is allowed to send photos. - - .. versionadded:: 20.1 - can_send_videos (:obj:`bool`): :obj:`True`, if the user is allowed to send videos. - - .. versionadded:: 20.1 - can_send_video_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send video - notes. - - .. versionadded:: 20.1 - can_send_voice_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send voice - notes. - - .. versionadded:: 20.1 - can_edit_tag (:obj:`bool`): :obj:`True`, if the user is allowed to edit their own tag. - - .. versionadded:: 22.7 - tag (:obj:`str`): Optional. Tag of the member. - - .. versionadded:: 22.7 - """ __slots__ = ( @@ -659,7 +519,6 @@ class ChatMemberLeft(ChatMember): Attributes: status (:obj:`str`): The member's status in the chat, always :tg-const:`telegram.ChatMember.LEFT`. - user (:class:`telegram.User`): Information about the user. """ __slots__ = () @@ -692,13 +551,6 @@ class ChatMemberBanned(ChatMember): Attributes: status (:obj:`str`): The member's status in the chat, always :tg-const:`telegram.ChatMember.BANNED`. - user (:class:`telegram.User`): Information about the user. - until_date (:class:`datetime.datetime`): Date when restrictions - will be lifted for this user. - - .. versionchanged:: 20.3 - |datetime_localization| - """ __slots__ = ("until_date",) diff --git a/src/telegram/_chatmemberupdated.py b/src/telegram/_chatmemberupdated.py index 2434376d459..15fd2b0a164 100644 --- a/src/telegram/_chatmemberupdated.py +++ b/src/telegram/_chatmemberupdated.py @@ -70,29 +70,6 @@ class ChatMemberUpdated(TelegramObject): an administrator .. versionadded:: 21.2 - - Attributes: - chat (:class:`telegram.Chat`): Chat the user belongs to. - from_user (:class:`telegram.User`): Performer of the action, which resulted in the change. - date (:class:`datetime.datetime`): Date the change was done in Unix time. Converted to - :class:`datetime.datetime`. - - .. versionchanged:: 20.3 - |datetime_localization| - old_chat_member (:class:`telegram.ChatMember`): Previous information about the chat member. - new_chat_member (:class:`telegram.ChatMember`): New information about the chat member. - invite_link (:class:`telegram.ChatInviteLink`): Optional. Chat invite link, which was used - by the user to join the chat. For joining by invite link events only. - via_chat_folder_invite_link (:obj:`bool`): Optional. :obj:`True`, if the user joined the - chat via a chat folder invite link - - .. versionadded:: 20.3 - via_join_request (:obj:`bool`): Optional. :obj:`True`, if the user joined the chat after - sending a direct join request without using an invite link and being approved - by an administrator - - .. versionadded:: 21.2 - """ __slots__ = ( diff --git a/src/telegram/_chatowner.py b/src/telegram/_chatowner.py index 1d8ce6619bd..c8a4572e45e 100644 --- a/src/telegram/_chatowner.py +++ b/src/telegram/_chatowner.py @@ -39,10 +39,6 @@ class ChatOwnerChanged(TelegramObject): Args: new_owner (:class:`telegram.User`): The new owner of the chat - - Attributes: - new_owner (:class:`telegram.User`): The new owner of the chat - """ __slots__ = ("new_owner",) @@ -81,11 +77,6 @@ class ChatOwnerLeft(TelegramObject): Args: new_owner (:class:`telegram.User`, optional): The user which will be the new owner of the chat if the previous owner does not return to the chat - - Attributes: - new_owner (:class:`telegram.User`): Optional. The user which will be the new owner of the - chat if the previous owner does not return to the chat - """ __slots__ = ("new_owner",) diff --git a/src/telegram/_chatpermissions.py b/src/telegram/_chatpermissions.py index 2116f4f4c33..34ac3f2078f 100644 --- a/src/telegram/_chatpermissions.py +++ b/src/telegram/_chatpermissions.py @@ -47,11 +47,11 @@ class ChatPermissions(TelegramObject): :attr:`can_send_videos`, :attr:`can_send_video_notes` and :attr:`can_send_voice_notes` are considered as well when comparing objects of this type in terms of equality. * Removed deprecated argument and attribute ``can_send_media_messages``. + .. versionchanged:: 22.7 :attr:`can_edit_tag` is considered as well when comparing objects of this type in terms of equality. - Note: Though not stated explicitly in the official docs, Telegram changes not only the permissions that are set, but also sets all the others to :obj:`False`. However, since not @@ -100,52 +100,6 @@ class ChatPermissions(TelegramObject): tag. .. versionadded:: 22.7 - - Attributes: - can_send_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to send text - messages, contacts, locations and venues. - can_send_polls (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to send polls, - implies :attr:`can_send_messages`. - can_send_other_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to - send animations, games, stickers and use inline bots. - can_add_web_page_previews (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to - add web page previews to their messages. - can_change_info (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to change the - chat title, photo and other settings. Ignored in public supergroups. - can_invite_users (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to invite - new users to the chat. - can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin - messages. Ignored in public supergroups. - can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed - to create forum topics. If omitted defaults to the value of - :attr:`can_pin_messages`. - - .. versionadded:: 20.0 - can_send_audios (:obj:`bool`): :obj:`True`, if the user is allowed to send audios. - - .. versionadded:: 20.1 - can_send_documents (:obj:`bool`): :obj:`True`, if the user is allowed to send documents. - - .. versionadded:: 20.1 - can_send_photos (:obj:`bool`): :obj:`True`, if the user is allowed to send photos. - - .. versionadded:: 20.1 - can_send_videos (:obj:`bool`): :obj:`True`, if the user is allowed to send videos. - - .. versionadded:: 20.1 - can_send_video_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send video - notes. - - .. versionadded:: 20.1 - can_send_voice_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send voice - notes. - - .. versionadded:: 20.1 - can_edit_tag (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to edit their own - tag. - - .. versionadded:: 22.7 - """ __slots__ = ( diff --git a/src/telegram/_checklists.py b/src/telegram/_checklists.py index 16b7676eb5b..91b0f4049d4 100644 --- a/src/telegram/_checklists.py +++ b/src/telegram/_checklists.py @@ -60,23 +60,6 @@ class ChecklistTask(TelegramObject): the task was completed; :attr:`~telegram.constants.ZERO_DATE` if the task wasn't completed - |datetime_localization| - - Attributes: - id (:obj:`int`): Unique identifier of the task. - text (:obj:`str`): Text of the task. - text_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. Special - entities that appear in the task text. - completed_by_user (:class:`telegram.User`): Optional. User that completed the task; omitted - if the task wasn't completed - completed_by_chat (:class:`telegram.Chat`): Optional. Chat that completed the task; omitted - if the task wasn't completed by a chat - - .. versionadded:: 22.6 - completion_date (:class:`datetime.datetime`): Optional. Point in time when - the task was completed; :attr:`~telegram.constants.ZERO_DATE` if the task wasn't - completed - |datetime_localization| """ @@ -190,16 +173,6 @@ class Checklist(TelegramObject): of the list can add tasks to the list others_can_mark_tasks_as_done (:obj:`bool`, optional): :obj:`True` if users other than the creator of the list can mark tasks as done or not done - - Attributes: - title (:obj:`str`): Title of the checklist. - title_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. Special - entities that appear in the checklist title. - tasks (Tuple[:class:`telegram.ChecklistTask`]): List of tasks in the checklist. - others_can_add_tasks (:obj:`bool`): Optional. :obj:`True` if users other than the creator - of the list can add tasks to the list - others_can_mark_tasks_as_done (:obj:`bool`): Optional. :obj:`True` if users other than the - creator of the list can mark tasks as done or not done """ __slots__ = ( @@ -298,19 +271,9 @@ class ChecklistTasksDone(TelegramObject): object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. marked_as_done_task_ids (Sequence[:obj:`int`], optional): Identifiers of the tasks that - were marked as done + were marked as done. marked_as_not_done_task_ids (Sequence[:obj:`int`], optional): Identifiers of the tasks that - were marked as not done - - Attributes: - checklist_message (:class:`telegram.Message`): Optional. Message containing the checklist - whose tasks were marked as done or not done. Note that the ~:class:`telegram.Message` - object in this field will not contain the :attr:`~telegram.Message.reply_to_message` - field even if it itself is a reply. - marked_as_done_task_ids (Tuple[:obj:`int`]): Optional. Identifiers of the tasks that were - marked as done - marked_as_not_done_task_ids (Tuple[:obj:`int`]): Optional. Identifiers of the tasks that - were marked as not done + were marked as not done. """ __slots__ = ( @@ -365,14 +328,7 @@ class ChecklistTasksAdded(TelegramObject): to which tasks were added. Note that the ~:class:`telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - tasks (Sequence[:class:`telegram.ChecklistTask`]): List of tasks added to the checklist - - Attributes: - checklist_message (:class:`telegram.Message`): Optional. Message containing the checklist - to which tasks were added. Note that the ~:class:`telegram.Message` - object in this field will not contain the :attr:`~telegram.Message.reply_to_message` - field even if it itself is a reply. - tasks (Tuple[:class:`telegram.ChecklistTask`]): List of tasks added to the checklist + tasks (Sequence[:class:`telegram.ChecklistTask`]): List of tasks added to the checklist. """ __slots__ = ("checklist_message", "tasks") diff --git a/src/telegram/_choseninlineresult.py b/src/telegram/_choseninlineresult.py index 41022e066da..660d745d8bc 100644 --- a/src/telegram/_choseninlineresult.py +++ b/src/telegram/_choseninlineresult.py @@ -53,17 +53,6 @@ class ChosenInlineResult(TelegramObject): only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. query (:obj:`str`): The query that was used to obtain the result. - - Attributes: - result_id (:obj:`str`): The unique identifier for the result that was chosen. - from_user (:class:`telegram.User`): The user that chose the result. - location (:class:`telegram.Location`): Optional. Sender location, only for bots that - require user location. - inline_message_id (:obj:`str`): Optional. Identifier of the sent inline message. Available - only if there is an inline keyboard attached to the message. Will be also received in - callback queries and can be used to edit the message. - query (:obj:`str`): The query that was used to obtain the result. - """ __slots__ = ("from_user", "inline_message_id", "location", "query", "result_id") diff --git a/src/telegram/_copytextbutton.py b/src/telegram/_copytextbutton.py index 0bd5939081a..4d4c0a26a32 100644 --- a/src/telegram/_copytextbutton.py +++ b/src/telegram/_copytextbutton.py @@ -34,13 +34,7 @@ class CopyTextButton(TelegramObject): Args: text (:obj:`str`): The text to be copied to the clipboard; :tg-const:`telegram.constants.InlineKeyboardButtonLimit.MIN_COPY_TEXT`- - :tg-const:`telegram.constants.InlineKeyboardButtonLimit.MAX_COPY_TEXT` characters - - Attributes: - text (:obj:`str`): The text to be copied to the clipboard; - :tg-const:`telegram.constants.InlineKeyboardButtonLimit.MIN_COPY_TEXT`- - :tg-const:`telegram.constants.InlineKeyboardButtonLimit.MAX_COPY_TEXT` characters - + :tg-const:`telegram.constants.InlineKeyboardButtonLimit.MAX_COPY_TEXT` characters. """ __slots__ = ("text",) diff --git a/src/telegram/_dice.py b/src/telegram/_dice.py index 4f8893e6745..5e7d74ca95b 100644 --- a/src/telegram/_dice.py +++ b/src/telegram/_dice.py @@ -73,19 +73,6 @@ class Dice(TelegramObject): :tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_SLOT_MACHINE` for :tg-const:`telegram.Dice.SLOT_MACHINE` base emoji. emoji (:obj:`str`): Emoji on which the dice throw animation is based. - - Attributes: - value (:obj:`int`): Value of the dice. - :tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_BOWLING` - for :tg-const:`telegram.Dice.DICE`, :tg-const:`telegram.Dice.DARTS` and - :tg-const:`telegram.Dice.BOWLING` base emoji, - :tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_BASKETBALL` - for :tg-const:`telegram.Dice.BASKETBALL` and :tg-const:`telegram.Dice.FOOTBALL` - base emoji, - :tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_SLOT_MACHINE` - for :tg-const:`telegram.Dice.SLOT_MACHINE` base emoji. - emoji (:obj:`str`): Emoji on which the dice throw animation is based. - """ __slots__ = ("emoji", "value") diff --git a/src/telegram/_directmessagepricechanged.py b/src/telegram/_directmessagepricechanged.py index 0e9f750d446..c8113cf7954 100644 --- a/src/telegram/_directmessagepricechanged.py +++ b/src/telegram/_directmessagepricechanged.py @@ -41,15 +41,6 @@ class DirectMessagePriceChanged(TelegramObject): The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Does not apply to users who have been exempted by administrators. Defaults to ``0``. - - Attributes: - are_direct_messages_enabled (:obj:`bool`): - :obj:`True`, if direct messages are enabled for the channel chat; :obj:`False` - otherwise. - direct_message_star_count (:obj:`int`): - Optional. The new number of Telegram Stars that must be paid by users for each direct - message sent to the channel. Does not apply to users who have been exempted by - administrators. Defaults to ``0``. """ __slots__ = ("are_direct_messages_enabled", "direct_message_star_count") diff --git a/src/telegram/_directmessagestopic.py b/src/telegram/_directmessagestopic.py index 384c4db71c8..e16e569e465 100644 --- a/src/telegram/_directmessagestopic.py +++ b/src/telegram/_directmessagestopic.py @@ -39,25 +39,11 @@ class DirectMessagesTopic(TelegramObject): .. versionadded:: 22.4 Args: - topic_id (:obj:`int`): Unique identifier of the topic. This number may have more than 32 - significant bits and some programming languages may have difficulty/silent defects in - interpreting it. But it has at most 52 significant bits, so a 64-bit integer or - double-precision float type are safe for storing this identifier. + topic_id (:obj:`int`): Unique identifier of the topic. user (:class:`telegram.User`, optional): Information about the user that created the topic. .. hint:: According to Telegram, this field is always present as of Bot API 9.2. - - Attributes: - topic_id (:obj:`int`): Unique identifier of the topic. This number may have more than 32 - significant bits and some programming languages may have difficulty/silent defects in - interpreting it. But it has at most 52 significant bits, so a 64-bit integer or - double-precision float type are safe for storing this identifier. - user (:class:`telegram.User`): Optional. Information about the user that created the topic. - - .. hint:: - According to Telegram, this field is always present as of Bot API 9.2. - """ __slots__ = ("topic_id", "user") diff --git a/src/telegram/_files/animation.py b/src/telegram/_files/animation.py index ff7fc4d9432..ef519af47f3 100644 --- a/src/telegram/_files/animation.py +++ b/src/telegram/_files/animation.py @@ -58,26 +58,11 @@ class Animation(_BaseThumbedMedium): .. versionadded:: 20.2 Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Video width as defined by the sender. - height (:obj:`int`): Video height as defined by the sender. duration (:obj:`int` | :class:`datetime.timedelta`): Duration of the video in seconds as defined by the sender. .. deprecated:: v22.2 |time-period-int-deprecated| - file_name (:obj:`str`): Optional. Original animation filename as defined by the sender. - mime_type (:obj:`str`): Optional. MIME type of the file as defined by the sender. - file_size (:obj:`int`): Optional. File size in bytes. - thumbnail (:class:`telegram.PhotoSize`): Optional. Animation thumbnail as defined by - sender. - - .. versionadded:: 20.2 - """ __slots__ = ("_duration", "file_name", "height", "mime_type", "width") diff --git a/src/telegram/_files/audio.py b/src/telegram/_files/audio.py index 6d1db7d67ab..f14bd0194a7 100644 --- a/src/telegram/_files/audio.py +++ b/src/telegram/_files/audio.py @@ -36,7 +36,6 @@ class Audio(_BaseThumbedMedium): .. versionchanged:: 20.5 |removed_thumb_note| - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -59,27 +58,11 @@ class Audio(_BaseThumbedMedium): .. versionadded:: 20.2 Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which is supposed to be - the same over time and for different bots. Can't be used to download or reuse the file. duration (:obj:`int` | :class:`datetime.timedelta`): Duration of the audio in seconds as defined by the sender. .. deprecated:: v22.2 |time-period-int-deprecated| - performer (:obj:`str`): Optional. Performer of the audio as defined by the sender or by - audio tags. - title (:obj:`str`): Optional. Title of the audio as defined by the sender or by audio tags. - file_name (:obj:`str`): Optional. Original filename as defined by the sender. - mime_type (:obj:`str`): Optional. MIME type of the file as defined by the sender. - file_size (:obj:`int`): Optional. File size in bytes. - thumbnail (:class:`telegram.PhotoSize`): Optional. Thumbnail of the album cover to - which the music file belongs. - - .. versionadded:: 20.2 - - """ __slots__ = ("_duration", "file_name", "mime_type", "performer", "title") diff --git a/src/telegram/_files/chatphoto.py b/src/telegram/_files/chatphoto.py index 6fe3eca726c..8324613067e 100644 --- a/src/telegram/_files/chatphoto.py +++ b/src/telegram/_files/chatphoto.py @@ -53,25 +53,6 @@ class ChatPhoto(TelegramObject): (:tg-const:`telegram.ChatPhoto.SIZE_BIG` x :tg-const:`telegram.ChatPhoto.SIZE_BIG`) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - - Attributes: - small_file_id (:obj:`str`): File identifier of small - (:tg-const:`telegram.ChatPhoto.SIZE_SMALL` x :tg-const:`telegram.ChatPhoto.SIZE_SMALL`) - chat photo. This file_id can be used only for photo download and only for as long - as the photo is not changed. - small_file_unique_id (:obj:`str`): Unique file identifier of small - (:tg-const:`telegram.ChatPhoto.SIZE_SMALL` x :tg-const:`telegram.ChatPhoto.SIZE_SMALL`) - chat photo, which is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - big_file_id (:obj:`str`): File identifier of big - (:tg-const:`telegram.ChatPhoto.SIZE_BIG` x :tg-const:`telegram.ChatPhoto.SIZE_BIG`) - chat photo. This file_id can be used only for photo download and only for as long as - the photo is not changed. - big_file_unique_id (:obj:`str`): Unique file identifier of big - (:tg-const:`telegram.ChatPhoto.SIZE_BIG` x :tg-const:`telegram.ChatPhoto.SIZE_BIG`) - chat photo, which is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - """ __slots__ = ( diff --git a/src/telegram/_files/contact.py b/src/telegram/_files/contact.py index c3951c31b8b..d6b6eacf045 100644 --- a/src/telegram/_files/contact.py +++ b/src/telegram/_files/contact.py @@ -34,14 +34,6 @@ class Contact(TelegramObject): last_name (:obj:`str`, optional): Contact's last name. user_id (:obj:`int`, optional): Contact's user identifier in Telegram. vcard (:obj:`str`, optional): Additional data about the contact in the form of a vCard. - - Attributes: - phone_number (:obj:`str`): Contact's phone number. - first_name (:obj:`str`): Contact's first name. - last_name (:obj:`str`): Optional. Contact's last name. - user_id (:obj:`int`): Optional. Contact's user identifier in Telegram. - vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard. - """ __slots__ = ("first_name", "last_name", "phone_number", "user_id", "vcard") diff --git a/src/telegram/_files/document.py b/src/telegram/_files/document.py index f58fbee95da..90408e6e81d 100644 --- a/src/telegram/_files/document.py +++ b/src/telegram/_files/document.py @@ -45,20 +45,6 @@ class Document(_BaseThumbedMedium): sender. .. versionadded:: 20.2 - - Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which is supposed to be - the same over time and for different bots. Can't be used to download or reuse the file. - file_name (:obj:`str`): Optional. Original filename as defined by the sender. - mime_type (:obj:`str`): Optional. MIME type of the file as defined by the sender. - file_size (:obj:`int`): Optional. File size in bytes. - thumbnail (:class:`telegram.PhotoSize`): Optional. Document thumbnail as defined by the - sender. - - .. versionadded:: 20.2 - """ __slots__ = ("file_name", "mime_type") diff --git a/src/telegram/_files/file.py b/src/telegram/_files/file.py index 3e9d162fd88..7bbad2f4451 100644 --- a/src/telegram/_files/file.py +++ b/src/telegram/_files/file.py @@ -62,16 +62,6 @@ class File(TelegramObject): file_size (:obj:`int`, optional): File size in bytes, if known. file_path (:obj:`str`, optional): File path. Use e.g. :meth:`download_to_drive` to get the file. - - Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - file_size (:obj:`int`): Optional. File size in bytes, if known. - file_path (:obj:`str`): Optional. File path. Use e.g. :meth:`download_to_drive` to get the - file. """ __slots__ = ( diff --git a/src/telegram/_files/inputfile.py b/src/telegram/_files/inputfile.py index 74423914391..1b971d17f08 100644 --- a/src/telegram/_files/inputfile.py +++ b/src/telegram/_files/inputfile.py @@ -86,7 +86,6 @@ class InputFile: attach_name (:obj:`str`): Optional. If present, the parameter this file belongs to in the request to Telegram should point to the multipart data via a an URI of the form ``attach://`` URI. - filename (:obj:`str`): Filename for the file to be sent. mimetype (:obj:`str`): The mimetype inferred from the file to be sent. """ diff --git a/src/telegram/_files/inputmedia.py b/src/telegram/_files/inputmedia.py index 23b6620985a..aac55a744a7 100644 --- a/src/telegram/_files/inputmedia.py +++ b/src/telegram/_files/inputmedia.py @@ -63,26 +63,11 @@ class InputMedia(TelegramObject): 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities parsing. caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - parse_mode (:obj:`str`, optional): |parse_mode| Attributes: type (:obj:`str`): Type of the input media. media (:obj:`str` | :class:`telegram.InputFile`): Media to send. - caption (:obj:`str`): Optional. Caption of the media to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities - parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - """ __slots__ = ("caption", "caption_entities", "media", "parse_mode", "type") @@ -134,7 +119,6 @@ class InputPaidMedia(TelegramObject): to send. |fileinputnopath| Attributes: - type (:obj:`str`): Type of the input media. media (:obj:`str` | :class:`telegram.InputFile`): Media to send. """ @@ -234,20 +218,12 @@ class InputPaidMediaVideo(InputPaidMedia): media (:obj:`str` | :class:`telegram.InputFile`): Video to send. thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase| cover (:class:`telegram.InputFile`): Optional. Cover for the video in the message. - |fileinputnopath| - - .. versionchanged:: 21.11 - start_timestamp (:obj:`int`): Optional. Start timestamp for the video in the message .. versionchanged:: 21.11 - width (:obj:`int`): Optional. Video width. - height (:obj:`int`): Optional. Video height. duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Video duration in seconds. .. deprecated:: v22.2 |time-period-int-deprecated| - supports_streaming (:obj:`bool`): Optional. :obj:`True`, if the uploaded video is - suitable for streaming. """ __slots__ = ( @@ -330,10 +306,6 @@ class InputMediaAnimation(InputMedia): after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - width (:obj:`int`, optional): Animation width. height (:obj:`int`, optional): Animation height. duration (:obj:`int` | :class:`datetime.timedelta`, optional): Animation duration @@ -356,33 +328,14 @@ class InputMediaAnimation(InputMedia): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.ANIMATION`. media (:obj:`str` | :class:`telegram.InputFile`): Animation to send. - caption (:obj:`str`): Optional. Caption of the animation to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - width (:obj:`int`): Optional. Animation width. - height (:obj:`int`): Optional. Animation height. duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Animation duration in seconds. .. deprecated:: v22.2 |time-period-int-deprecated| - has_spoiler (:obj:`bool`): Optional. :obj:`True`, if the animation is covered with a - spoiler animation. - - .. versionadded:: 20.0 thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase| .. versionadded:: 20.2 - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 """ __slots__ = ( @@ -463,37 +416,17 @@ class InputMediaPhoto(InputMedia): entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| has_spoiler (:obj:`bool`, optional): Pass :obj:`True`, if the photo needs to be covered with a spoiler animation. .. versionadded:: 20.0 - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.PHOTO`. media (:obj:`str` | :class:`telegram.InputFile`): Photo to send. - caption (:obj:`str`): Optional. Caption of the photo to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - has_spoiler (:obj:`bool`): Optional. :obj:`True`, if the photo is covered with a - spoiler animation. - - .. versionadded:: 20.0 - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 """ __slots__ = ( @@ -563,10 +496,6 @@ class InputMediaVideo(InputMedia): entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - width (:obj:`int`, optional): Video width. height (:obj:`int`, optional): Video height. duration (:obj:`int` | :class:`datetime.timedelta`, optional): Video duration in seconds. @@ -590,47 +519,23 @@ class InputMediaVideo(InputMedia): start_timestamp (:obj:`int`, optional): Start timestamp for the video in the message .. versionchanged:: 21.11 - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.VIDEO`. media (:obj:`str` | :class:`telegram.InputFile`): Video file to send. - caption (:obj:`str`): Optional. Caption of the video to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - width (:obj:`int`): Optional. Video width. - height (:obj:`int`): Optional. Video height. duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Video duration in seconds. .. deprecated:: v22.2 |time-period-int-deprecated| - supports_streaming (:obj:`bool`): Optional. :obj:`True`, if the uploaded video is - suitable for streaming. - has_spoiler (:obj:`bool`): Optional. :obj:`True`, if the video is covered with a - spoiler animation. - - .. versionadded:: 20.0 thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase| .. versionadded:: 20.2 - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 cover (:class:`telegram.InputFile`): Optional. Cover for the video in the message. |fileinputnopath| - .. versionchanged:: 21.11 - start_timestamp (:obj:`int`): Optional. Start timestamp for the video in the message - .. versionchanged:: 21.11 """ @@ -731,10 +636,6 @@ class InputMediaAudio(InputMedia): entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - duration (:obj:`int` | :class:`datetime.timedelta`, optional): Duration of the audio in seconds as defined by the sender. @@ -751,24 +652,11 @@ class InputMediaAudio(InputMedia): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.AUDIO`. media (:obj:`str` | :class:`telegram.InputFile`): Audio file to send. - caption (:obj:`str`): Optional. Caption of the audio to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Duration of the audio in seconds. .. deprecated:: v22.2 |time-period-int-deprecated| - performer (:obj:`str`): Optional. Performer of the audio as defined by the sender or by - audio tags. - title (:obj:`str`): Optional. Title of the audio as defined by the sender or by audio tags. thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase| .. versionadded:: 20.2 @@ -845,10 +733,6 @@ class InputMediaDocument(InputMedia): entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - disable_content_type_detection (:obj:`bool`, optional): Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always :obj:`True`, if the document is sent as part of an album. @@ -860,19 +744,6 @@ class InputMediaDocument(InputMedia): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.DOCUMENT`. media (:obj:`str` | :class:`telegram.InputFile`): File to send. - caption (:obj:`str`): Optional. Caption of the document to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - disable_content_type_detection (:obj:`bool`): Optional. Disables automatic server-side - content type detection for files uploaded using multipart/form-data. Always - :obj:`True`, if the document is sent as part of an album. thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase| .. versionadded:: 20.2 diff --git a/src/telegram/_files/inputprofilephoto.py b/src/telegram/_files/inputprofilephoto.py index 130d061020f..f8d12b63d7a 100644 --- a/src/telegram/_files/inputprofilephoto.py +++ b/src/telegram/_files/inputprofilephoto.py @@ -42,10 +42,6 @@ class InputProfilePhoto(TelegramObject): Args: type (:obj:`str`): Type of the profile photo. - - Attributes: - type (:obj:`str`): Type of the profile photo. - """ STATIC = constants.InputProfilePhotoType.STATIC diff --git a/src/telegram/_files/inputsticker.py b/src/telegram/_files/inputsticker.py index 38fafc4de3d..2081d4bb526 100644 --- a/src/telegram/_files/inputsticker.py +++ b/src/telegram/_files/inputsticker.py @@ -68,26 +68,6 @@ class InputSticker(TelegramObject): Attributes: sticker (:obj:`str` | :class:`telegram.InputFile`): The added sticker. - emoji_list (tuple[:obj:`str`]): Tuple of - :tg-const:`telegram.constants.StickerLimit.MIN_STICKER_EMOJI` - - :tg-const:`telegram.constants.StickerLimit.MAX_STICKER_EMOJI` emoji associated with the - sticker. - mask_position (:class:`telegram.MaskPosition`): Optional. Position where the mask should be - placed on faces. For ":tg-const:`telegram.constants.StickerType.MASK`" stickers only. - keywords (tuple[:obj:`str`]): Optional. Tuple of - 0-:tg-const:`telegram.constants.StickerLimit.MAX_SEARCH_KEYWORDS` search keywords - for the sticker with the total length of up to - :tg-const:`telegram.constants.StickerLimit.MAX_KEYWORD_LENGTH` characters. For - ":tg-const:`telegram.constants.StickerType.REGULAR`" and - ":tg-const:`telegram.constants.StickerType.CUSTOM_EMOJI`" stickers only. - ":tg-const:`telegram.constants.StickerType.CUSTOM_EMOJI`" stickers only. - format (:obj:`str`): Format of the added sticker, must be one of - :tg-const:`telegram.constants.StickerFormat.STATIC` for a - ``.WEBP`` or ``.PNG`` image, :tg-const:`telegram.constants.StickerFormat.ANIMATED` - for a ``.TGS`` animation, :tg-const:`telegram.constants.StickerFormat.VIDEO` for a - ``.WEBM`` video. - - .. versionadded:: 21.1 """ __slots__ = ("emoji_list", "format", "keywords", "mask_position", "sticker") diff --git a/src/telegram/_files/inputstorycontent.py b/src/telegram/_files/inputstorycontent.py index d9edd2dfdbf..4cb0cc527b7 100644 --- a/src/telegram/_files/inputstorycontent.py +++ b/src/telegram/_files/inputstorycontent.py @@ -40,9 +40,6 @@ class InputStoryContent(TelegramObject): Args: type (:obj:`str`): Type of the content. - - Attributes: - type (:obj:`str`): Type of the content. """ __slots__ = ("type",) @@ -127,7 +124,7 @@ class InputStoryContentVideo(InputStoryContent): cover_frame_timestamp (:class:`datetime.timedelta` | :obj:`int` | :obj:`float`, optional): Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to ``0.0``. - is_animation (:obj:`bool`, optional): Pass :obj:`True` if the video has no sound + is_animation (:obj:`bool`, optional): :obj:`True`, if the video has no sound. Attributes: type (:obj:`str`): Type of the content, must be :attr:`~telegram.InputStoryContent.VIDEO`. @@ -141,7 +138,6 @@ class InputStoryContentVideo(InputStoryContent): 0-:tg-const:`telegram.constants.InputStoryContentLimit.MAX_VIDEO_DURATION` cover_frame_timestamp (:class:`datetime.timedelta`): Optional. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to ``0.0``. - is_animation (:obj:`bool`): Optional. Pass :obj:`True` if the video has no sound """ __slots__ = ("cover_frame_timestamp", "duration", "is_animation", "video") diff --git a/src/telegram/_files/location.py b/src/telegram/_files/location.py index 14e1b7afc0c..8d173045af4 100644 --- a/src/telegram/_files/location.py +++ b/src/telegram/_files/location.py @@ -52,22 +52,12 @@ class Location(TelegramObject): approaching another chat member, in meters. For sent live locations only. Attributes: - longitude (:obj:`float`): Longitude as defined by the sender. - latitude (:obj:`float`): Latitude as defined by the sender. - horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, - measured in meters; 0-:tg-const:`telegram.Location.HORIZONTAL_ACCURACY`. live_period (:obj:`int` | :class:`datetime.timedelta`): Optional. Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only. .. deprecated:: v22.2 |time-period-int-deprecated| - heading (:obj:`int`): Optional. The direction in which user is moving, in degrees; - :tg-const:`telegram.Location.MIN_HEADING`-:tg-const:`telegram.Location.MAX_HEADING`. - For active live locations only. - proximity_alert_radius (:obj:`int`): Optional. Maximum distance for proximity alerts about - approaching another chat member, in meters. For sent live locations only. - """ __slots__ = ( diff --git a/src/telegram/_files/photosize.py b/src/telegram/_files/photosize.py index 95481031b09..079ce069495 100644 --- a/src/telegram/_files/photosize.py +++ b/src/telegram/_files/photosize.py @@ -37,18 +37,6 @@ class PhotoSize(_BaseMedium): width (:obj:`int`): Photo width. height (:obj:`int`): Photo height. file_size (:obj:`int`, optional): File size in bytes. - - Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Photo width. - height (:obj:`int`): Photo height. - file_size (:obj:`int`): Optional. File size in bytes. - - """ __slots__ = ("height", "width") diff --git a/src/telegram/_files/sticker.py b/src/telegram/_files/sticker.py index 9ab6bd09aa5..4468600bb2a 100644 --- a/src/telegram/_files/sticker.py +++ b/src/telegram/_files/sticker.py @@ -87,47 +87,6 @@ class Sticker(_BaseThumbedMedium): a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places. - .. versionadded:: 20.2 - - Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Sticker width. - height (:obj:`int`): Sticker height. - is_animated (:obj:`bool`): :obj:`True`, if the sticker is animated. - is_video (:obj:`bool`): :obj:`True`, if the sticker is a video sticker. - - .. versionadded:: 13.11 - type (:obj:`str`): Type of the sticker. Currently one of :attr:`REGULAR`, - :attr:`MASK`, :attr:`CUSTOM_EMOJI`. The type of the sticker is independent from its - format, which is determined by the fields :attr:`is_animated` and :attr:`is_video`. - - .. versionadded:: 20.0 - emoji (:obj:`str`): Optional. Emoji associated with the sticker. - set_name (:obj:`str`): Optional. Name of the sticker set to which the sticker belongs. - mask_position (:class:`telegram.MaskPosition`): Optional. For mask stickers, the position - where the mask should be placed. - file_size (:obj:`int`): Optional. File size in bytes. - - premium_animation (:class:`telegram.File`): Optional. For premium regular stickers, - premium animation for the sticker. - - .. versionadded:: 20.0 - custom_emoji_id (:obj:`str`): Optional. For custom emoji stickers, unique identifier of the - custom emoji. - - .. versionadded:: 20.0 - thumbnail (:class:`telegram.PhotoSize`): Optional. Sticker thumbnail in the ``.WEBP`` or - ``.JPG`` format. - - .. versionadded:: 20.2 - needs_repainting (:obj:`bool`): Optional. :obj:`True`, if the sticker must be repainted to - a text color in messages, the color of the Telegram Premium badge in emoji status, - white color on chat photos, or another appropriate color in other places. - .. versionadded:: 20.2 """ @@ -226,14 +185,13 @@ class StickerSet(TelegramObject): .. versionchanged:: 20.0 The parameter ``contains_masks`` has been removed. Use :paramref:`sticker_type` instead. + .. versionchanged:: 20.5 + |removed_thumb_note| .. versionchanged:: 21.1 The parameters ``is_video`` and ``is_animated`` are deprecated and now made optional. Thus, the order of the arguments had to be changed. - .. versionchanged:: 20.5 - |removed_thumb_note| - .. versionremoved:: 21.2 Removed the deprecated arguments and attributes ``is_animated`` and ``is_video``. @@ -241,10 +199,6 @@ class StickerSet(TelegramObject): name (:obj:`str`): Sticker set name. title (:obj:`str`): Sticker set title. stickers (Sequence[:class:`telegram.Sticker`]): List of all set stickers. - - .. versionchanged:: 20.0 - |sequenceclassargs| - sticker_type (:obj:`str`): Type of stickers in the set, currently one of :attr:`telegram.Sticker.REGULAR`, :attr:`telegram.Sticker.MASK`, :attr:`telegram.Sticker.CUSTOM_EMOJI`. @@ -253,24 +207,6 @@ class StickerSet(TelegramObject): thumbnail (:class:`telegram.PhotoSize`, optional): Sticker set thumbnail in the ``.WEBP``, ``.TGS``, or ``.WEBM`` format. - .. versionadded:: 20.2 - - Attributes: - name (:obj:`str`): Sticker set name. - title (:obj:`str`): Sticker set title. - stickers (tuple[:class:`telegram.Sticker`]): List of all set stickers. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - sticker_type (:obj:`str`): Type of stickers in the set, currently one of - :attr:`telegram.Sticker.REGULAR`, :attr:`telegram.Sticker.MASK`, - :attr:`telegram.Sticker.CUSTOM_EMOJI`. - - .. versionadded:: 20.0 - thumbnail (:class:`telegram.PhotoSize`): Optional. Sticker set thumbnail in the ``.WEBP``, - ``.TGS``, or ``.WEBM`` format. - .. versionadded:: 20.2 """ @@ -338,18 +274,6 @@ class MaskPosition(TelegramObject): size, from top to bottom. For example, ``1.0`` will place the mask just below the default mask position. scale (:obj:`float`): Mask scaling coefficient. For example, ``2.0`` means double size. - - Attributes: - point (:obj:`str`): The part of the face relative to which the mask should be placed. - One of :attr:`FOREHEAD`, :attr:`EYES`, :attr:`MOUTH`, or :attr:`CHIN`. - x_shift (:obj:`float`): Shift by X-axis measured in widths of the mask scaled to the face - size, from left to right. For example, choosing ``-1.0`` will place mask just to the - left of the default mask position. - y_shift (:obj:`float`): Shift by Y-axis measured in heights of the mask scaled to the face - size, from top to bottom. For example, ``1.0`` will place the mask just below the - default mask position. - scale (:obj:`float`): Mask scaling coefficient. For example, ``2.0`` means double size. - """ __slots__ = ("point", "scale", "x_shift", "y_shift") diff --git a/src/telegram/_files/venue.py b/src/telegram/_files/venue.py index 3594e91e10a..bdb675e6a2b 100644 --- a/src/telegram/_files/venue.py +++ b/src/telegram/_files/venue.py @@ -50,19 +50,6 @@ class Venue(TelegramObject): google_place_type (:obj:`str`, optional): Google Places type of the venue. (See `supported types `_.) - - Attributes: - location (:class:`telegram.Location`): Venue location. - title (:obj:`str`): Name of the venue. - address (:obj:`str`): Address of the venue. - foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue. - foursquare_type (:obj:`str`): Optional. Foursquare type of the venue. (For example, - "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) - google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. - google_place_type (:obj:`str`): Optional. Google Places type of the venue. (See - `supported types `_.) - """ __slots__ = ( diff --git a/src/telegram/_files/video.py b/src/telegram/_files/video.py index eeb2fb584b8..4756066b07e 100644 --- a/src/telegram/_files/video.py +++ b/src/telegram/_files/video.py @@ -77,38 +77,17 @@ class Video(_BaseThumbedMedium): .. versionadded:: 22.7 Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Video width as defined by the sender. - height (:obj:`int`): Video height as defined by the sender. duration (:obj:`int` | :class:`datetime.timedelta`): Duration of the video in seconds as defined by the sender. .. deprecated:: v22.2 |time-period-int-deprecated| - file_name (:obj:`str`): Optional. Original filename as defined by the sender. - mime_type (:obj:`str`): Optional. MIME type of a file as defined by the sender. - file_size (:obj:`int`): Optional. File size in bytes. - thumbnail (:class:`telegram.PhotoSize`): Optional. Video thumbnail. - - .. versionadded:: 20.2 - cover (tuple[:class:`telegram.PhotoSize`]): Optional, Available sizes of the cover of - the video in the message. - - .. versionadded:: 21.11 start_timestamp (:obj:`int` | :class:`datetime.timedelta`): Optional. Timestamp in seconds from which the video will play in the message .. versionadded:: 21.11 .. deprecated:: v22.2 |time-period-int-deprecated| - qualities (tuple[:class:`telegram.VideoQuality`]): Optional. List of available qualities - of the video - - .. versionadded:: 22.7 """ __slots__ = ( diff --git a/src/telegram/_files/videonote.py b/src/telegram/_files/videonote.py index edd4edc5d2b..e40d57e2a77 100644 --- a/src/telegram/_files/videonote.py +++ b/src/telegram/_files/videonote.py @@ -55,23 +55,11 @@ class VideoNote(_BaseThumbedMedium): .. versionadded:: 20.2 Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - length (:obj:`int`): Video width and height (diameter of the video message) as defined - by sender. duration (:obj:`int` | :class:`datetime.timedelta`): Duration of the video in seconds as defined by the sender. .. deprecated:: v22.2 |time-period-int-deprecated| - file_size (:obj:`int`): Optional. File size in bytes. - thumbnail (:class:`telegram.PhotoSize`): Optional. Video thumbnail. - - .. versionadded:: 20.2 - """ __slots__ = ("_duration", "length") diff --git a/src/telegram/_files/videoquality.py b/src/telegram/_files/videoquality.py index 1a0a0c6fc38..61d7cff490e 100644 --- a/src/telegram/_files/videoquality.py +++ b/src/telegram/_files/videoquality.py @@ -41,19 +41,6 @@ class VideoQuality(_BaseMedium): codec (:obj:`str`): Codec that was used to encode the video, for example, ``h264``, ``h265``, or ``av01`` file_size (:obj:`int`, optional): File size in bytes. - - Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used - to download or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Video width. - height (:obj:`int`): Video height. - codec (:obj:`str`): Codec that was used to encode the video, - for example, ``h264``, ``h265``, or ``av01`` - file_size (:obj:`int`): Optional. File size in bytes. - """ __slots__ = ("codec", "height", "width") diff --git a/src/telegram/_files/voice.py b/src/telegram/_files/voice.py index fb7691fe2df..b90fd4aee71 100644 --- a/src/telegram/_files/voice.py +++ b/src/telegram/_files/voice.py @@ -47,19 +47,11 @@ class Voice(_BaseMedium): file_size (:obj:`int`, optional): File size in bytes. Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. duration (:obj:`int` | :class:`datetime.timedelta`): Duration of the audio in seconds as defined by the sender. .. deprecated:: v22.2 |time-period-int-deprecated| - mime_type (:obj:`str`): Optional. MIME type of the file as defined by the sender. - file_size (:obj:`int`): Optional. File size in bytes. - """ __slots__ = ("_duration", "mime_type") diff --git a/src/telegram/_forcereply.py b/src/telegram/_forcereply.py index bf69c93aa43..4c100f8c858 100644 --- a/src/telegram/_forcereply.py +++ b/src/telegram/_forcereply.py @@ -60,20 +60,6 @@ class ForceReply(TelegramObject): Attributes: force_reply (:obj:`True`): Shows reply interface to the user, as if they manually selected the bots message and tapped 'Reply'. - selective (:obj:`bool`): Optional. Force reply from specific users only. Targets: - - 1) Users that are @mentioned in the :attr:`~telegram.Message.text` of the - :class:`telegram.Message` object. - 2) If the bot's message is a reply to a message in the same chat and forum topic, - sender of the original message. - input_field_placeholder (:obj:`str`): Optional. The placeholder to be shown in the input - field when the reply is active; - :tg-const:`telegram.ForceReply.MIN_INPUT_FIELD_PLACEHOLDER`- - :tg-const:`telegram.ForceReply.MAX_INPUT_FIELD_PLACEHOLDER` - characters. - - .. versionadded:: 13.7 - """ __slots__ = ("force_reply", "input_field_placeholder", "selective") diff --git a/src/telegram/_forumtopic.py b/src/telegram/_forumtopic.py index 51c6d8df71f..02ce07e0ee3 100644 --- a/src/telegram/_forumtopic.py +++ b/src/telegram/_forumtopic.py @@ -41,17 +41,6 @@ class ForumTopic(TelegramObject): is_name_implicit (:obj:`bool`, optional): :obj:`True`, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot. - .. versionadded:: 22.6 - - Attributes: - message_thread_id (:obj:`int`): Unique identifier of the forum topic - name (:obj:`str`): Name of the topic - icon_color (:obj:`int`): Color of the topic icon in RGB format - icon_custom_emoji_id (:obj:`str`): Optional. Unique identifier of the custom emoji shown - as the topic icon. - is_name_implicit (:obj:`bool`): Optional. :obj:`True`, if the name of the topic wasn't - specified explicitly by its creator and likely needs to be changed by the bot. - .. versionadded:: 22.6 """ @@ -103,16 +92,6 @@ class ForumTopicCreated(TelegramObject): is_name_implicit (:obj:`bool`, optional): :obj:`True`, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot. - .. versionadded:: 22.6 - - Attributes: - name (:obj:`str`): Name of the topic - icon_color (:obj:`int`): Color of the topic icon in RGB format - icon_custom_emoji_id (:obj:`str`): Optional. Unique identifier of the custom emoji shown - as the topic icon. - is_name_implicit (:obj:`bool`): Optional. :obj:`True`, if the name of the topic wasn't - specified explicitly by its creator and likely needs to be changed by the bot. - .. versionadded:: 22.6 """ @@ -183,11 +162,6 @@ class ForumTopicEdited(TelegramObject): name (:obj:`str`, optional): New name of the topic, if it was edited. icon_custom_emoji_id (:obj:`str`, optional): New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed. - - Attributes: - name (:obj:`str`): Optional. New name of the topic, if it was edited. - icon_custom_emoji_id (:obj:`str`): Optional. New identifier of the custom emoji shown as - the topic icon, if it was edited; an empty string if the icon was removed. """ __slots__ = ("icon_custom_emoji_id", "name") diff --git a/src/telegram/_games/game.py b/src/telegram/_games/game.py index 898838e8b97..6c6ea35356e 100644 --- a/src/telegram/_games/game.py +++ b/src/telegram/_games/game.py @@ -46,10 +46,6 @@ class Game(TelegramObject): description (:obj:`str`): Description of the game. photo (Sequence[:class:`telegram.PhotoSize`]): Photo that will be displayed in the game message in chats. - - .. versionchanged:: 20.0 - |sequenceclassargs| - text (:obj:`str`, optional): Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls :meth:`telegram.Bot.set_game_score`, or manually edited @@ -57,37 +53,8 @@ class Game(TelegramObject): 0-:tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters. text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities that appear in text, such as usernames, URLs, bot commands, etc. - - .. versionchanged:: 20.0 - |sequenceclassargs| - animation (:class:`telegram.Animation`, optional): Animation that will be displayed in the game message in chats. Upload via `BotFather `_. - - Attributes: - title (:obj:`str`): Title of the game. - description (:obj:`str`): Description of the game. - photo (tuple[:class:`telegram.PhotoSize`]): Photo that will be displayed in the game - message in chats. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - text (:obj:`str`): Optional. Brief description of the game or high scores included in the - game message. Can be automatically edited to include current high scores for the game - when the bot calls :meth:`telegram.Bot.set_game_score`, or manually edited - using :meth:`telegram.Bot.edit_message_text`. - 0-:tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters. - text_entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special entities that - appear in text, such as usernames, URLs, bot commands, etc. - This tuple is empty if the message does not contain text entities. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - animation (:class:`telegram.Animation`): Optional. Animation that will be displayed in the - game message in chats. Upload via `BotFather `_. - """ __slots__ = ( diff --git a/src/telegram/_games/gamehighscore.py b/src/telegram/_games/gamehighscore.py index 482a61c9659..48d8ca89239 100644 --- a/src/telegram/_games/gamehighscore.py +++ b/src/telegram/_games/gamehighscore.py @@ -39,12 +39,6 @@ class GameHighScore(TelegramObject): position (:obj:`int`): Position in high score table for the game. user (:class:`telegram.User`): User. score (:obj:`int`): Score. - - Attributes: - position (:obj:`int`): Position in high score table for the game. - user (:class:`telegram.User`): User. - score (:obj:`int`): Score. - """ __slots__ = ("position", "score", "user") diff --git a/src/telegram/_gifts.py b/src/telegram/_gifts.py index 84a9bad7100..61a3aa1f19a 100644 --- a/src/telegram/_gifts.py +++ b/src/telegram/_gifts.py @@ -47,12 +47,6 @@ class GiftBackground(TelegramObject): center_color (:obj:`int`): Center color of the background in RGB format. edge_color (:obj:`int`): Edge color of the background in RGB format. text_color (:obj:`int`): Text color of the background in RGB format. - - Attributes: - center_color (:obj:`int`): Center color of the background in RGB format. - edge_color (:obj:`int`): Edge color of the background in RGB format. - text_color (:obj:`int`): Text color of the background in RGB format. - """ __slots__ = ( @@ -131,48 +125,6 @@ class Gift(TelegramObject): gifts that can be obtained by upgrading the gift. .. versionadded:: 22.6 - - Attributes: - id (:obj:`str`): Unique identifier of the gift. - sticker (:class:`~telegram.Sticker`): The sticker that represents the gift. - star_count (:obj:`int`): The number of Telegram Stars that must be paid to send the - sticker. - total_count (:obj:`int`): Optional. The total number of the gifts of this type that can be - sent by all users; for limited gifts only. - remaining_count (:obj:`int`): Optional. The number of remaining gifts of this type that can - be sent by all users; for limited gifts only. - upgrade_star_count (:obj:`int`): Optional. The number of Telegram Stars that must be paid - to upgrade the gift to a unique one. - - .. versionadded:: 21.10 - publisher_chat (:class:`telegram.Chat`): Optional. Information about the chat that - published the gift. - - .. versionadded:: 22.4 - personal_total_count (:obj:`int`): Optional. The total number of gifts of this type that - can be sent by the bot; for limited gifts only. - - .. versionadded:: 22.6 - personal_remaining_count (:obj:`int`): Optional. The number of remaining gifts of this type - that can be sent by the bot; for limited gifts only. - - .. versionadded:: 22.6 - background (:class:`GiftBackground`): Optional. Background of the gift. - - .. versionadded:: 22.6 - is_premium (:obj:`bool`): Optional. :obj:`True`, if the gift can only be purchased by - Telegram Premium subscribers. - - .. versionadded:: 22.6 - has_colors (:obj:`bool`): Optional. :obj:`True`, if the gift can be used (after being - upgraded) to customize a user's appearance. - - .. versionadded:: 22.6 - unique_gift_variant_count (:obj:`int`): Optional. The total number of different unique - gifts that can be obtained by upgrading the gift. - - .. versionadded:: 22.6 - """ __slots__ = ( @@ -249,10 +201,6 @@ class Gifts(TelegramObject): Args: gifts (Sequence[:class:`Gift`]): The sequence of gifts. - - Attributes: - gifts (tuple[:class:`Gift`]): The sequence of gifts. - """ __slots__ = ("gifts",) @@ -291,7 +239,7 @@ class GiftInfo(TelegramObject): gift (:class:`Gift`): Information about the gift. owned_gift_id (:obj:`str`, optional): Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts. - convert_star_count (:obj:`int`, optional) Number of Telegram Stars that can be claimed by + convert_star_count (:obj:`int`, optional): Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible. prepaid_upgrade_star_count (:obj:`int`, optional): Number of Telegram Stars that were @@ -311,32 +259,6 @@ class GiftInfo(TelegramObject): upgraded. See the number field in :class:`~telegram.UniqueGift`. .. versionadded:: 22.6 - - Attributes: - gift (:class:`Gift`): Information about the gift. - owned_gift_id (:obj:`str`): Optional. Unique identifier of the received gift for the bot; - only present for gifts received on behalf of business accounts. - convert_star_count (:obj:`int`): Optional. Number of Telegram Stars that can be claimed by - the receiver by converting the gift; omitted if conversion to Telegram Stars - is impossible. - prepaid_upgrade_star_count (:obj:`int`): Optional. Number of Telegram Stars that were - prepaid for the ability to upgrade the gift. - can_be_upgraded (:obj:`bool`): Optional. :obj:`True`, if the gift can be upgraded - to a unique gift. - text (:obj:`str`): Optional. Text of the message that was added to the gift. - entities (Sequence[:class:`telegram.MessageEntity`]): Optional. Special entities that - appear in the text. - is_private (:obj:`bool`): Optional. :obj:`True`, if the sender and gift text are - shown only to the gift receiver; otherwise, everyone will be able to see them. - is_upgrade_separate (:obj:`bool`): Optional. :obj:`True`, if the gift's upgrade was - purchased after the gift was sent. - - .. versionadded:: 22.6 - unique_gift_number (:obj:`int`): Optional. Unique number reserved for this gift when - upgraded. See the number field in :class:`~telegram.UniqueGift`. - - .. versionadded:: 22.6 - """ __slots__ = ( @@ -472,19 +394,6 @@ class AcceptedGiftTypes(TelegramObject): are accepted .. versionadded:: 22.6 - - Attributes: - unlimited_gifts (:class:`bool`): :obj:`True`, if unlimited regular gifts are accepted. - limited_gifts (:class:`bool`): :obj:`True`, if limited regular gifts are accepted. - unique_gifts (:class:`bool`): :obj:`True`, if unique gifts or gifts that can be upgraded - to unique for free are accepted. - premium_subscription (:class:`bool`): :obj:`True`, if a Telegram Premium subscription - is accepted. - gifts_from_channels (:obj:`bool`): :obj:`True`, if transfers of unique gifts from channels - are accepted - - .. versionadded:: 22.6 - """ __slots__ = ( diff --git a/src/telegram/_giveaway.py b/src/telegram/_giveaway.py index 3fe25c40920..dca793e88b0 100644 --- a/src/telegram/_giveaway.py +++ b/src/telegram/_giveaway.py @@ -65,30 +65,6 @@ class Giveaway(TelegramObject): premium_subscription_month_count (:obj:`int`, optional): The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only. - - Attributes: - chats (Sequence[:class:`telegram.Chat`]): The list of chats which the user must join to - participate in the giveaway. - winners_selection_date (:class:`datetime.datetime`): The date when the giveaway winner will - be selected. |datetime_localization| - winner_count (:obj:`int`): The number of users which are supposed to be selected as winners - of the giveaway. - only_new_members (:obj:`True`): Optional. If :obj:`True`, only users who join the chats - after the giveaway started should be eligible to win. - has_public_winners (:obj:`True`): Optional. :obj:`True`, if the list of giveaway winners - will be visible to everyone - prize_description (:obj:`str`): Optional. Description of additional giveaway prize - country_codes (tuple[:obj:`str`]): Optional. A tuple of two-letter ISO 3166-1 alpha-2 - country codes indicating the countries from which eligible users for the giveaway must - come. If empty, then all users can participate in the giveaway. Users with a phone - number that was bought on Fragment can always participate in giveaways. - prize_star_count (:obj:`int`): Optional. The number of Telegram Stars to be split between - giveaway winners; for Telegram Star giveaways only. - - .. versionadded:: 21.6 - premium_subscription_month_count (:obj:`int`): Optional. The number of months the Telegram - Premium subscription won from the giveaway will be active for; for Telegram Premium - giveaways only. """ __slots__ = ( @@ -161,13 +137,6 @@ class GiveawayCreated(TelegramObject): split between giveaway winners; for Telegram Star giveaways only. .. versionadded:: 21.6 - - Attributes: - prize_star_count (:obj:`int`): Optional. The number of Telegram Stars to be - split between giveaway winners; for Telegram Star giveaways only. - - .. versionadded:: 21.6 - """ __slots__ = ("prize_star_count",) @@ -210,29 +179,6 @@ class GiveawayWinners(TelegramObject): was_refunded (:obj:`True`, optional): :obj:`True`, if the giveaway was canceled because the payment for it was refunded prize_description (:obj:`str`, optional): Description of additional giveaway prize - - Attributes: - chat (:class:`telegram.Chat`): The chat that created the giveaway - giveaway_message_id (:obj:`int`): Identifier of the message with the giveaway in the chat - winners_selection_date (:class:`datetime.datetime`): Point in time when winners of the - giveaway were selected. |datetime_localization| - winner_count (:obj:`int`): Total number of winners in the giveaway - winners (tuple[:class:`telegram.User`]): tuple of up to - :tg-const:`telegram.constants.GiveawayLimit.MAX_WINNERS` winners of the giveaway - additional_chat_count (:obj:`int`): Optional. The number of other chats the user had to - join in order to be eligible for the giveaway - prize_star_count (:obj:`int`): Optional. The number of Telegram Stars to be split between - giveaway winners; for Telegram Star giveaways only. - - .. versionadded:: 21.6 - premium_subscription_month_count (:obj:`int`): Optional. The number of months the Telegram - Premium subscription won from the giveaway will be active for - unclaimed_prize_count (:obj:`int`): Optional. Number of undistributed prizes - only_new_members (:obj:`True`): Optional. :obj:`True`, if only users who had joined the - chats after the giveaway started were eligible to win - was_refunded (:obj:`True`): Optional. :obj:`True`, if the giveaway was canceled because the - payment for it was refunded - prize_description (:obj:`str`): Optional. Description of additional giveaway prize """ __slots__ = ( @@ -318,7 +264,6 @@ class GiveawayCompleted(TelegramObject): .. versionadded:: 20.8 - Args: winner_count (:obj:`int`): Number of winners in the giveaway unclaimed_prize_count (:obj:`int`, optional): Number of undistributed prizes @@ -327,15 +272,6 @@ class GiveawayCompleted(TelegramObject): is_star_giveaway (:obj:`bool`, optional): :obj:`True`, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. - .. versionadded:: 21.6 - Attributes: - winner_count (:obj:`int`): Number of winners in the giveaway - unclaimed_prize_count (:obj:`int`): Optional. Number of undistributed prizes - giveaway_message (:class:`telegram.Message`): Optional. Message with the giveaway that was - completed, if it wasn't deleted - is_star_giveaway (:obj:`bool`): Optional. :obj:`True`, if the giveaway is a Telegram Star - giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. - .. versionadded:: 21.6 """ diff --git a/src/telegram/_inline/inlinekeyboardbutton.py b/src/telegram/_inline/inlinekeyboardbutton.py index 7915ac0aa8e..1e329c9988f 100644 --- a/src/telegram/_inline/inlinekeyboardbutton.py +++ b/src/telegram/_inline/inlinekeyboardbutton.py @@ -181,94 +181,10 @@ class InlineKeyboardButton(TelegramObject): .. versionadded:: 22.7 Attributes: - text (:obj:`str`): Label text on the button. - url (:obj:`str`): Optional. HTTP or tg:// url to be opened when the button is pressed. - Links ``tg://user?id=`` can be used to mention a user by - their ID without using a username, if this is allowed by their privacy settings. - - .. versionchanged:: 13.9 - You can now mention a user using ``tg://user?id=``. - login_url (:class:`telegram.LoginUrl`): Optional. An ``HTTPS`` URL used to automatically - authorize the user. Can be used as a replacement for the Telegram Login Widget. - - Caution: - Only ``HTTPS`` links are allowed after Bot API 6.1. callback_data (:obj:`str` | :obj:`object`): Optional. Data to be sent in a callback query to the bot when the button is pressed, UTF-8 :tg-const:`telegram.InlineKeyboardButton.MIN_CALLBACK_DATA`- :tg-const:`telegram.InlineKeyboardButton.MAX_CALLBACK_DATA` bytes. - web_app (:class:`telegram.WebAppInfo`): Optional. Description of the `Web App - `_ that will be launched when the user presses - the button. The Web App will be able to send an arbitrary message on behalf of the user - using the method :meth:`~telegram.Bot.answer_web_app_query`. Available only in - private chats between a user and the bot. Not supported for messages sent on behalf of - a Telegram Business account. - - .. versionadded:: 20.0 - switch_inline_query (:obj:`str`): Optional. If set, pressing the button will prompt the - user to select one of their chats, open that chat and insert the bot's username and the - specified inline query in the input field. May be empty, in which case just the bot's - username will be inserted. Not supported for messages sent on behalf of a Telegram - Business account. - - Tip: - This is similar to the parameter :paramref:`switch_inline_query_chosen_chat`, - but gives no control over which chats can be selected. - switch_inline_query_current_chat (:obj:`str`): Optional. If set, pressing the button will - insert the bot's username and the specified inline query in the current chat's input - field. May be empty, in which case only the bot's username will be inserted. - - This offers a quick way for the user to open your bot in inline mode in the same chat - - good for selecting something from multiple options. Not supported in channels and for - messages sent on behalf of a Telegram Business account. - copy_text (:class:`telegram.CopyTextButton`): Optional. Description of the button that - copies the specified text to the clipboard. - - .. versionadded:: 21.7 - style (:obj:`str`): Optional. Style of the button. Must be one of - :tg-const:`telegram.constants.KeyboardButtonStyle.PRIMARY` (blue), - :tg-const:`telegram.constants.KeyboardButtonStyle.SUCCESS` (green), and - :tg-const:`telegram.constants.KeyboardButtonStyle.DANGER` (red). - Color name aliases :tg-const:`telegram.constants.KeyboardButtonStyle.BLUE`, - :tg-const:`telegram.constants.KeyboardButtonStyle.GREEN`, and - :tg-const:`telegram.constants.KeyboardButtonStyle.RED` are also available. - If omitted, then an app-specific style is used. - - .. versionadded:: 22.7 - callback_game (:class:`telegram.CallbackGame`): Optional. Description of the game that will - be launched when the user presses the button. - - Note: - This type of button **must** always be the first button in the first row. - pay (:obj:`bool`): Optional. Specify :obj:`True`, to send a Pay button. - Substrings ``“⭐️”`` and ``“XTR”`` in the buttons's text will be replaced with a - Telegram Star icon. - - Note: - This type of button **must** always be the first button in the first row and can - only be used in invoice messages. - switch_inline_query_chosen_chat (:class:`telegram.SwitchInlineQueryChosenChat`): Optional. - If set, pressing the button will prompt the user to select one of their chats of the - specified type, open that chat and insert the bot's username and the specified inline - query in the input field. Not supported for messages sent on behalf of a Telegram - Business account. - - .. versionadded:: 20.3 - - Tip: - This is similar to :attr:`switch_inline_query`, but gives more control on - which chats can be selected. - - Caution: - The PTB team has discovered that this field works correctly only if your Telegram - client is released after April 20th 2023. - icon_custom_emoji_id (:obj:`str`): Optional. Unique identifier of the custom emoji shown - before the text of the button. Can only be used by bots that purchased additional - usernames on `Fragment `_ or in the messages directly sent by - the bot to private, group and supergroup chats if the owner of the bot has a Telegram - Premium subscription. - - .. versionadded:: 22.7 """ __slots__ = ( diff --git a/src/telegram/_inline/inlinekeyboardmarkup.py b/src/telegram/_inline/inlinekeyboardmarkup.py index 37040bc9ec5..1fec9003537 100644 --- a/src/telegram/_inline/inlinekeyboardmarkup.py +++ b/src/telegram/_inline/inlinekeyboardmarkup.py @@ -54,18 +54,6 @@ class InlineKeyboardMarkup(TelegramObject): inline_keyboard (Sequence[Sequence[:class:`telegram.InlineKeyboardButton`]]): Sequence of button rows, each represented by a sequence of :class:`~telegram.InlineKeyboardButton` objects. - - .. versionchanged:: 20.0 - |sequenceclassargs| - - Attributes: - inline_keyboard (tuple[tuple[:class:`telegram.InlineKeyboardButton`]]): Tuple of - button rows, each represented by a tuple of :class:`~telegram.InlineKeyboardButton` - objects. - - .. versionchanged:: 20.0 - |tupleclassattrs| - """ __slots__ = ("inline_keyboard",) diff --git a/src/telegram/_inline/inlinequery.py b/src/telegram/_inline/inlinequery.py index 48ff6162f17..bf28b415e12 100644 --- a/src/telegram/_inline/inlinequery.py +++ b/src/telegram/_inline/inlinequery.py @@ -84,24 +84,6 @@ class InlineQuery(TelegramObject): .. versionadded:: 13.5 location (:class:`telegram.Location`, optional): Sender location, only for bots that request user location. - - Attributes: - id (:obj:`str`): Unique identifier for this query. - from_user (:class:`telegram.User`): Sender. - query (:obj:`str`): Text of the query (up to - :tg-const:`telegram.InlineQuery.MAX_QUERY_LENGTH` characters). - offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot. - chat_type (:obj:`str`): Optional. Type of the chat, from which the inline query was sent. - Can be either :tg-const:`telegram.Chat.SENDER` for a private chat with the inline query - sender, :tg-const:`telegram.Chat.PRIVATE`, :tg-const:`telegram.Chat.GROUP`, - :tg-const:`telegram.Chat.SUPERGROUP` or :tg-const:`telegram.Chat.CHANNEL`. The chat - type should be always known for requests sent from official clients and most - third-party clients, unless the request was sent from a secret chat. - - .. versionadded:: 13.5 - location (:class:`telegram.Location`): Optional. Sender location, only for bots that - request user location. - """ __slots__ = ("chat_type", "from_user", "id", "location", "offset", "query") diff --git a/src/telegram/_inline/inlinequeryresult.py b/src/telegram/_inline/inlinequeryresult.py index 7e708ebbfe2..da39f539723 100644 --- a/src/telegram/_inline/inlinequeryresult.py +++ b/src/telegram/_inline/inlinequeryresult.py @@ -45,13 +45,6 @@ class InlineQueryResult(TelegramObject): id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - - Attributes: - type (:obj:`str`): Type of the result. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - """ __slots__ = ("id", "type") diff --git a/src/telegram/_inline/inlinequeryresultarticle.py b/src/telegram/_inline/inlinequeryresultarticle.py index cca861b76f7..6b9f376b6a6 100644 --- a/src/telegram/_inline/inlinequeryresultarticle.py +++ b/src/telegram/_inline/inlinequeryresultarticle.py @@ -67,26 +67,7 @@ class InlineQueryResultArticle(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.ARTICLE`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - title (:obj:`str`): Title of the result. - input_message_content (:class:`telegram.InputMessageContent`): Content of the message to - be sent. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. url (:obj:`str`): Optional. URL of the result. - description (:obj:`str`): Optional. Short description of the result. - thumbnail_url (:obj:`str`): Optional. Url of the thumbnail for the result. - - .. versionadded:: 20.2 - thumbnail_width (:obj:`int`): Optional. Thumbnail width. - - .. versionadded:: 20.2 - thumbnail_height (:obj:`int`): Optional. Thumbnail height. - - .. versionadded:: 20.2 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultaudio.py b/src/telegram/_inline/inlinequeryresultaudio.py index 02ce1a1eea1..09bbd287ffe 100644 --- a/src/telegram/_inline/inlinequeryresultaudio.py +++ b/src/telegram/_inline/inlinequeryresultaudio.py @@ -46,7 +46,7 @@ class InlineQueryResultAudio(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. audio_url (:obj:`str`): A valid URL for the audio file. title (:obj:`str`): Title. performer (:obj:`str`, optional): Performer. @@ -60,9 +60,6 @@ class InlineQueryResultAudio(InlineQueryResult): parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the @@ -70,32 +67,11 @@ class InlineQueryResultAudio(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.AUDIO`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - audio_url (:obj:`str`): A valid URL for the audio file. - title (:obj:`str`): Title. - performer (:obj:`str`): Optional. Performer. audio_duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Audio duration in seconds. .. deprecated:: v22.2 |time-period-int-deprecated| - caption (:obj:`str`): Optional. Caption, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities - parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the audio. - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcachedaudio.py b/src/telegram/_inline/inlinequeryresultcachedaudio.py index d925d92d33a..fbe0dcc9dc8 100644 --- a/src/telegram/_inline/inlinequeryresultcachedaudio.py +++ b/src/telegram/_inline/inlinequeryresultcachedaudio.py @@ -44,17 +44,13 @@ class InlineQueryResultCachedAudio(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. audio_file_id (:obj:`str`): A valid file identifier for the audio file. caption (:obj:`str`, optional): Caption, 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the @@ -62,25 +58,6 @@ class InlineQueryResultCachedAudio(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.AUDIO`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - audio_file_id (:obj:`str`): A valid file identifier for the audio file. - caption (:obj:`str`): Optional. Caption, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities - parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the audio. - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcacheddocument.py b/src/telegram/_inline/inlinequeryresultcacheddocument.py index 0f7771ccba7..f755580d5c2 100644 --- a/src/telegram/_inline/inlinequeryresultcacheddocument.py +++ b/src/telegram/_inline/inlinequeryresultcacheddocument.py @@ -44,7 +44,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. title (:obj:`str`): Title for the result. document_file_id (:obj:`str`): A valid file identifier for the file. description (:obj:`str`, optional): Short description of the result. @@ -53,10 +53,6 @@ class InlineQueryResultCachedDocument(InlineQueryResult): after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the @@ -64,27 +60,6 @@ class InlineQueryResultCachedDocument(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.DOCUMENT`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - title (:obj:`str`): Title for the result. - document_file_id (:obj:`str`): A valid file identifier for the file. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the document to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the file. - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcachedgif.py b/src/telegram/_inline/inlinequeryresultcachedgif.py index e9fbd38a37c..7bf6d3e8191 100644 --- a/src/telegram/_inline/inlinequeryresultcachedgif.py +++ b/src/telegram/_inline/inlinequeryresultcachedgif.py @@ -45,7 +45,7 @@ class InlineQueryResultCachedGif(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. gif_file_id (:obj:`str`): A valid file identifier for the GIF file. title (:obj:`str`, optional): Title for the result. caption (:obj:`str`, optional): Caption of the GIF file to be sent, @@ -53,43 +53,16 @@ class InlineQueryResultCachedGif(InlineQueryResult): after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the message to be sent instead of the gif. - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.GIF`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - gif_file_id (:obj:`str`): A valid file identifier for the GIF file. - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the GIF file to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the gif. - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcachedmpeg4gif.py b/src/telegram/_inline/inlinequeryresultcachedmpeg4gif.py index 6832e7febdd..5cf3ed7a33b 100644 --- a/src/telegram/_inline/inlinequeryresultcachedmpeg4gif.py +++ b/src/telegram/_inline/inlinequeryresultcachedmpeg4gif.py @@ -45,7 +45,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file. title (:obj:`str`, optional): Title for the result. caption (:obj:`str`, optional): Caption of the MPEG-4 file to be sent, @@ -53,43 +53,16 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the message to be sent instead of the MPEG-4 file. - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.MPEG4GIF`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file. - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the MPEG-4 file to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the MPEG-4 file. - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcachedphoto.py b/src/telegram/_inline/inlinequeryresultcachedphoto.py index 774fe3257a4..704a3946231 100644 --- a/src/telegram/_inline/inlinequeryresultcachedphoto.py +++ b/src/telegram/_inline/inlinequeryresultcachedphoto.py @@ -45,7 +45,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. photo_file_id (:obj:`str`): A valid file identifier of the photo. title (:obj:`str`, optional): Title for the result. description (:obj:`str`, optional): Short description of the result. @@ -54,44 +54,16 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the message to be sent instead of the photo. - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.PHOTO`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - photo_file_id (:obj:`str`): A valid file identifier of the photo. - title (:obj:`str`): Optional. Title for the result. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the photo to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after - entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the photo. - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcachedsticker.py b/src/telegram/_inline/inlinequeryresultcachedsticker.py index 437a9ceef69..846cebacd6a 100644 --- a/src/telegram/_inline/inlinequeryresultcachedsticker.py +++ b/src/telegram/_inline/inlinequeryresultcachedsticker.py @@ -49,15 +49,6 @@ class InlineQueryResultCachedSticker(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.STICKER`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - sticker_file_id (:obj:`str`): A valid file identifier of the sticker. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the sticker. - """ __slots__ = ("input_message_content", "reply_markup", "sticker_file_id") diff --git a/src/telegram/_inline/inlinequeryresultcachedvideo.py b/src/telegram/_inline/inlinequeryresultcachedvideo.py index 19b602da112..9fd713fa9d7 100644 --- a/src/telegram/_inline/inlinequeryresultcachedvideo.py +++ b/src/telegram/_inline/inlinequeryresultcachedvideo.py @@ -45,7 +45,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. video_file_id (:obj:`str`): A valid file identifier for the video file. title (:obj:`str`): Title for the result. description (:obj:`str`, optional): Short description of the result. @@ -58,36 +58,12 @@ class InlineQueryResultCachedVideo(InlineQueryResult): to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the message to be sent instead of the video. - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.VIDEO`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - video_file_id (:obj:`str`): A valid file identifier for the video file. - title (:obj:`str`): Title for the result. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the video to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after - entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the video. - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcachedvoice.py b/src/telegram/_inline/inlinequeryresultcachedvoice.py index c2114cb8906..855c62d2c3f 100644 --- a/src/telegram/_inline/inlinequeryresultcachedvoice.py +++ b/src/telegram/_inline/inlinequeryresultcachedvoice.py @@ -44,7 +44,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. voice_file_id (:obj:`str`): A valid file identifier for the voice message. title (:obj:`str`): Voice message title. caption (:obj:`str`, optional): Caption, @@ -53,9 +53,6 @@ class InlineQueryResultCachedVoice(InlineQueryResult): parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |captionentitiesattr| - - .. versionchanged:: 20.0 - |sequenceclassargs| reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the @@ -63,26 +60,6 @@ class InlineQueryResultCachedVoice(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.VOICE`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - voice_file_id (:obj:`str`): A valid file identifier for the voice message. - title (:obj:`str`): Voice message title. - caption (:obj:`str`): Optional. Caption, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities - parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |caption_entities| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the voice message. - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultcontact.py b/src/telegram/_inline/inlinequeryresultcontact.py index 53c5670820b..6c9148921ed 100644 --- a/src/telegram/_inline/inlinequeryresultcontact.py +++ b/src/telegram/_inline/inlinequeryresultcontact.py @@ -41,7 +41,7 @@ class InlineQueryResultContact(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. phone_number (:obj:`str`): Contact's phone number. first_name (:obj:`str`): Contact's first name. last_name (:obj:`str`, optional): Contact's last name. @@ -63,28 +63,6 @@ class InlineQueryResultContact(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.CONTACT`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - phone_number (:obj:`str`): Contact's phone number. - first_name (:obj:`str`): Contact's first name. - last_name (:obj:`str`): Optional. Contact's last name. - vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard, - 0-:tg-const:`telegram.constants.ContactLimit.VCARD` bytes. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the contact. - thumbnail_url (:obj:`str`): Optional. Url of the thumbnail for the result. - - .. versionadded:: 20.2 - thumbnail_width (:obj:`int`): Optional. Thumbnail width. - - .. versionadded:: 20.2 - thumbnail_height (:obj:`int`): Optional. Thumbnail height. - - .. versionadded:: 20.2 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultdocument.py b/src/telegram/_inline/inlinequeryresultdocument.py index 1bc2d97a887..399baa432d3 100644 --- a/src/telegram/_inline/inlinequeryresultdocument.py +++ b/src/telegram/_inline/inlinequeryresultdocument.py @@ -48,17 +48,13 @@ class InlineQueryResultDocument(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. title (:obj:`str`): Title for the result. caption (:obj:`str`, optional): Caption of the document to be sent, 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - document_url (:obj:`str`): A valid URL for the file. mime_type (:obj:`str`): Mime type of the content of the file, either "application/pdf" or "application/zip". @@ -80,38 +76,6 @@ class InlineQueryResultDocument(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.DOCUMENT`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - title (:obj:`str`): Title for the result. - caption (:obj:`str`): Optional. Caption of the document to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - document_url (:obj:`str`): A valid URL for the file. - mime_type (:obj:`str`): Mime type of the content of the file, either "application/pdf" - or "application/zip". - description (:obj:`str`): Optional. Short description of the result. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the file. - thumbnail_url (:obj:`str`): Optional. URL of the thumbnail (JPEG only) for the file. - - .. versionadded:: 20.2 - thumbnail_width (:obj:`int`): Optional. Thumbnail width. - - .. versionadded:: 20.2 - thumbnail_height (:obj:`int`): Optional. Thumbnail height. - - .. versionadded:: 20.2 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultgame.py b/src/telegram/_inline/inlinequeryresultgame.py index 579721dcc45..6dba6605dbc 100644 --- a/src/telegram/_inline/inlinequeryresultgame.py +++ b/src/telegram/_inline/inlinequeryresultgame.py @@ -30,20 +30,13 @@ class InlineQueryResultGame(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. game_short_name (:obj:`str`): Short name of the game. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.GAME`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - game_short_name (:obj:`str`): Short name of the game. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - """ __slots__ = ("game_short_name", "reply_markup") diff --git a/src/telegram/_inline/inlinequeryresultgif.py b/src/telegram/_inline/inlinequeryresultgif.py index 67d4cdf23e5..5f7b804028c 100644 --- a/src/telegram/_inline/inlinequeryresultgif.py +++ b/src/telegram/_inline/inlinequeryresultgif.py @@ -49,7 +49,7 @@ class InlineQueryResultGif(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. gif_url (:obj:`str`): A valid URL for the GIF file. gif_width (:obj:`int`, optional): Width of the GIF. gif_height (:obj:`int`, optional): Height of the GIF. @@ -76,26 +76,16 @@ class InlineQueryResultGif(InlineQueryResult): after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the message to be sent instead of the GIF animation. - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.GIF`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - gif_url (:obj:`str`): A valid URL for the GIF file. - gif_width (:obj:`int`): Optional. Width of the GIF. - gif_height (:obj:`int`): Optional. Height of the GIF. gif_duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Duration of the GIF in seconds. @@ -105,29 +95,6 @@ class InlineQueryResultGif(InlineQueryResult): for the result. .. versionadded:: 20.2 - thumbnail_mime_type (:obj:`str`): Optional. MIME type of the thumbnail, must be one of - ``'image/jpeg'``, ``'image/gif'``, or ``'video/mp4'``. Defaults to ``'image/jpeg'``. - - .. versionadded:: 20.2 - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the GIF file to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the GIF animation. - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultlocation.py b/src/telegram/_inline/inlinequeryresultlocation.py index c4ce7db7346..b45310c9c80 100644 --- a/src/telegram/_inline/inlinequeryresultlocation.py +++ b/src/telegram/_inline/inlinequeryresultlocation.py @@ -44,7 +44,7 @@ class InlineQueryResultLocation(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. latitude (:obj:`float`): Location latitude in degrees. longitude (:obj:`float`): Location longitude in degrees. title (:obj:`str`): Location title. @@ -83,15 +83,6 @@ class InlineQueryResultLocation(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.LOCATION`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - latitude (:obj:`float`): Location latitude in degrees. - longitude (:obj:`float`): Location longitude in degrees. - title (:obj:`str`): Location title. - horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, - measured in meters; 0- - :tg-const:`telegram.InlineQueryResultLocation.HORIZONTAL_ACCURACY`. live_period (:obj:`int` | :class:`datetime.timedelta`): Optional. Period in seconds for which the location will be updated, should be between :tg-const:`telegram.InlineQueryResultLocation.MIN_LIVE_PERIOD` and @@ -101,29 +92,6 @@ class InlineQueryResultLocation(InlineQueryResult): .. deprecated:: v22.2 |time-period-int-deprecated| - heading (:obj:`int`): Optional. For live locations, a direction in which the user is - moving, in degrees. Must be between - :tg-const:`telegram.InlineQueryResultLocation.MIN_HEADING` and - :tg-const:`telegram.InlineQueryResultLocation.MAX_HEADING` if specified. - proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance - for proximity alerts about approaching another chat member, in meters. Must be - between :tg-const:`telegram.InlineQueryResultLocation.MIN_PROXIMITY_ALERT_RADIUS` - and :tg-const:`telegram.InlineQueryResultLocation.MAX_PROXIMITY_ALERT_RADIUS` - if specified. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the location. - thumbnail_url (:obj:`str`): Optional. Url of the thumbnail for the result. - - .. versionadded:: 20.2 - thumbnail_width (:obj:`int`): Optional. Thumbnail width. - - .. versionadded:: 20.2 - thumbnail_height (:obj:`int`): Optional. Thumbnail height. - - .. versionadded:: 20.2 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultmpeg4gif.py b/src/telegram/_inline/inlinequeryresultmpeg4gif.py index 817eda536d7..572a00c50c1 100644 --- a/src/telegram/_inline/inlinequeryresultmpeg4gif.py +++ b/src/telegram/_inline/inlinequeryresultmpeg4gif.py @@ -50,7 +50,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. mpeg4_url (:obj:`str`): A valid URL for the MP4 file. mpeg4_width (:obj:`int`, optional): Video width. mpeg4_height (:obj:`int`, optional): Video height. @@ -77,27 +77,17 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): after entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): - |captionentitiesattr| - - .. versionchanged:: 20.0 - |sequenceclassargs| - + |caption_entities| reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the message to be sent instead of the video animation. - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.MPEG4GIF`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - mpeg4_url (:obj:`str`): A valid URL for the MP4 file. - mpeg4_width (:obj:`int`): Optional. Video width. - mpeg4_height (:obj:`int`): Optional. Video height. mpeg4_duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Video duration in seconds. @@ -107,29 +97,6 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): for the result. .. versionadded:: 20.2 - thumbnail_mime_type (:obj:`str`): Optional. MIME type of the thumbnail, must be one of - ``'image/jpeg'``, ``'image/gif'``, or ``'video/mp4'``. Defaults to ``'image/jpeg'``. - - .. versionadded:: 20.2 - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the MPEG-4 file to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters - after entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |caption_entities| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the video animation. - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultphoto.py b/src/telegram/_inline/inlinequeryresultphoto.py index 74ca99baa0d..584fef66b5d 100644 --- a/src/telegram/_inline/inlinequeryresultphoto.py +++ b/src/telegram/_inline/inlinequeryresultphoto.py @@ -47,7 +47,7 @@ class InlineQueryResultPhoto(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. photo_url (:obj:`str`): A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB. thumbnail_url (:obj:`str`): URL of the thumbnail for the photo. @@ -66,48 +66,17 @@ class InlineQueryResultPhoto(InlineQueryResult): entities parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached to the message. input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the message to be sent instead of the photo. - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.PHOTO`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - photo_url (:obj:`str`): A valid URL of the photo. Photo must be in JPEG format. Photo size - must not exceed 5MB. thumbnail_url (:obj:`str`): URL of the thumbnail for the photo. - photo_width (:obj:`int`): Optional. Width of the photo. - photo_height (:obj:`int`): Optional. Height of the photo. - title (:obj:`str`): Optional. Title for the result. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the photo to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after - entities parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the photo. - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultsbutton.py b/src/telegram/_inline/inlinequeryresultsbutton.py index 7f124fe7fc8..fcd03af596e 100644 --- a/src/telegram/_inline/inlinequeryresultsbutton.py +++ b/src/telegram/_inline/inlinequeryresultsbutton.py @@ -60,19 +60,6 @@ class InlineQueryResultsButton(TelegramObject): doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities. - - Attributes: - text (:obj:`str`): Label text on the button. - web_app (:class:`telegram.WebAppInfo`): Optional. Description of the - `Web App `_ that will be launched when the - user presses the button. The Web App will be able to switch back to the inline mode - using the method ``web_app_switch_inline_query`` inside the Web App. - start_parameter (:obj:`str`): Optional. Deep-linking parameter for the - :tg-const:`telegram.constants.InlineQueryResultsButtonLimit.MIN_START_PARAMETER_LENGTH` - - - :tg-const:`telegram.constants.InlineQueryResultsButtonLimit.MAX_START_PARAMETER_LENGTH` - characters, only ``A-Z``, ``a-z``, ``0-9``, ``_`` and ``-`` are allowed. - """ __slots__ = ("start_parameter", "text", "web_app") diff --git a/src/telegram/_inline/inlinequeryresultvenue.py b/src/telegram/_inline/inlinequeryresultvenue.py index 162ff4ed8c4..6ea13609406 100644 --- a/src/telegram/_inline/inlinequeryresultvenue.py +++ b/src/telegram/_inline/inlinequeryresultvenue.py @@ -45,7 +45,7 @@ class InlineQueryResultVenue(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. latitude (:obj:`float`): Latitude of the venue location in degrees. longitude (:obj:`float`): Longitude of the venue location in degrees. title (:obj:`str`): Title of the venue. @@ -74,35 +74,6 @@ class InlineQueryResultVenue(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.VENUE`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - latitude (:obj:`float`): Latitude of the venue location in degrees. - longitude (:obj:`float`): Longitude of the venue location in degrees. - title (:obj:`str`): Title of the venue. - address (:obj:`str`): Address of the venue. - foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue if known. - foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known. - (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or - "food/icecream".) - google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. - google_place_type (:obj:`str`): Optional. Google Places type of the venue. (See - `supported types `_.) - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the venue. - thumbnail_url (:obj:`str`): Optional. Url of the thumbnail for the result. - - .. versionadded:: 20.2 - thumbnail_width (:obj:`int`): Optional. Thumbnail width. - - .. versionadded:: 20.2 - thumbnail_height (:obj:`int`): Optional. Thumbnail height. - - .. versionadded:: 20.2 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultvideo.py b/src/telegram/_inline/inlinequeryresultvideo.py index a9ab9bc5241..b251045f2b5 100644 --- a/src/telegram/_inline/inlinequeryresultvideo.py +++ b/src/telegram/_inline/inlinequeryresultvideo.py @@ -54,7 +54,7 @@ class InlineQueryResultVideo(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. video_url (:obj:`str`): A valid URL for the embedded video player or video file. mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4". thumbnail_url (:obj:`str`, optional): URL of the thumbnail (JPEG only) for the video. @@ -70,10 +70,6 @@ class InlineQueryResultVideo(InlineQueryResult): parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - video_width (:obj:`int`, optional): Video width. video_height (:obj:`int`, optional): Video height. video_duration (:obj:`int` | :class:`datetime.timedelta`, optional): Video duration @@ -88,51 +84,20 @@ class InlineQueryResultVideo(InlineQueryResult): message to be sent instead of the video. This field is required if ``InlineQueryResultVideo`` is used to send an HTML-page as a result (e.g., a YouTube video). - show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med| + show_caption_above_media (:obj:`bool`, optional): |show_cap_above_med| .. versionadded:: 21.3 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.VIDEO`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - video_url (:obj:`str`): A valid URL for the embedded video player or video file. - mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4". thumbnail_url (:obj:`str`): URL of the thumbnail (JPEG only) for the video. .. versionadded:: 20.2 - title (:obj:`str`): Title for the result. - caption (:obj:`str`): Optional. Caption of the video to be sent, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities - parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. - |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - - video_width (:obj:`int`): Optional. Video width. - video_height (:obj:`int`): Optional. Video height. video_duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Video duration in seconds. .. deprecated:: v22.2 |time-period-int-deprecated| - description (:obj:`str`): Optional. Short description of the result. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the video. This field is required if - ``InlineQueryResultVideo`` is used to send an HTML-page as a result - (e.g., a YouTube video). - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - """ __slots__ = ( diff --git a/src/telegram/_inline/inlinequeryresultvoice.py b/src/telegram/_inline/inlinequeryresultvoice.py index 92119fe121d..b6d8614d59a 100644 --- a/src/telegram/_inline/inlinequeryresultvoice.py +++ b/src/telegram/_inline/inlinequeryresultvoice.py @@ -47,7 +47,7 @@ class InlineQueryResultVoice(InlineQueryResult): Args: id (:obj:`str`): Unique identifier for this result, :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. + :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` bytes. voice_url (:obj:`str`): A valid URL for the voice recording. title (:obj:`str`): Recording title. caption (:obj:`str`, optional): Caption, @@ -55,10 +55,6 @@ class InlineQueryResultVoice(InlineQueryResult): parsing. parse_mode (:obj:`str`, optional): |parse_mode| caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - voice_duration (:obj:`int` | :class:`datetime.timedelta`, optional): Recording duration in seconds. @@ -71,31 +67,11 @@ class InlineQueryResultVoice(InlineQueryResult): Attributes: type (:obj:`str`): :tg-const:`telegram.constants.InlineQueryResultType.VOICE`. - id (:obj:`str`): Unique identifier for this result, - :tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`- - :tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes. - voice_url (:obj:`str`): A valid URL for the voice recording. - title (:obj:`str`): Recording title. - caption (:obj:`str`): Optional. Caption, - 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities - parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| voice_duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Recording duration in seconds. .. deprecated:: v22.2 |time-period-int-deprecated| - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the voice recording. - """ __slots__ = ( diff --git a/src/telegram/_inline/inputcontactmessagecontent.py b/src/telegram/_inline/inputcontactmessagecontent.py index cead1136dd0..331ecf1648d 100644 --- a/src/telegram/_inline/inputcontactmessagecontent.py +++ b/src/telegram/_inline/inputcontactmessagecontent.py @@ -34,14 +34,6 @@ class InputContactMessageContent(InputMessageContent): last_name (:obj:`str`, optional): Contact's last name. vcard (:obj:`str`, optional): Additional data about the contact in the form of a vCard, 0-:tg-const:`telegram.constants.ContactLimit.VCARD` bytes. - - Attributes: - phone_number (:obj:`str`): Contact's phone number. - first_name (:obj:`str`): Contact's first name. - last_name (:obj:`str`): Optional. Contact's last name. - vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard, - 0-:tg-const:`telegram.constants.ContactLimit.VCARD` bytes. - """ __slots__ = ("first_name", "last_name", "phone_number", "vcard") diff --git a/src/telegram/_inline/inputinvoicemessagecontent.py b/src/telegram/_inline/inputinvoicemessagecontent.py index 536726e3afa..893d4552f39 100644 --- a/src/telegram/_inline/inputinvoicemessagecontent.py +++ b/src/telegram/_inline/inputinvoicemessagecontent.py @@ -65,10 +65,6 @@ class signature. prices (Sequence[:class:`telegram.LabeledPrice`]): Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in |tg_stars|. - - .. versionchanged:: 20.0 - |sequenceclassargs| - max_tip_amount (:obj:`int`, optional): The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the ``exp`` parameter in @@ -80,12 +76,6 @@ class signature. At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed :attr:`max_tip_amount`. - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - provider_data (:obj:`str`, optional): An object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. @@ -109,69 +99,6 @@ class signature. address should be sent to provider. Ignored for payments in |tg_stars|. is_flexible (:obj:`bool`, optional): Pass :obj:`True`, if the final price depends on the shipping method. Ignored for payments in |tg_stars|. - - Attributes: - title (:obj:`str`): Product name. :tg-const:`telegram.Invoice.MIN_TITLE_LENGTH`- - :tg-const:`telegram.Invoice.MAX_TITLE_LENGTH` characters. - description (:obj:`str`): Product description. - :tg-const:`telegram.Invoice.MIN_DESCRIPTION_LENGTH`- - :tg-const:`telegram.Invoice.MAX_DESCRIPTION_LENGTH` characters. - payload (:obj:`str`): Bot-defined invoice payload. - :tg-const:`telegram.Invoice.MIN_PAYLOAD_LENGTH`- - :tg-const:`telegram.Invoice.MAX_PAYLOAD_LENGTH` bytes. This will not be displayed - to the user, use it for your internal processes. - provider_token (:obj:`str`): Payment provider token, obtained via - `@Botfather `_. Pass an empty string for payments in `Telegram - Stars `_. - currency (:obj:`str`): Three-letter ISO 4217 currency code, see more on - `currencies `_. - Pass ``XTR`` for payments in |tg_stars|. - prices (tuple[:class:`telegram.LabeledPrice`]): Price breakdown, a list of - components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, - etc.). Must contain exactly one item for payments in |tg_stars|. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - max_tip_amount (:obj:`int`): Optional. The maximum accepted amount for tips in the - *smallest units* of the currency (integer, **not** float/double). For example, for a - maximum tip of ``US$ 1.45`` ``max_tip_amount`` is ``145``. See the ``exp`` parameter in - `currencies.json `_, it - shows the number of digits past the decimal point for each currency (2 for the majority - of currencies). Defaults to ``0``. Not supported for payments in |tg_stars|. - suggested_tip_amounts (tuple[:obj:`int`]): Optional. An array of suggested - amounts of tip in the *smallest units* of the currency (integer, **not** float/double). - At most 4 suggested tip amounts can be specified. The suggested tip amounts must be - positive, passed in a strictly increased order and must not exceed - :attr:`max_tip_amount`. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - provider_data (:obj:`str`): Optional. An object for data about the invoice, - which will be shared with the payment provider. A detailed description of the required - fields should be provided by the payment provider. - photo_url (:obj:`str`): Optional. URL of the product photo for the invoice. Can be a photo - of the goods or a marketing image for a service. People like it better when they see - what they are paying for. - photo_size (:obj:`int`): Optional. Photo size. - photo_width (:obj:`int`): Optional. Photo width. - photo_height (:obj:`int`): Optional. Photo height. - need_name (:obj:`bool`): Optional. Pass :obj:`True`, if you require the user's full name to - complete the order. Ignored for payments in |tg_stars|. - need_phone_number (:obj:`bool`): Optional. Pass :obj:`True`, if you require the user's - phone number to complete the order. Ignored for payments in |tg_stars|. - need_email (:obj:`bool`): Optional. Pass :obj:`True`, if you require the user's email - address to complete the order. Ignored for payments in |tg_stars|. - need_shipping_address (:obj:`bool`): Optional. Pass :obj:`True`, if you require the user's - shipping address to complete the order. Ignored for payments in |tg_stars|. - send_phone_number_to_provider (:obj:`bool`): Optional. Pass :obj:`True`, if user's phone - number should be sent to provider. Ignored for payments in |tg_stars|. - send_email_to_provider (:obj:`bool`): Optional. Pass :obj:`True`, if user's email address - should be sent to provider. Ignored for payments in |tg_stars|. - is_flexible (:obj:`bool`): Optional. Pass :obj:`True`, if the final price depends on the - shipping method. Ignored for payments in |tg_stars|. - """ __slots__ = ( diff --git a/src/telegram/_inline/inputlocationmessagecontent.py b/src/telegram/_inline/inputlocationmessagecontent.py index 6e2a77e8e1d..f7316c52095 100644 --- a/src/telegram/_inline/inputlocationmessagecontent.py +++ b/src/telegram/_inline/inputlocationmessagecontent.py @@ -62,11 +62,6 @@ class InputLocationMessageContent(InputMessageContent): if specified. Attributes: - latitude (:obj:`float`): Latitude of the location in degrees. - longitude (:obj:`float`): Longitude of the location in degrees. - horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, - measured in meters; 0- - :tg-const:`telegram.InputLocationMessageContent.HORIZONTAL_ACCURACY`. live_period (:obj:`int` | :class:`datetime.timedelta`): Optional. Period in seconds for which the location can be updated, should be between :tg-const:`telegram.InputLocationMessageContent.MIN_LIVE_PERIOD` and @@ -74,16 +69,6 @@ class InputLocationMessageContent(InputMessageContent): .. deprecated:: v22.2 |time-period-int-deprecated| - heading (:obj:`int`): Optional. For live locations, a direction in which the user is - moving, in degrees. Must be between - :tg-const:`telegram.InputLocationMessageContent.MIN_HEADING` and - :tg-const:`telegram.InputLocationMessageContent.MAX_HEADING` if specified. - proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance - for proximity alerts about approaching another chat member, in meters. Must be - between :tg-const:`telegram.InputLocationMessageContent.MIN_PROXIMITY_ALERT_RADIUS` - and :tg-const:`telegram.InputLocationMessageContent.MAX_PROXIMITY_ALERT_RADIUS` - if specified. - """ __slots__ = ( diff --git a/src/telegram/_inline/inputtextmessagecontent.py b/src/telegram/_inline/inputtextmessagecontent.py index 6edde810673..f26ef5cf7c6 100644 --- a/src/telegram/_inline/inputtextmessagecontent.py +++ b/src/telegram/_inline/inputtextmessagecontent.py @@ -48,10 +48,6 @@ class InputTextMessageContent(InputMessageContent): parsing. parse_mode (:obj:`str`, optional): |parse_mode| entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities| - - .. versionchanged:: 20.0 - |sequenceclassargs| - link_preview_options (:obj:`LinkPreviewOptions`, optional): Link preview generation options for the message. Mutually exclusive with :paramref:`disable_web_page_preview`. @@ -70,24 +66,6 @@ class InputTextMessageContent(InputMessageContent): .. versionchanged:: 21.0 |keyword_only_arg| - - Attributes: - message_text (:obj:`str`): Text of the message to be sent, - :tg-const:`telegram.constants.MessageLimit.MIN_TEXT_LENGTH`- - :tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters after entities - parsing. - parse_mode (:obj:`str`): Optional. |parse_mode| - entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr| - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - link_preview_options (:obj:`LinkPreviewOptions`): Optional. Link preview generation - options for the message. - - .. versionadded:: 20.8 - """ __slots__ = ("entities", "link_preview_options", "message_text", "parse_mode") diff --git a/src/telegram/_inline/inputvenuemessagecontent.py b/src/telegram/_inline/inputvenuemessagecontent.py index 28c039fb1a9..3263d039f15 100644 --- a/src/telegram/_inline/inputvenuemessagecontent.py +++ b/src/telegram/_inline/inputvenuemessagecontent.py @@ -46,21 +46,6 @@ class InputVenueMessageContent(InputMessageContent): google_place_type (:obj:`str`, optional): Google Places type of the venue. (See `supported types `_.) - - Attributes: - latitude (:obj:`float`): Latitude of the location in degrees. - longitude (:obj:`float`): Longitude of the location in degrees. - title (:obj:`str`): Name of the venue. - address (:obj:`str`): Address of the venue. - foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue, if known. - foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known. - (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or - "food/icecream".) - google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. - google_place_type (:obj:`str`): Optional. Google Places type of the venue. (See - `supported types `_.) - """ __slots__ = ( diff --git a/src/telegram/_inline/preparedinlinemessage.py b/src/telegram/_inline/preparedinlinemessage.py index b390c228e3e..3abaaaee936 100644 --- a/src/telegram/_inline/preparedinlinemessage.py +++ b/src/telegram/_inline/preparedinlinemessage.py @@ -42,12 +42,6 @@ class PreparedInlineMessage(TelegramObject): expiration_date (:class:`datetime.datetime`): Expiration date of the prepared message. Expired prepared messages can no longer be used. |datetime_localization| - - Attributes: - id (:obj:`str`): Unique identifier of the prepared message - expiration_date (:class:`datetime.datetime`): Expiration date of the prepared message. - Expired prepared messages can no longer be used. - |datetime_localization| """ __slots__ = ("expiration_date", "id") diff --git a/src/telegram/_inputchecklist.py b/src/telegram/_inputchecklist.py index 21ae2f491f6..d2173b14399 100644 --- a/src/telegram/_inputchecklist.py +++ b/src/telegram/_inputchecklist.py @@ -51,23 +51,6 @@ class InputChecklistTask(TelegramObject): List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are allowed. - - Attributes: - id (:obj:`int`): - Unique identifier of the task; must be positive and unique among all task identifiers - currently present in the checklist. - text (:obj:`str`): - Text of the task; - :tg-const:`telegram.constants.InputChecklistLimit.MIN_TEXT_LENGTH`\ --:tg-const:`telegram.constants.InputChecklistLimit.MAX_TEXT_LENGTH` characters after - entities parsing. - parse_mode (:obj:`str`): - Optional. |parse_mode| - text_entities (Sequence[:class:`telegram.MessageEntity`]): - Optional. List of special entities that appear in the text, which can be specified - instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, - custom_emoji, and date_time entities are allowed. - """ __slots__ = ( @@ -127,30 +110,6 @@ class InputChecklist(TelegramObject): Pass :obj:`True` if other users can add tasks to the checklist. others_can_mark_tasks_as_done (:obj:`bool`, optional): Pass :obj:`True` if other users can mark tasks as done or not done in the checklist. - - Attributes: - title (:obj:`str`): - Title of the checklist; - :tg-const:`telegram.constants.InputChecklistLimit.MIN_TITLE_LENGTH`\ --:tg-const:`telegram.constants.InputChecklistLimit.MAX_TITLE_LENGTH` characters after - entities parsing. - parse_mode (:obj:`str`): - Optional. |parse_mode| - title_entities (Sequence[:class:`telegram.MessageEntity`]): - Optional. List of special entities that appear in the title, which - can be specified instead of :paramref:`parse_mode`. Currently, only bold, italic, - underline, strikethrough, spoiler, and custom_emoji, and date_time entities are allowed - tasks (Sequence[:class:`telegram.InputChecklistTask`]): - List of - :tg-const:`telegram.constants.InputChecklistLimit.MIN_TASK_NUMBER`\ --:tg-const:`telegram.constants.InputChecklistLimit.MAX_TASK_NUMBER` tasks in - the checklist. - others_can_add_tasks (:obj:`bool`): - Optional. Pass :obj:`True` if other users can add tasks to the checklist. - others_can_mark_tasks_as_done (:obj:`bool`): - Optional. Pass :obj:`True` if other users can mark tasks as done or not done in - the checklist. - """ __slots__ = ( diff --git a/src/telegram/_keyboardbutton.py b/src/telegram/_keyboardbutton.py index 98aeeaeea35..8742d0f0e1f 100644 --- a/src/telegram/_keyboardbutton.py +++ b/src/telegram/_keyboardbutton.py @@ -61,21 +61,17 @@ class KeyboardButton(TelegramObject): * :attr:`style` option will only work in Telegram versions released after February 9, 2026. Older clients will display buttons without styling. - .. versionchanged:: 21.0 - Removed deprecated argument and attribute ``request_user``. .. versionchanged:: 20.0 :attr:`web_app` is considered as well when comparing objects of this type in terms of equality. .. versionchanged:: 20.5 :attr:`request_users` and :attr:`request_chat` are considered as well when comparing objects of this type in terms of equality. + .. versionchanged:: 21.0 + Removed deprecated argument and attribute ``request_user``. .. versionchanged:: 22.7 - :attr:`icon_custom_emoji_id` is considered as well when comparing objects of this type in - terms of equality. - - .. versionchanged:: 22.7 - :attr:`style` and :attr:`icon_custom_emoji_id` are considered as well when - comparing objects of this type in terms of equality. + :attr:`style`, and :attr:`icon_custom_emoji_id` is considered as well when comparing objects + of this type in terms of equality. Args: text (:obj:`str`): Text of the button. If none of the fields other than :attr:`text`, @@ -131,61 +127,6 @@ class KeyboardButton(TelegramObject): chats only. .. versionadded:: NEXT.VERSION - - - Attributes: - text (:obj:`str`): Text of the button. If none of the fields other than :attr:`text`, - :attr:`icon_custom_emoji_id`, and :attr:`style` are used, it will be sent as a - message when the button is pressed. - request_contact (:obj:`bool`): Optional. If :obj:`True`, the user's phone number will be - sent as a contact when the button is pressed. Available in private chats only. - request_location (:obj:`bool`): Optional. If :obj:`True`, the user's current location will - be sent when the button is pressed. Available in private chats only. - request_poll (:class:`~telegram.KeyboardButtonPollType`): Optional. If specified, - the user will be asked to create a poll and send it to the bot when the button is - pressed. Available in private chats only. - web_app (:class:`~telegram.WebAppInfo`): Optional. If specified, the described `Web App - `_ will be launched when the button is pressed. - The Web App will be able to send a :attr:`Message.web_app_data` service message. - Available in private chats only. - - .. versionadded:: 20.0 - request_users (:class:`KeyboardButtonRequestUsers`): Optional. If specified, pressing the - button will open a list of suitable users. Tapping on any user will send its - identifier to the bot in a :attr:`telegram.Message.users_shared` service message. - Available in private chats only. - - .. versionadded:: 20.8 - request_chat (:class:`KeyboardButtonRequestChat`): Optional. If specified, pressing the - button will open a list of suitable chats. Tapping on a chat will send its - identifier to the bot in a :attr:`telegram.Message.chat_shared` service message. - Available in private chats only. - - .. versionadded:: 20.1 - style (:obj:`str`): Optional. Style of the button. Must be one of - :tg-const:`telegram.constants.KeyboardButtonStyle.PRIMARY` (blue), - :tg-const:`telegram.constants.KeyboardButtonStyle.SUCCESS` (green), and - :tg-const:`telegram.constants.KeyboardButtonStyle.DANGER` (red). - Color name aliases :tg-const:`telegram.constants.KeyboardButtonStyle.BLUE`, - :tg-const:`telegram.constants.KeyboardButtonStyle.GREEN`, and - :tg-const:`telegram.constants.KeyboardButtonStyle.RED` are also available. - If omitted, then an app-specific style is used. - - .. versionadded:: 22.7 - icon_custom_emoji_id (:obj:`str`): Optional. Unique identifier of the - custom emoji shown before the text of the button. Can only be used by bots that - purchased additional usernames on Fragment or in the messages directly sent by the - bot to private, group and supergroup chats if the owner of the bot has a Telegram - Premium subscription. - - .. versionadded:: 22.7 - request_managed_bot (:obj:`telegram.KeyboardButtonRequestManagedBot`): Optional. If - specified, pressing the button will ask the user to create and share a bot that will - be managed by the current bot. Available for bots that enabled management of other bots - in the `@BotFather ` Mini App. Available in private - chats only. - - .. versionadded:: NEXT.VERSION """ __slots__ = ( diff --git a/src/telegram/_keyboardbuttonpolltype.py b/src/telegram/_keyboardbuttonpolltype.py index 86baadb8fa4..54a4e7442df 100644 --- a/src/telegram/_keyboardbuttonpolltype.py +++ b/src/telegram/_keyboardbuttonpolltype.py @@ -39,11 +39,6 @@ class KeyboardButtonPollType(TelegramObject): allowed to create only polls in the quiz mode. If :tg-const:`telegram.Poll.REGULAR` is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. - Attributes: - type (:obj:`str`): Optional. If equals :tg-const:`telegram.Poll.QUIZ`, the user will - be allowed to create only polls in the quiz mode. If equals - :tg-const:`telegram.Poll.REGULAR`, only regular polls will be allowed. - Otherwise, the user will be allowed to create a poll of any type. """ __slots__ = ("type",) diff --git a/src/telegram/_keyboardbuttonrequest.py b/src/telegram/_keyboardbuttonrequest.py index fa8e3513c1c..51bef274e64 100644 --- a/src/telegram/_keyboardbuttonrequest.py +++ b/src/telegram/_keyboardbuttonrequest.py @@ -65,32 +65,6 @@ class KeyboardButtonRequestUsers(TelegramObject): request_photo (:obj:`bool`, optional): Pass :obj:`True` to request the users' photo. .. versionadded:: 21.1 - - Attributes: - request_id (:obj:`int`): Identifier of the request. - user_is_bot (:obj:`bool`): Optional. Pass :obj:`True` to request a bot, pass :obj:`False` - to request a regular user. If not specified, no additional restrictions are applied. - user_is_premium (:obj:`bool`): Optional. Pass :obj:`True` to request a premium user, pass - :obj:`False` to request a non-premium user. If not specified, no additional - restrictions are applied. - max_quantity (:obj:`int`): Optional. The maximum number of users to be selected; - :tg-const:`telegram.constants.KeyboardButtonRequestUsersLimit.MIN_QUANTITY` - - :tg-const:`telegram.constants.KeyboardButtonRequestUsersLimit.MAX_QUANTITY`. - Defaults to :tg-const:`telegram.constants.KeyboardButtonRequestUsersLimit.MIN_QUANTITY` - . - - .. versionadded:: 20.8 - request_name (:obj:`bool`): Optional. Pass :obj:`True` to request the users' first and last - name. - - .. versionadded:: 21.1 - request_username (:obj:`bool`): Optional. Pass :obj:`True` to request the users' username. - - .. versionadded:: 21.1 - request_photo (:obj:`bool`): Optional. Pass :obj:`True` to request the users' photo. - - .. versionadded:: 21.1 - """ __slots__ = ( @@ -172,36 +146,6 @@ class KeyboardButtonRequestChat(TelegramObject): .. versionadded:: 21.1 request_photo (:obj:`bool`, optional): Pass :obj:`True` to request the chat's photo. - .. versionadded:: 21.1 - Attributes: - request_id (:obj:`int`): Identifier of the request. - chat_is_channel (:obj:`bool`): Pass :obj:`True` to request a channel chat, pass - :obj:`False` to request a group or a supergroup chat. - chat_is_forum (:obj:`bool`): Optional. Pass :obj:`True` to request a forum supergroup, pass - :obj:`False` to request a non-forum chat. If not specified, no additional - restrictions are applied. - chat_has_username (:obj:`bool`): Optional. Pass :obj:`True` to request a supergroup or a - channel with a username, pass :obj:`False` to request a chat without a username. If - not specified, no additional restrictions are applied. - chat_is_created (:obj:`bool`) Optional. Pass :obj:`True` to request a chat owned by the - user. Otherwise, no additional restrictions are applied. - user_administrator_rights (:class:`ChatAdministratorRights`) Optional. Specifies the - required administrator rights of the user in the chat. If not specified, no additional - restrictions are applied. - bot_administrator_rights (:class:`ChatAdministratorRights`) Optional. Specifies the - required administrator rights of the bot in the chat. The rights must be a subset of - :attr:`user_administrator_rights`. If not specified, no additional restrictions are - applied. - bot_is_member (:obj:`bool`) Optional. Pass :obj:`True` to request a chat with the bot - as a member. Otherwise, no additional restrictions are applied. - request_title (:obj:`bool`): Optional. Pass :obj:`True` to request the chat's title. - - .. versionadded:: 21.1 - request_username (:obj:`bool`): Optional. Pass :obj:`True` to request the chat's username. - - .. versionadded:: 21.1 - request_photo (:obj:`bool`): Optional. Pass :obj:`True` to request the chat's photo. - .. versionadded:: 21.1 """ @@ -283,16 +227,10 @@ class KeyboardButtonRequestManagedBot(TelegramObject): .. versionadded:: NEXT.VERSION Args: - request_id (:obj:`int`): Signed 32-bit identifier of the request. Must be unique + request_id (:obj:`int`): Identifier of the request. Must be unique within the message. suggested_name (:obj:`str`, optional): Suggested name for the bot. suggested_username (:obj:`str`, optional): Suggested username for the bot. - - Attributes: - request_id (:obj:`int`): Signed 32-bit identifier of the request. Must be unique - within the message. - suggested_name (:obj:`str`): Optional. Suggested name for the bot. - suggested_username (:obj:`str`): Optional. Suggested username for the bot. """ __slots__ = ( diff --git a/src/telegram/_linkpreviewoptions.py b/src/telegram/_linkpreviewoptions.py index 5ad13de7a16..a5bb479fc89 100644 --- a/src/telegram/_linkpreviewoptions.py +++ b/src/telegram/_linkpreviewoptions.py @@ -46,20 +46,6 @@ class LinkPreviewOptions(TelegramObject): show_above_text (:obj:`bool`, optional): :obj:`True`, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text. - - Attributes: - is_disabled (:obj:`bool`): Optional. :obj:`True`, if the link preview is disabled. - url (:obj:`str`): Optional. The URL to use for the link preview. If empty, then the first - URL found in the message text will be used. - prefer_small_media (:obj:`bool`): Optional. :obj:`True`, if the media in the link preview - is supposed to be shrunk; ignored if the URL isn't explicitly specified or media size - change isn't supported for the preview. - prefer_large_media (:obj:`bool`): Optional. :obj:`True`, if the media in the link preview - is supposed to be enlarged; ignored if the URL isn't explicitly specified or media size - change isn't supported for the preview. - show_above_text (:obj:`bool`): Optional. :obj:`True`, if the link preview must be shown - above the message text; otherwise, the link preview will be shown below the message - text. """ __slots__ = ( diff --git a/src/telegram/_loginurl.py b/src/telegram/_loginurl.py index 9b0ce84c377..a6ecc11e9aa 100644 --- a/src/telegram/_loginurl.py +++ b/src/telegram/_loginurl.py @@ -57,27 +57,6 @@ class LoginUrl(TelegramObject): for more details. request_write_access (:obj:`bool`, optional): Pass :obj:`True` to request the permission for your bot to send messages to the user. - - Attributes: - url (:obj:`str`): An HTTPS URL to be opened with user authorization data added to the query - string when the button is pressed. If the user refuses to provide authorization data, - the original URL without information about the user will be opened. The data added is - the same as described in - `Receiving authorization data - `_. - forward_text (:obj:`str`): Optional. New text of the button in forwarded messages. - bot_username (:obj:`str`): Optional. Username of a bot, which will be used for user - authorization. See - `Setting up a bot `_ - for more details. If not specified, the current - bot's username will be assumed. The url's domain must be the same as the domain linked - with the bot. See - `Linking your domain to the bot - `_ - for more details. - request_write_access (:obj:`bool`): Optional. Pass :obj:`True` to request the permission - for your bot to send messages to the user. - """ __slots__ = ("bot_username", "forward_text", "request_write_access", "url") diff --git a/src/telegram/_managedbot.py b/src/telegram/_managedbot.py index 109983c656e..fd50b45f509 100644 --- a/src/telegram/_managedbot.py +++ b/src/telegram/_managedbot.py @@ -43,9 +43,6 @@ class ManagedBotCreated(TelegramObject): Args: bot (:class:`telegram.User`): Information about the bot. The bot's token can be fetched using the method :meth:`~telegram.Bot.get_managed_bot_token`. - Attributes: - bot (:class:`telegram.User`): Information about the bot. The bot's token can be fetched - using the method :meth:`~telegram.Bot.get_managed_bot_token`. """ __slots__ = ("bot",) @@ -85,11 +82,6 @@ class ManagedBotUpdated(TelegramObject): user (:class:`telegram.User`): User that created the bot. bot (:class:`telegram.User`): Information about the bot. Token of the bot can be fetched using the method :meth:`~telegram.Bot.get_managed_bot_token`. - - Attributes: - user (:class:`telegram.User`): User that created the bot. - bot (:class:`telegram.User`): Information about the bot. Token of the bot can be fetched - using the method :meth:`~telegram.Bot.get_managed_bot_token`. """ __slots__ = ("bot", "user") diff --git a/src/telegram/_menubutton.py b/src/telegram/_menubutton.py index e570c5a6648..36f753617f2 100644 --- a/src/telegram/_menubutton.py +++ b/src/telegram/_menubutton.py @@ -50,9 +50,6 @@ class MenuButton(TelegramObject): Args: type (:obj:`str`): Type of menu button that the instance represents. - - Attributes: - type (:obj:`str`): Type of menu button that the instance represents. """ __slots__ = ("type",) @@ -143,16 +140,8 @@ class MenuButtonWebApp(MenuButton): be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. - Attributes: type (:obj:`str`): :tg-const:`telegram.constants.MenuButtonType.WEB_APP`. - text (:obj:`str`): Text of the button. - web_app (:class:`telegram.WebAppInfo`): Description of the Web App that will be launched - when the user presses the button. The Web App will be able to send an arbitrary - message on behalf of the user using the method :meth:`~telegram.Bot.answerWebAppQuery` - of :class:`~telegram.Bot`. Alternatively, a ``t.me`` link to a Web App of the bot can - be specified in the object instead of the Web App's URL, in which case the Web App - will be opened as if the user pressed the link. """ __slots__ = ("text", "web_app") diff --git a/src/telegram/_message.py b/src/telegram/_message.py index 8a76e5980ee..1d72e65c8bb 100644 --- a/src/telegram/_message.py +++ b/src/telegram/_message.py @@ -159,14 +159,6 @@ class MaybeInaccessibleMessage(TelegramObject): |datetime_localization| chat (:class:`telegram.Chat`): Conversation the message belongs to. - - Attributes: - message_id (:obj:`int`): Unique message identifier. - date (:class:`datetime.datetime`): Date the message was sent in Unix time or 0 in Unix - time. Converted to :class:`datetime.datetime` - - |datetime_localization| - chat (:class:`telegram.Chat`): Conversation the message belongs to. """ __slots__ = ("chat", "date", "message_id") @@ -239,10 +231,8 @@ class InaccessibleMessage(MaybeInaccessibleMessage): chat (:class:`telegram.Chat`): Chat the message belongs to. Attributes: - message_id (:obj:`int`): Unique message identifier. date (:class:`constants.ZERO_DATE`): Always :tg-const:`telegram.constants.ZERO_DATE`. The field can be used to differentiate regular and inaccessible messages. - chat (:class:`telegram.Chat`): Chat the message belongs to. """ __slots__ = () @@ -642,7 +632,7 @@ class Message(MaybeInaccessibleMessage): .. versionadded:: 21.1 - chat_background_set (:class:`telegram.ChatBackground`, optional): Service message: chat + chat_background_set (:class:`telegram.ChatBackground`, optional): Service message: chat background set. .. versionadded:: 21.2 @@ -709,438 +699,6 @@ class Message(MaybeInaccessibleMessage): .. versionadded:: NEXT.VERSION - Attributes: - message_id (:obj:`int`): Unique message identifier inside this chat. In specific instances - (e.g., message containing a video sent to a big chat), the server might automatically - schedule a message instead of sending it immediately. In such cases, this field will be - ``0`` and the relevant message will be unusable until it is actually sent. - from_user (:class:`telegram.User`): Optional. Sender of the message; may be empty for - messages sent to channels. For backward compatibility, if the message was sent on - behalf of a chat, the field contains a fake sender user in non-channel chats. - sender_chat (:class:`telegram.Chat`): Optional. Sender of the message when sent on behalf - of a chat. For example, the supergroup itself for messages sent by its anonymous - administrators or a linked channel for messages automatically forwarded to the - channel's discussion group. For backward compatibility, if the message was sent on - behalf of a chat, the field from contains a fake sender user in non-channel chats. - date (:class:`datetime.datetime`): Date the message was sent in Unix time. Converted to - :class:`datetime.datetime`. - - .. versionchanged:: 20.3 - |datetime_localization| - chat (:class:`telegram.Chat`): Conversation the message belongs to. - is_automatic_forward (:obj:`bool`): Optional. :obj:`True`, if the message is a channel - post that was automatically forwarded to the connected discussion group. - - .. versionadded:: 13.9 - reply_to_message (:class:`telegram.Message`): Optional. For replies, the original message. - Note that the Message object in this field will not contain further - ``reply_to_message`` fields even if it itself is a reply. - edit_date (:class:`datetime.datetime`): Optional. Date the message was last edited in Unix - time. Converted to :class:`datetime.datetime`. - - .. versionchanged:: 20.3 - |datetime_localization| - has_protected_content (:obj:`bool`): Optional. :obj:`True`, if the message can't be - forwarded. - - .. versionadded:: 13.9 - is_from_offline (:obj:`bool`): Optional. :obj:`True`, if the message was sent - by an implicit action, for example, as an away or a greeting business message, - or as a scheduled message. - - .. versionadded:: 21.1 - media_group_id (:obj:`str`): Optional. The unique identifier inside this chat of a media - message group this message belongs to. - text (:obj:`str`): Optional. For text messages, the actual UTF-8 text of the message, - 0-:tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters. - entities (tuple[:class:`telegram.MessageEntity`]): Optional. For text messages, special - entities like usernames, URLs, bot commands, etc. that appear in the text. See - :attr:`parse_entity` and :attr:`parse_entities` methods for how to use properly. - This list is empty if the message does not contain entities. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - link_preview_options (:class:`telegram.LinkPreviewOptions`): Optional. Options used for - link preview generation for the message, if it is a text message and link preview - options were changed. - - .. versionadded:: 20.8 - - suggested_post_info (:class:`telegram.SuggestedPostInfo`): Optional. Information about - suggested post parameters if the message is a suggested post in a channel direct - messages chat. If the message is an approved or declined suggested post, then it can't - be edited. - - .. versionadded:: 22.4 - - effect_id (:obj:`str`): Optional. Unique identifier of the message effect added to the - message. - - .. versionadded:: 21.3 - - caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. For messages with a - Caption. Special entities like usernames, URLs, bot commands, etc. that appear in the - caption. See :attr:`Message.parse_caption_entity` and :attr:`parse_caption_entities` - methods for how to use properly. This list is empty if the message does not contain - caption entities. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med| - - .. versionadded:: 21.3 - audio (:class:`telegram.Audio`): Optional. Message is an audio file, information - about the file. - - .. seealso:: :wiki:`Working with Files and Media ` - document (:class:`telegram.Document`): Optional. Message is a general file, information - about the file. - - .. seealso:: :wiki:`Working with Files and Media ` - animation (:class:`telegram.Animation`): Optional. Message is an animation, information - about the animation. For backward compatibility, when this field is set, the document - field will also be set. - - .. seealso:: :wiki:`Working with Files and Media ` - game (:class:`telegram.Game`): Optional. Message is a game, information about the game. - :ref:`More about games >> `. - photo (tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available - sizes of the photo. This list is empty if the message does not contain a photo. - - .. seealso:: :wiki:`Working with Files and Media ` - - .. versionchanged:: 20.0 - |tupleclassattrs| - - sticker (:class:`telegram.Sticker`): Optional. Message is a sticker, information - about the sticker. - - .. seealso:: :wiki:`Working with Files and Media ` - story (:class:`telegram.Story`): Optional. Message is a forwarded story. - - .. versionadded:: 20.5 - video (:class:`telegram.Video`): Optional. Message is a video, information about the - video. - - .. seealso:: :wiki:`Working with Files and Media ` - voice (:class:`telegram.Voice`): Optional. Message is a voice message, information about - the file. - - .. seealso:: :wiki:`Working with Files and Media ` - video_note (:class:`telegram.VideoNote`): Optional. Message is a - `video note `_, information - about the video message. - - .. seealso:: :wiki:`Working with Files and Media ` - new_chat_members (tuple[:class:`telegram.User`]): Optional. New members that were added - to the group or supergroup and information about them (the bot itself may be one of - these members). This list is empty if the message does not contain new chat members. - - .. versionchanged:: 20.0 - |tupleclassattrs| - caption (:obj:`str`): Optional. Caption for the animation, audio, document, paid media, - photo, video - or voice, 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters. - contact (:class:`telegram.Contact`): Optional. Message is a shared contact, information - about the contact. - location (:class:`telegram.Location`): Optional. Message is a shared location, information - about the location. - venue (:class:`telegram.Venue`): Optional. Message is a venue, information about the - venue. For backward compatibility, when this field is set, the location field will - also be set. - left_chat_member (:class:`telegram.User`): Optional. A member was removed from the group, - information about them (this member may be the bot itself). - new_chat_title (:obj:`str`): Optional. A chat title was changed to this value. - new_chat_photo (tuple[:class:`telegram.PhotoSize`]): A chat photo was changed to - this value. This list is empty if the message does not contain a new chat photo. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - delete_chat_photo (:obj:`bool`): Optional. Service message: The chat photo was deleted. - group_chat_created (:obj:`bool`): Optional. Service message: The group has been created. - supergroup_chat_created (:obj:`bool`): Optional. Service message: The supergroup has been - created. This field can't be received in a message coming through updates, because bot - can't be a member of a supergroup when it is created. It can only be found in - :attr:`reply_to_message` if someone replies to a very first message in a directly - created supergroup. - channel_chat_created (:obj:`bool`): Optional. Service message: The channel has been - created. This field can't be received in a message coming through updates, because bot - can't be a member of a channel when it is created. It can only be found in - :attr:`reply_to_message` if someone replies to a very first message in a channel. - message_auto_delete_timer_changed (:class:`telegram.MessageAutoDeleteTimerChanged`): - Optional. Service message: auto-delete timer settings changed in the chat. - - .. versionadded:: 13.4 - migrate_to_chat_id (:obj:`int`): Optional. The group has been migrated to a supergroup - with the specified identifier. - migrate_from_chat_id (:obj:`int`): Optional. The supergroup has been migrated from a group - with the specified identifier. - pinned_message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Specified message - was pinned. Note that the Message object in this field will not contain further - :attr:`reply_to_message` fields even if it is itself a reply. - - .. versionchanged:: 20.8 - This attribute now is either :class:`telegram.Message` or - :class:`telegram.InaccessibleMessage`. - invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, - information about the invoice. - :ref:`More about payments >> `. - successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Message is a service - message about a successful payment, information about the payment. - :ref:`More about payments >> `. - connected_website (:obj:`str`): Optional. The domain name of the website on which the user - has logged in. - `More about Telegram Login >> `_. - author_signature (:obj:`str`): Optional. Signature of the post author for messages in - channels, or the custom title of an anonymous group administrator. - paid_star_count (:obj:`int`): Optional. The number of Telegram Stars that were paid by the - sender of the message to send it - - .. versionadded:: 22.1 - passport_data (:class:`telegram.PassportData`): Optional. Telegram Passport data. - - Examples: - :any:`Passport Bot ` - poll (:class:`telegram.Poll`): Optional. Message is a native poll, - information about the poll. - dice (:class:`telegram.Dice`): Optional. Message is a dice with random value. - via_bot (:class:`telegram.User`): Optional. Bot through which message was sent. - proximity_alert_triggered (:class:`telegram.ProximityAlertTriggered`): Optional. Service - message. A user in the chat triggered another user's proximity alert while sharing - Live Location. - video_chat_scheduled (:class:`telegram.VideoChatScheduled`): Optional. Service message: - video chat scheduled. - - .. versionadded:: 20.0 - video_chat_started (:class:`telegram.VideoChatStarted`): Optional. Service message: video - chat started. - - .. versionadded:: 20.0 - video_chat_ended (:class:`telegram.VideoChatEnded`): Optional. Service message: video chat - ended. - - .. versionadded:: 20.0 - video_chat_participants_invited (:class:`telegram.VideoChatParticipantsInvited`): Optional. - Service message: new participants invited to a video chat. - - .. versionadded:: 20.0 - web_app_data (:class:`telegram.WebAppData`): Optional. Service message: data sent by a Web - App. - - .. versionadded:: 20.0 - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. :paramref:`~telegram.InlineKeyboardButton.login_url` buttons are - represented as ordinary url buttons. - is_topic_message (:obj:`bool`): Optional. :obj:`True`, if the message is sent to a topic - in a forum supergroup or a private chat with the bot. - - .. versionadded:: 20.0 - message_thread_id (:obj:`int`): Optional. Unique identifier of a message thread or forum - topic to which the message belongs; for supergroups and private chats only. - - .. versionadded:: 20.0 - forum_topic_created (:class:`telegram.ForumTopicCreated`): Optional. Service message: - forum topic created. - - .. versionadded:: 20.0 - forum_topic_closed (:class:`telegram.ForumTopicClosed`): Optional. Service message: - forum topic closed. - - .. versionadded:: 20.0 - forum_topic_reopened (:class:`telegram.ForumTopicReopened`): Optional. Service message: - forum topic reopened. - - .. versionadded:: 20.0 - forum_topic_edited (:class:`telegram.ForumTopicEdited`): Optional. Service message: - forum topic edited. - - .. versionadded:: 20.0 - general_forum_topic_hidden (:class:`telegram.GeneralForumTopicHidden`): Optional. - Service message: General forum topic hidden. - - .. versionadded:: 20.0 - general_forum_topic_unhidden (:class:`telegram.GeneralForumTopicUnhidden`): Optional. - Service message: General forum topic unhidden. - - .. versionadded:: 20.0 - write_access_allowed (:class:`telegram.WriteAccessAllowed`): Optional. Service message: - the user allowed the bot added to the attachment menu to write messages. - - .. versionadded:: 20.0 - has_media_spoiler (:obj:`bool`): Optional. :obj:`True`, if the message media is covered - by a spoiler animation. - - .. versionadded:: 20.0 - checklist (:class:`telegram.Checklist`): Optional. Message is a checklist - - .. versionadded:: 22.3 - users_shared (:class:`telegram.UsersShared`): Optional. Service message: users were shared - with the bot - - .. versionadded:: 20.8 - chat_shared (:class:`telegram.ChatShared`): Optional. Service message: a chat was shared - with the bot. - - .. versionadded:: 20.1 - gift (:class:`telegram.GiftInfo`): Optional. Service message: a regular gift was sent - or received. - - .. versionadded:: 22.1 - unique_gift (:class:`telegram.UniqueGiftInfo`): Optional. Service message: a unique gift - was sent or received - - .. versionadded:: 22.1 - gift_upgrade_sent (:class:`telegram.GiftInfo`): Optional. Service message: upgrade of a - gift was purchased after the gift was sent - - .. versionadded:: 22.6 - giveaway_created (:class:`telegram.GiveawayCreated`): Optional. Service message: a - scheduled giveaway was created - - .. versionadded:: 20.8 - giveaway (:class:`telegram.Giveaway`): Optional. The message is a scheduled giveaway - message - - .. versionadded:: 20.8 - giveaway_winners (:class:`telegram.GiveawayWinners`): Optional. A giveaway with public - winners was completed - - .. versionadded:: 20.8 - giveaway_completed (:class:`telegram.GiveawayCompleted`): Optional. Service message: a - giveaway without public winners was completed - - .. versionadded:: 20.8 - paid_message_price_changed (:class:`telegram.PaidMessagePriceChanged`): Optional. Service - message: the price for paid messages has changed in the chat - - .. versionadded:: 22.1 - suggested_post_approved (:class:`telegram.SuggestedPostApproved`): Optional. Service - message: a suggested post was approved. - - .. versionadded:: 22.4 - suggested_post_approval_failed (:class:`telegram.SuggestedPostApproved`): Optional. Service - message: approval of a suggested post has failed. - - .. versionadded:: 22.4 - suggested_post_declined (:class:`telegram.SuggestedPostDeclined`): Optional. Service - message: a suggested post was declined. - - .. versionadded:: 22.4 - suggested_post_paid (:class:`telegram.SuggestedPostPaid`): Optional. Service - message: payment for a suggested post was received. - - .. versionadded:: 22.4 - suggested_post_refunded (:class:`telegram.SuggestedPostRefunded`): Optional. Service - message: payment for a suggested post was refunded. - - .. versionadded:: 22.4 - external_reply (:class:`telegram.ExternalReplyInfo`): Optional. Information about the - message that is being replied to, which may come from another chat or forum topic. - - .. versionadded:: 20.8 - quote (:class:`telegram.TextQuote`): Optional. For replies that quote part of the original - message, the quoted part of the message. - - .. versionadded:: 20.8 - forward_origin (:class:`telegram.MessageOrigin`): Optional. Information about the original - message for forwarded messages - - .. versionadded:: 20.8 - reply_to_story (:class:`telegram.Story`): Optional. For replies to a story, the original - story. - - .. versionadded:: 21.0 - boost_added (:class:`telegram.ChatBoostAdded`): Optional. Service message: user boosted - the chat. - - .. versionadded:: 21.0 - sender_boost_count (:obj:`int`): Optional. If the sender of the - message boosted the chat, the number of boosts added by the user. - - .. versionadded:: 21.0 - - business_connection_id (:obj:`str`): Optional. Unique identifier of the business connection - from which the message was received. If non-empty, the message belongs to a chat of the - corresponding business account that is independent from any potential bot chat which - might share the same identifier. - - .. versionadded:: 21.1 - - sender_business_bot (:class:`telegram.User`): Optional. The bot that actually sent the - message on behalf of the business account. Available only for outgoing messages sent - on behalf of the connected business account. - - .. versionadded:: 21.1 - - chat_background_set (:class:`telegram.ChatBackground`): Optional. Service message: chat - background set - - .. versionadded:: 21.2 - checklist_tasks_done (:class:`telegram.ChecklistTasksDone`): Optional. Service message: - some tasks in a checklist were marked as done or not done - - .. versionadded:: 22.3 - checklist_tasks_added (:class:`telegram.ChecklistTasksAdded`): Optional. Service message: - tasks were added to a checklist - - .. versionadded:: 22.3 - paid_media (:class:`telegram.PaidMediaInfo`): Optional. Message contains paid media; - information about the paid media. - - .. versionadded:: 21.4 - refunded_payment (:class:`telegram.RefundedPayment`): Optional. Message is a service - message about a refunded payment, information about the payment. - - .. versionadded:: 21.4 - direct_message_price_changed (:class:`telegram.DirectMessagePriceChanged`): - Optional. Service message: the price for paid messages in the corresponding direct - messages chat of a channel has changed. - - .. versionadded:: 22.3 - is_paid_post (:obj:`bool`): Optional. :obj:`True`, if the message is a paid post. Note that - such posts must not be deleted for 24 hours to receive the payment and can't be edited. - - .. versionadded:: 22.4 - direct_messages_topic (:class:`telegram.DirectMessagesTopic`): Optional. Information about - the direct messages chat topic that contains the message. - - .. versionadded:: 22.4 - reply_to_checklist_task_id (:obj:`int`): Optional. Identifier of the specific checklist - task that is being replied to. - - .. versionadded:: 22.4 - chat_owner_left (:class:`telegram.ChatOwnerLeft`): Optional. Service message: chat owner - has left. - - .. versionadded:: 22.7 - chat_owner_changed (:class:`telegram.ChatOwnerChanged`): Optional. Service message: chat - owner has changed. - - .. versionadded:: 22.7 - sender_tag (:obj:`str`): Optional. Tag or custom title of the sender of the message; for - supergroups only. - - .. versionadded:: 22.7 - poll_option_added (:class:`telegram.PollOptionAdded`): Optional. Service message: - answer option was added to a poll. - - .. versionadded:: NEXT.VERSION - poll_option_deleted (:class:`telegram.PollOptionDeleted`): Optional. Service message: - answer option was deleted from a poll. - - .. versionadded:: NEXT.VERSION - reply_to_poll_option_id (:obj:`str`): Optional. Persistent - identifier of the specific poll option that is being replied to. - - .. versionadded:: NEXT.VERSION - managed_bot_created (:class:`telegram.ManagedBotCreated`): Optional. Service message: user - created a bot that will be managed by the current bot. - - .. versionadded:: NEXT.VERSION - .. |custom_emoji_no_md1_support| replace:: Since custom emoji entities are not supported by :attr:`~telegram.constants.ParseMode.MARKDOWN`, this method now raises a :exc:`ValueError` when encountering a custom emoji. diff --git a/src/telegram/_messageentity.py b/src/telegram/_messageentity.py index 7eebf30c848..a11f548d90b 100644 --- a/src/telegram/_messageentity.py +++ b/src/telegram/_messageentity.py @@ -92,52 +92,6 @@ class MessageEntity(TelegramObject): |datetime_localization| .. versionadded:: 22.7 - Attributes: - type (:obj:`str`): Type of the entity. Can be :attr:`MENTION` (``@username``), - :attr:`HASHTAG` (``#hashtag`` or ``#hashtag@chatusername``), :attr:`CASHTAG` (``$USD`` - or ``USD@chatusername``), :attr:`BOT_COMMAND` (``/start@jobs_bot``), :attr:`URL` - (``https://telegram.org``), :attr:`EMAIL` (``do-not-reply@telegram.org``), - :attr:`PHONE_NUMBER` (``+1-212-555-0123``), - :attr:`BOLD` (**bold text**), :attr:`ITALIC` (*italic text*), :attr:`UNDERLINE` - (underlined text), :attr:`STRIKETHROUGH`, :attr:`SPOILER` (spoiler message), - :attr:`BLOCKQUOTE` (block quotation), :attr:`CODE` (monowidth string), :attr:`PRE` - (monowidth block), :attr:`TEXT_LINK` (for clickable text URLs), :attr:`TEXT_MENTION` - (for users without usernames), :attr:`CUSTOM_EMOJI` (for inline custom emoji stickers) - or :attr:`DATE_TIME` (for formatted date and time). - - .. versionadded:: 20.0 - Added inline custom emoji - - .. versionadded:: 20.8 - Added block quotation - - .. versionadded:: 22.7 - Added date_time - offset (:obj:`int`): Offset in UTF-16 code units to the start of the entity. - length (:obj:`int`): Length of the entity in UTF-16 code units. - url (:obj:`str`): Optional. For :attr:`TEXT_LINK` only, url that will be opened after - user taps on the text. - user (:class:`telegram.User`): Optional. For :attr:`TEXT_MENTION` only, the mentioned - user. - language (:obj:`str`): Optional. For :attr:`PRE` only, the programming language of - the entity text. - custom_emoji_id (:obj:`str`): Optional. For :attr:`CUSTOM_EMOJI` only, unique identifier - of the custom emoji. Use :meth:`telegram.Bot.get_custom_emoji_stickers` to get full - information about the sticker. - - .. versionadded:: 20.0 - date_time_format (:obj:`str`): Optional. For :attr:`DATE_TIME` only, the string that - defines the formatting of the date and time. See `date-time entity formatting - `_ for more details and - :class:`telegram.constants.MessageEntityDateTimeFormats` for all possible formats. - - .. versionadded:: 22.7 - unix_time (:class:`datetime.datetime`): Optional. For :attr:`DATE_TIME` only, the time - associated with the entity. - |datetime_localization| - - .. versionadded:: 22.7 - """ __slots__ = ( diff --git a/src/telegram/_messageid.py b/src/telegram/_messageid.py index 70420936b8b..d77c0436569 100644 --- a/src/telegram/_messageid.py +++ b/src/telegram/_messageid.py @@ -33,12 +33,6 @@ class MessageId(TelegramObject): (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be ``0`` and the relevant message will be unusable until it is actually sent. - - Attributes: - message_id (:obj:`int`): Unique message identifier. In specific instances - (e.g., message containing a video sent to a big chat), the server might automatically - schedule a message instead of sending it immediately. In such cases, this field will be - ``0`` and the relevant message will be unusable until it is actually sent. """ __slots__ = ("message_id",) diff --git a/src/telegram/_messageorigin.py b/src/telegram/_messageorigin.py index 767f5a4a0af..c0d2311dd13 100644 --- a/src/telegram/_messageorigin.py +++ b/src/telegram/_messageorigin.py @@ -54,13 +54,6 @@ class MessageOrigin(TelegramObject): :attr:`~telegram.MessageOrigin.CHAT`, or :attr:`~telegram.MessageOrigin.CHANNEL`. date (:obj:`datetime.datetime`): Date the message was sent originally. |datetime_localization| - - Attributes: - type (:obj:`str`): Type of the message origin, can be on of: - :attr:`~telegram.MessageOrigin.USER`, :attr:`~telegram.MessageOrigin.HIDDEN_USER`, - :attr:`~telegram.MessageOrigin.CHAT`, or :attr:`~telegram.MessageOrigin.CHANNEL`. - date (:obj:`datetime.datetime`): Date the message was sent originally. - |datetime_localization| """ __slots__ = ( @@ -140,9 +133,6 @@ class MessageOriginUser(MessageOrigin): Attributes: type (:obj:`str`): Type of the message origin. Always :tg-const:`~telegram.MessageOrigin.USER`. - date (:obj:`datetime.datetime`): Date the message was sent originally. - |datetime_localization| - sender_user (:class:`telegram.User`): User that sent the message originally. """ __slots__ = ("sender_user",) @@ -174,9 +164,6 @@ class MessageOriginHiddenUser(MessageOrigin): Attributes: type (:obj:`str`): Type of the message origin. Always :tg-const:`~telegram.MessageOrigin.HIDDEN_USER`. - date (:obj:`datetime.datetime`): Date the message was sent originally. - |datetime_localization| - sender_user_name (:obj:`str`): Name of the user that sent the message originally. """ __slots__ = ("sender_user_name",) @@ -210,11 +197,6 @@ class MessageOriginChat(MessageOrigin): Attributes: type (:obj:`str`): Type of the message origin. Always :tg-const:`~telegram.MessageOrigin.CHAT`. - date (:obj:`datetime.datetime`): Date the message was sent originally. - |datetime_localization| - sender_chat (:class:`telegram.Chat`): Chat that sent the message originally. - author_signature (:obj:`str`): Optional. For messages originally sent by an anonymous chat - administrator, original message author signature """ __slots__ = ( @@ -253,11 +235,6 @@ class MessageOriginChannel(MessageOrigin): Attributes: type (:obj:`str`): Type of the message origin. Always :tg-const:`~telegram.MessageOrigin.CHANNEL`. - date (:obj:`datetime.datetime`): Date the message was sent originally. - |datetime_localization| - chat (:class:`telegram.Chat`): Channel chat to which the message was originally sent. - message_id (:obj:`int`): Unique message identifier inside the chat. - author_signature (:obj:`str`): Optional. Signature of the original post author. """ __slots__ = ( diff --git a/src/telegram/_messagereactionupdated.py b/src/telegram/_messagereactionupdated.py index d5e5471954f..d0be41fb66f 100644 --- a/src/telegram/_messagereactionupdated.py +++ b/src/telegram/_messagereactionupdated.py @@ -50,14 +50,6 @@ class MessageReactionCountUpdated(TelegramObject): |datetime_localization| reactions (Sequence[:class:`telegram.ReactionCount`]): List of reactions that are present on the message - - Attributes: - chat (:class:`telegram.Chat`): The chat containing the message. - message_id (:obj:`int`): Unique message identifier inside the chat. - date (:class:`datetime.datetime`): Date of the change in Unix time - |datetime_localization| - reactions (tuple[:class:`telegram.ReactionCount`]): List of reactions that are present on - the message """ __slots__ = ( @@ -123,20 +115,6 @@ class MessageReactionUpdated(TelegramObject): isn't anonymous. actor_chat (:class:`telegram.Chat`, optional): The chat on behalf of which the reaction was changed, if the user is anonymous. - - Attributes: - chat (:class:`telegram.Chat`): The chat containing the message. - message_id (:obj:`int`): Unique message identifier inside the chat. - date (:class:`datetime.datetime`): Date of the change in Unix time. - |datetime_localization| - old_reaction (tuple[:class:`telegram.ReactionType`]): Previous list of reaction types - that were set by the user. - new_reaction (tuple[:class:`telegram.ReactionType`]): New list of reaction types that - were set by the user. - user (:class:`telegram.User`): Optional. The user that changed the reaction, if the user - isn't anonymous. - actor_chat (:class:`telegram.Chat`): Optional. The chat on behalf of which the reaction was - changed, if the user is anonymous. """ __slots__ = ( diff --git a/src/telegram/_ownedgift.py b/src/telegram/_ownedgift.py index 37ae8f693a6..8696552a241 100644 --- a/src/telegram/_ownedgift.py +++ b/src/telegram/_ownedgift.py @@ -52,9 +52,6 @@ class OwnedGift(TelegramObject): Args: type (:obj:`str`): Type of the owned gift. - - Attributes: - type (:obj:`str`): Type of the owned gift. """ __slots__ = ("type",) @@ -115,12 +112,6 @@ class OwnedGifts(TelegramObject): gifts (Sequence[:class:`telegram.OwnedGift`]): The list of gifts. next_offset (:obj:`str`, optional): Offset for the next request. If empty, then there are no more results. - - Attributes: - total_count (:obj:`int`): The total number of gifts owned by the user or the chat. - gifts (Sequence[:class:`telegram.OwnedGift`]): The list of gifts. - next_offset (:obj:`str`): Optional. Offset for the next request. If empty, - then there are no more results. """ __slots__ = ( @@ -197,37 +188,6 @@ class OwnedGiftRegular(OwnedGift): Attributes: type (:obj:`str`): Type of the gift, always :attr:`~telegram.OwnedGift.REGULAR`. - gift (:class:`telegram.Gift`): Information about the regular gift. - owned_gift_id (:obj:`str`): Optional. Unique identifier of the gift for the bot; for - gifts received on behalf of business accounts only. - sender_user (:class:`telegram.User`): Optional. Sender of the gift if it is a known user. - send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`. - |datetime_localization|. - text (:obj:`str`): Optional. Text of the message that was added to the gift. - entities (Sequence[:class:`telegram.MessageEntity`]): Optional. Special entities that - appear in the text. - is_private (:obj:`bool`): Optional. :obj:`True`, if the sender and gift text are shown - only to the gift receiver; otherwise, everyone will be able to see them. - is_saved (:obj:`bool`): Optional. :obj:`True`, if the gift is displayed on the account's - profile page; for gifts received on behalf of business accounts only. - can_be_upgraded (:obj:`bool`): Optional. :obj:`True`, if the gift can be upgraded to a - unique gift; for gifts received on behalf of business accounts only. - was_refunded (:obj:`bool`): Optional. :obj:`True`, if the gift was refunded and isn't - available anymore. - convert_star_count (:obj:`int`): Optional. Number of Telegram Stars that can be - claimed by the receiver instead of the gift; omitted if the gift cannot be converted - to Telegram Stars; for gifts received on behalf of business accounts only. - prepaid_upgrade_star_count (:obj:`int`): Optional. Number of Telegram Stars that were - paid for the ability to upgrade the gift. - is_upgrade_separate (:obj:`bool`): Optional. :obj:`True`, if the gift's upgrade was - purchased after the gift was sent; for gifts received on behalf of business accounts - - .. versionadded:: 22.6 - unique_gift_number (:obj:`int`): Optional. Unique number reserved for this gift when - upgraded. See the number field in :class:`~telegram.UniqueGift` - - ... versionadded:: 22.6 - """ __slots__ = ( @@ -383,22 +343,6 @@ class OwnedGiftUnique(OwnedGift): Attributes: type (:obj:`str`): Type of the owned gift, always :tg-const:`~telegram.OwnedGift.UNIQUE`. - gift (:class:`telegram.UniqueGift`): Information about the unique gift. - owned_gift_id (:obj:`str`): Optional. Unique identifier of the received gift for the - bot; for gifts received on behalf of business accounts only. - sender_user (:class:`telegram.User`): Optional. Sender of the gift if it is a known user. - send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`. - |datetime_localization| - is_saved (:obj:`bool`): Optional. :obj:`True`, if the gift is displayed on the account's - profile page; for gifts received on behalf of business accounts only. - can_be_transferred (:obj:`bool`): Optional. :obj:`True`, if the gift can be transferred to - another owner; for gifts received on behalf of business accounts only. - transfer_star_count (:obj:`int`): Optional. Number of Telegram Stars that must be paid - to transfer the gift; omitted if the bot cannot transfer the gift. - next_transfer_date (:obj:`datetime.datetime`): Optional. Date when the gift can be - transferred. If it's in the past, then the gift can be transferred now. - |datetime_localization| - .. versionadded:: 22.3 """ __slots__ = ( diff --git a/src/telegram/_paidmedia.py b/src/telegram/_paidmedia.py index 67af46710a5..c96b33b50a2 100644 --- a/src/telegram/_paidmedia.py +++ b/src/telegram/_paidmedia.py @@ -55,9 +55,6 @@ class PaidMedia(TelegramObject): Args: type (:obj:`str`): Type of the paid media. - - Attributes: - type (:obj:`str`): Type of the paid media. """ __slots__ = ("type",) @@ -125,7 +122,6 @@ class PaidMediaPreview(PaidMedia): equality comparison now considers integer durations and equivalent timedeltas as equal. Args: - type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PREVIEW`. width (:obj:`int`, optional): Media width as defined by the sender. height (:obj:`int`, optional): Media height as defined by the sender. duration (:obj:`int` | :class:`datetime.timedelta`, optional): Duration of the media in @@ -136,8 +132,6 @@ class PaidMediaPreview(PaidMedia): Attributes: type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PREVIEW`. - width (:obj:`int`): Optional. Media width as defined by the sender. - height (:obj:`int`): Optional. Media height as defined by the sender. duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Duration of the media in seconds as defined by the sender. @@ -179,12 +173,10 @@ class PaidMediaPhoto(PaidMedia): .. versionadded:: 21.4 Args: - type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PHOTO`. photo (Sequence[:class:`telegram.PhotoSize`]): The photo. Attributes: type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PHOTO`. - photo (tuple[:class:`telegram.PhotoSize`]): The photo. """ __slots__ = ("photo",) @@ -220,12 +212,10 @@ class PaidMediaVideo(PaidMedia): .. versionadded:: 21.4 Args: - type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.VIDEO`. video (:class:`telegram.Video`): The video. Attributes: type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.VIDEO`. - video (:class:`telegram.Video`): The video. """ __slots__ = ("video",) @@ -264,11 +254,6 @@ class PaidMediaInfo(TelegramObject): star_count (:obj:`int`): The number of Telegram Stars that must be paid to buy access to the media. paid_media (Sequence[:class:`telegram.PaidMedia`]): Information about the paid media. - - Attributes: - star_count (:obj:`int`): The number of Telegram Stars that must be paid to buy access to - the media. - paid_media (tuple[:class:`telegram.PaidMedia`]): Information about the paid media. """ __slots__ = ("paid_media", "star_count") @@ -309,10 +294,6 @@ class PaidMediaPurchased(TelegramObject): Args: from_user (:class:`telegram.User`): User who purchased the media. paid_media_payload (:obj:`str`): Bot-specified paid media payload. - - Attributes: - from_user (:class:`telegram.User`): User who purchased the media. - paid_media_payload (:obj:`str`): Bot-specified paid media payload. """ __slots__ = ("from_user", "paid_media_payload") diff --git a/src/telegram/_paidmessagepricechanged.py b/src/telegram/_paidmessagepricechanged.py index d5fa78692ee..9cc422a0f00 100644 --- a/src/telegram/_paidmessagepricechanged.py +++ b/src/telegram/_paidmessagepricechanged.py @@ -33,10 +33,6 @@ class PaidMessagePriceChanged(TelegramObject): Args: paid_message_star_count (:obj:`int`): The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message - - Attributes: - paid_message_star_count (:obj:`int`): The new number of Telegram Stars that must be paid by - non-administrator users of the supergroup chat for each sent message """ __slots__ = ("paid_message_star_count",) diff --git a/src/telegram/_passport/credentials.py b/src/telegram/_passport/credentials.py index d5a16443980..648f5d06d2e 100644 --- a/src/telegram/_passport/credentials.py +++ b/src/telegram/_passport/credentials.py @@ -121,14 +121,6 @@ class EncryptedCredentials(TelegramObject): authentication or base64 encrypted data. hash (:obj:`str`): Base64-encoded data hash for data authentication. secret (:obj:`str`): Decrypted or encrypted secret used for decryption. - - Attributes: - data (:class:`telegram.Credentials` | :obj:`str`): Decrypted data with unique user's - nonce, data hashes and secrets used for EncryptedPassportElement decryption and - authentication or base64 encrypted data. - hash (:obj:`str`): Base64-encoded data hash for data authentication. - secret (:obj:`str`): Decrypted or encrypted secret used for decryption. - """ __slots__ = ( @@ -212,7 +204,7 @@ def decrypted_data(self) -> "Credentials": class Credentials(TelegramObject): """ - Attributes: + Args: secure_data (:class:`telegram.SecureData`): Credentials for encrypted data nonce (:obj:`str`): Bot-specified nonce """ @@ -269,28 +261,6 @@ class SecureData(TelegramObject): registration from internal passport. temporary_registration (:class:`telegram.SecureValue`, optional): Credentials for encrypted temporary registration. - - Attributes: - personal_details (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - personal details. - passport (:class:`telegram.SecureValue`): Optional. Credentials for encrypted passport. - internal_passport (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - internal passport. - driver_license (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - driver license. - identity_card (:class:`telegram.SecureValue`): Optional. Credentials for encrypted ID card - address (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - residential address. - utility_bill (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - utility bill. - bank_statement (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - bank statement. - rental_agreement (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - rental agreement. - passport_registration (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - registration from internal passport. - temporary_registration (:class:`telegram.SecureValue`): Optional. Credentials for encrypted - temporary registration. """ __slots__ = ( @@ -383,43 +353,13 @@ class SecureValue(TelegramObject): selfie (:class:`telegram.FileCredentials`, optional): Credentials for encrypted selfie of the user with a document. Can be available for "passport", "driver_license", "identity_card" and "internal_passport". - translation (list[:class:`telegram.FileCredentials`], optional): Credentials for an + translation (Sequence[:class:`telegram.FileCredentials`], optional): Credentials for an encrypted translation of the document. Available for "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration". - files (list[:class:`telegram.FileCredentials`], optional): Credentials for encrypted + files (Sequence[:class:`telegram.FileCredentials`], optional): Credentials for encrypted files. Available for "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration" types. - - Attributes: - data (:class:`telegram.DataCredentials`): Optional. Credentials for encrypted Telegram - Passport data. Available for "personal_details", "passport", "driver_license", - "identity_card", "identity_passport" and "address" types. - front_side (:class:`telegram.FileCredentials`): Optional. Credentials for encrypted - document's front side. Available for "passport", "driver_license", "identity_card" - and "internal_passport". - reverse_side (:class:`telegram.FileCredentials`): Optional. Credentials for encrypted - document's reverse side. Available for "driver_license" and "identity_card". - selfie (:class:`telegram.FileCredentials`): Optional. Credentials for encrypted selfie - of the user with a document. Can be available for "passport", "driver_license", - "identity_card" and "internal_passport". - translation (tuple[:class:`telegram.FileCredentials`]): Optional. Credentials for an - encrypted translation of the document. Available for "passport", "driver_license", - "identity_card", "internal_passport", "utility_bill", "bank_statement", - "rental_agreement", "passport_registration" and "temporary_registration". - - .. versionchanged:: 20.0 - |tupleclassattrs| - - files (tuple[:class:`telegram.FileCredentials`]): Optional. Credentials for encrypted - files. Available for "utility_bill", "bank_statement", "rental_agreement", - "passport_registration" and "temporary_registration" types. - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - """ __slots__ = ("data", "files", "front_side", "reverse_side", "selfie", "translation") @@ -492,8 +432,8 @@ class DataCredentials(_CredentialsBase): secret (:obj:`str`): Secret of encrypted data Attributes: - hash (:obj:`str`): Checksum of encrypted data - secret (:obj:`str`): Secret of encrypted data + hash (:obj:`str`): Checksum of encrypted data. + file_hash (:obj:`str`): Alias for :attr:`hash`. """ __slots__ = () @@ -513,8 +453,8 @@ class FileCredentials(_CredentialsBase): secret (:obj:`str`): Secret of encrypted file Attributes: - hash (:obj:`str`): Checksum of encrypted file - secret (:obj:`str`): Secret of encrypted file + hash (:obj:`str`): Checksum of encrypted file. + data_hash (:obj:`str`): Alias for :attr:`hash`. """ __slots__ = () diff --git a/src/telegram/_passport/data.py b/src/telegram/_passport/data.py index 57261496a8e..b4e4b2050d9 100644 --- a/src/telegram/_passport/data.py +++ b/src/telegram/_passport/data.py @@ -41,22 +41,6 @@ class PersonalDetails(TelegramObject): country of residence. last_name_native (:obj:`str`): Last Name in the language of the user's country of residence. - - Attributes: - first_name (:obj:`str`): First Name. - middle_name (:obj:`str`): Optional. First Name. - last_name (:obj:`str`): Last Name. - birth_date (:obj:`str`): Date of birth in DD.MM.YYYY format. - gender (:obj:`str`): Gender, male or female. - country_code (:obj:`str`): Citizenship (ISO 3166-1 alpha-2 country code). - residence_country_code (:obj:`str`): Country of residence (ISO 3166-1 alpha-2 country - code). - first_name_native (:obj:`str`): First Name in the language of the user's country of - residence. - middle_name_native (:obj:`str`): Optional. Middle Name in the language of the user's - country of residence. - last_name_native (:obj:`str`): Last Name in the language of the user's country of - residence. """ __slots__ = ( @@ -114,14 +98,6 @@ class ResidentialAddress(TelegramObject): state (:obj:`str`): Optional. State. country_code (:obj:`str`): ISO 3166-1 alpha-2 country code. post_code (:obj:`str`): Address post code. - - Attributes: - street_line1 (:obj:`str`): First line for the address. - street_line2 (:obj:`str`): Optional. Second line for the address. - city (:obj:`str`): City. - state (:obj:`str`): Optional. State. - country_code (:obj:`str`): ISO 3166-1 alpha-2 country code. - post_code (:obj:`str`): Address post code. """ __slots__ = ( @@ -163,10 +139,6 @@ class IdDocumentData(TelegramObject): Args: document_no (:obj:`str`): Document number. expiry_date (:obj:`str`): Optional. Date of expiry, in DD.MM.YYYY format. - - Attributes: - document_no (:obj:`str`): Document number. - expiry_date (:obj:`str`): Optional. Date of expiry, in DD.MM.YYYY format. """ __slots__ = ("document_no", "expiry_date") diff --git a/src/telegram/_passport/encryptedpassportelement.py b/src/telegram/_passport/encryptedpassportelement.py index 8b4bdfbd77e..7e80f22306d 100644 --- a/src/telegram/_passport/encryptedpassportelement.py +++ b/src/telegram/_passport/encryptedpassportelement.py @@ -70,10 +70,6 @@ class EncryptedPassportElement(TelegramObject): files with documents provided by the user; available only for "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration" types. - - .. versionchanged:: 20.0 - |sequenceclassargs| - front_side (:class:`telegram.PassportFile`, optional): Encrypted/decrypted file with the front side of the document, provided by the user; Available only for "passport", "driver_license", "identity_card" and "internal_passport". @@ -88,55 +84,6 @@ class EncryptedPassportElement(TelegramObject): available if requested requested for "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration" types. - - .. versionchanged:: 20.0 - |sequenceclassargs| - - Attributes: - type (:obj:`str`): Element type. One of "personal_details", "passport", "driver_license", - "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", - "rental_agreement", "passport_registration", "temporary_registration", "phone_number", - "email". - hash (:obj:`str`): Base64-encoded element hash for using in - :class:`telegram.PassportElementErrorUnspecified`. - data (:class:`telegram.PersonalDetails` | :class:`telegram.IdDocumentData` | \ - :class:`telegram.ResidentialAddress` | :obj:`str`): - Optional. Decrypted or encrypted data; available only for "personal_details", - "passport", "driver_license", "identity_card", "internal_passport" and "address" types. - phone_number (:obj:`str`): Optional. User's verified phone number; available only for - "phone_number" type. - email (:obj:`str`): Optional. User's verified email address; available only for "email" - type. - files (tuple[:class:`telegram.PassportFile`]): Optional. Array of encrypted/decrypted - files with documents provided by the user; available only for "utility_bill", - "bank_statement", "rental_agreement", "passport_registration" and - "temporary_registration" types. - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - - front_side (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the - front side of the document, provided by the user; available only for "passport", - "driver_license", "identity_card" and "internal_passport". - reverse_side (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the - reverse side of the document, provided by the user; available only for "driver_license" - and "identity_card". - selfie (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the - selfie of the user holding a document, provided by the user; available if requested for - "passport", "driver_license", "identity_card" and "internal_passport". - translation (tuple[:class:`telegram.PassportFile`]): Optional. Array of - encrypted/decrypted files with translated versions of documents provided by the user; - available if requested for "passport", "driver_license", "identity_card", - "internal_passport", "utility_bill", "bank_statement", "rental_agreement", - "passport_registration" and "temporary_registration" types. - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| - """ __slots__ = ( diff --git a/src/telegram/_passport/passportdata.py b/src/telegram/_passport/passportdata.py index deae7196f3a..725f37f1a1f 100644 --- a/src/telegram/_passport/passportdata.py +++ b/src/telegram/_passport/passportdata.py @@ -36,31 +36,15 @@ class PassportData(TelegramObject): Note: To be able to decrypt this object, you must pass your ``private_key`` to either - :class:`telegram.ext.Updater` or :class:`telegram.Bot`. Decrypted data is then found in - :attr:`decrypted_data` and the payload can be found in :attr:`decrypted_credentials`'s - attribute :attr:`telegram.Credentials.nonce`. + :class:`telegram.ext.ApplicationBuilder` or :class:`telegram.Bot`. Decrypted data is + then found in :attr:`decrypted_data` and the payload can be found in + :attr:`decrypted_credentials`'s attribute :attr:`telegram.Credentials.nonce`. Args: data (Sequence[:class:`telegram.EncryptedPassportElement`]): Array with encrypted information about documents and other Telegram Passport elements that was shared with the bot. - - .. versionchanged:: 20.0 - |sequenceclassargs| - - credentials (:class:`telegram.EncryptedCredentials`)): Encrypted credentials. - - Attributes: - data (tuple[:class:`telegram.EncryptedPassportElement`]): Array with encrypted - information about documents and other Telegram Passport elements that was shared with - the bot. - - .. versionchanged:: 20.0 - |tupleclassattrs| - credentials (:class:`telegram.EncryptedCredentials`): Encrypted credentials. - - """ __slots__ = ("_decrypted_data", "credentials", "data") diff --git a/src/telegram/_passport/passportelementerrors.py b/src/telegram/_passport/passportelementerrors.py index bba589ee2cb..eb542f4044d 100644 --- a/src/telegram/_passport/passportelementerrors.py +++ b/src/telegram/_passport/passportelementerrors.py @@ -27,7 +27,7 @@ class PassportElementError(TelegramObject): - """Baseclass for the PassportElementError* classes. + """Base class for the PassportElementError* classes. This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. @@ -39,12 +39,6 @@ class PassportElementError(TelegramObject): source (:obj:`str`): Error source. type (:obj:`str`): The section of the user's Telegram Passport which has the error. message (:obj:`str`): Error message. - - Attributes: - source (:obj:`str`): Error source. - type (:obj:`str`): The section of the user's Telegram Passport which has the error. - message (:obj:`str`): Error message. - """ __slots__ = ("message", "source", "type") @@ -81,13 +75,7 @@ class PassportElementErrorDataField(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the error, one of - ``"personal_details"``, ``"passport"``, ``"driver_license"``, ``"identity_card"``, - ``"internal_passport"``, ``"address"``. - field_name (:obj:`str`): Name of the data field which has the error. - data_hash (:obj:`str`): Base64-encoded data hash. - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"data"``. """ __slots__ = ("data_hash", "field_name") @@ -133,12 +121,7 @@ class PassportElementErrorFile(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - ``"utility_bill"``, ``"bank_statement"``, ``"rental_agreement"``, - ``"passport_registration"``, ``"temporary_registration"``. - file_hash (:obj:`str`): Base64-encoded file hash. - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"file"``. """ __slots__ = ("file_hash",) @@ -168,21 +151,10 @@ class PassportElementErrorFiles(PassportElementError): ``"utility_bill"``, ``"bank_statement"``, ``"rental_agreement"``, ``"passport_registration"``, ``"temporary_registration"``. file_hashes (Sequence[:obj:`str`]): List of base64-encoded file hashes. - - .. versionchanged:: 22.0 - |sequenceargs| message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - ``"utility_bill"``, ``"bank_statement"``, ``"rental_agreement"``, - ``"passport_registration"``, ``"temporary_registration"``. - file_hashes (tuple[:obj:`str`]): List of base64-encoded file hashes. - - .. versionchanged:: 22.0 - |tupleclassattrs| - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"files"``. """ __slots__ = ("file_hashes",) @@ -220,12 +192,7 @@ class PassportElementErrorFrontSide(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - ``"passport"``, ``"driver_license"``, ``"identity_card"``, ``"internal_passport"``. - file_hash (:obj:`str`): Base64-encoded hash of the file with the front side of the - document. - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"front_side"``. """ __slots__ = ("file_hash",) @@ -258,12 +225,7 @@ class PassportElementErrorReverseSide(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - ``"driver_license"``, ``"identity_card"``. - file_hash (:obj:`str`): Base64-encoded hash of the file with the reverse side of the - document. - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"reverse_side"``. """ __slots__ = ("file_hash",) @@ -295,11 +257,7 @@ class PassportElementErrorSelfie(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - ``"passport"``, ``"driver_license"``, ``"identity_card"``, ``"internal_passport"``. - file_hash (:obj:`str`): Base64-encoded hash of the file with the selfie. - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"selfie"``. """ __slots__ = ("file_hash",) @@ -333,13 +291,7 @@ class PassportElementErrorTranslationFile(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, - one of ``"passport"``, ``"driver_license"``, ``"identity_card"``, - ``"internal_passport"``, ``"utility_bill"``, ``"bank_statement"``, - ``"rental_agreement"``, ``"passport_registration"``, ``"temporary_registration"``. - file_hash (:obj:`str`): Base64-encoded hash of the file. - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"translation_file"``. """ __slots__ = ("file_hash",) @@ -376,16 +328,7 @@ class PassportElementErrorTranslationFiles(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, - one of ``"passport"``, ``"driver_license"``, ``"identity_card"``, - ``"internal_passport"``, ``"utility_bill"``, ``"bank_statement"``, - ``"rental_agreement"``, ``"passport_registration"``, ``"temporary_registration"``. - file_hashes (tuple[:obj:`str`]): List of base64-encoded file hashes. - - .. versionchanged:: 22.0 - |tupleclassattrs| - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"translation_files"``. """ __slots__ = ("file_hashes",) @@ -421,10 +364,7 @@ class PassportElementErrorUnspecified(PassportElementError): message (:obj:`str`): Error message. Attributes: - type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue. - element_hash (:obj:`str`): Base64-encoded element hash. - message (:obj:`str`): Error message. - + source (:obj:`str`): Error source, always ``"unspecified"``. """ __slots__ = ("element_hash",) diff --git a/src/telegram/_passport/passportfile.py b/src/telegram/_passport/passportfile.py index 724fb51ed1c..edbab6c0b53 100644 --- a/src/telegram/_passport/passportfile.py +++ b/src/telegram/_passport/passportfile.py @@ -50,19 +50,6 @@ class PassportFile(TelegramObject): .. versionchanged:: 22.0 Accepts only :class:`datetime.datetime` instead of :obj:`int`. |datetime_localization| - - Attributes: - file_id (:obj:`str`): Identifier for this file, which can be used to download - or reuse the file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - file_size (:obj:`int`): File size in bytes. - file_date (:class:`datetime.datetime`): Time when the file was uploaded. - - .. versionchanged:: 22.0 - Returns :class:`datetime.datetime` instead of :obj:`int`. - |datetime_localization| """ __slots__ = ( diff --git a/src/telegram/_payment/invoice.py b/src/telegram/_payment/invoice.py index be7d7df173a..0db45702fb5 100644 --- a/src/telegram/_payment/invoice.py +++ b/src/telegram/_payment/invoice.py @@ -45,21 +45,6 @@ class Invoice(TelegramObject): `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - - Attributes: - title (:obj:`str`): Product name. - description (:obj:`str`): Product description. - start_parameter (:obj:`str`): Unique bot deep-linking parameter that can be used to - generate this invoice. - currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in - |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, - **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. - See the ``exp`` parameter in - `currencies.json `_, - it shows the number of digits past the decimal point for each currency - (2 for the majority of currencies). - """ __slots__ = ( diff --git a/src/telegram/_payment/labeledprice.py b/src/telegram/_payment/labeledprice.py index a9526d4f069..27da6237854 100644 --- a/src/telegram/_payment/labeledprice.py +++ b/src/telegram/_payment/labeledprice.py @@ -39,16 +39,6 @@ class LabeledPrice(TelegramObject): `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - - Attributes: - label (:obj:`str`): Portion label. - amount (:obj:`int`): Price of the product in the smallest units of the currency (integer, - **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. - See the ``exp`` parameter in - `currencies.json `_, - it shows the number of digits past the decimal point for each currency - (2 for the majority of currencies). - """ __slots__ = ("amount", "label") diff --git a/src/telegram/_payment/orderinfo.py b/src/telegram/_payment/orderinfo.py index c3f8a798d80..f8885d9485f 100644 --- a/src/telegram/_payment/orderinfo.py +++ b/src/telegram/_payment/orderinfo.py @@ -41,13 +41,6 @@ class OrderInfo(TelegramObject): phone_number (:obj:`str`, optional): User's phone number. email (:obj:`str`, optional): User email. shipping_address (:class:`telegram.ShippingAddress`, optional): User shipping address. - - Attributes: - name (:obj:`str`): Optional. User name. - phone_number (:obj:`str`): Optional. User's phone number. - email (:obj:`str`): Optional. User email. - shipping_address (:class:`telegram.ShippingAddress`): Optional. User shipping address. - """ __slots__ = ("email", "name", "phone_number", "shipping_address") diff --git a/src/telegram/_payment/precheckoutquery.py b/src/telegram/_payment/precheckoutquery.py index 94acae703cb..4dd72c54c0e 100644 --- a/src/telegram/_payment/precheckoutquery.py +++ b/src/telegram/_payment/precheckoutquery.py @@ -55,24 +55,6 @@ class PreCheckoutQuery(TelegramObject): shipping_option_id (:obj:`str`, optional): Identifier of the shipping option chosen by the user. order_info (:class:`telegram.OrderInfo`, optional): Order info provided by the user. - - Attributes: - id (:obj:`str`): Unique query identifier. - from_user (:class:`telegram.User`): User who sent the query. - currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in - |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, - **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. - See the ``exp`` parameter in - `currencies.json `_, - it shows the number of digits past the decimal point for each currency - (2 for the majority of currencies). - invoice_payload (:obj:`str`): Bot-specified invoice payload. - shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the - user. - order_info (:class:`telegram.OrderInfo`): Optional. Order info provided by the user. - - """ __slots__ = ( diff --git a/src/telegram/_payment/refundedpayment.py b/src/telegram/_payment/refundedpayment.py index f29fe0face6..ab88ac6022e 100644 --- a/src/telegram/_payment/refundedpayment.py +++ b/src/telegram/_payment/refundedpayment.py @@ -43,21 +43,6 @@ class RefundedPayment(TelegramObject): invoice_payload (:obj:`str`): Bot-specified invoice payload. telegram_payment_charge_id (:obj:`str`): Telegram payment identifier. provider_payment_charge_id (:obj:`str`, optional): Provider payment identifier. - - Attributes: - currency (:obj:`str`): Three-letter ISO 4217 `currency - `_ code, or ``XTR`` for - payments in |tg_stars|. Currently, always ``XTR``. - total_amount (:obj:`int`): Total refunded price in the *smallest units* of the currency - (integer, **not** float/double). For example, for a price of ``US$ 1.45``, - ``total_amount = 145``. See the *exp* parameter in - `currencies.json `_, - it shows the number of digits past the decimal point for each currency - (2 for the majority of currencies). - invoice_payload (:obj:`str`): Bot-specified invoice payload. - telegram_payment_charge_id (:obj:`str`): Telegram payment identifier. - provider_payment_charge_id (:obj:`str`): Optional. Provider payment identifier. - """ __slots__ = ( diff --git a/src/telegram/_payment/shippingaddress.py b/src/telegram/_payment/shippingaddress.py index 22e2f0c2860..dae84115d93 100644 --- a/src/telegram/_payment/shippingaddress.py +++ b/src/telegram/_payment/shippingaddress.py @@ -36,15 +36,6 @@ class ShippingAddress(TelegramObject): street_line1 (:obj:`str`): First line for the address. street_line2 (:obj:`str`): Second line for the address. post_code (:obj:`str`): Address post code. - - Attributes: - country_code (:obj:`str`): ISO 3166-1 alpha-2 country code. - state (:obj:`str`): State, if applicable. - city (:obj:`str`): City. - street_line1 (:obj:`str`): First line for the address. - street_line2 (:obj:`str`): Second line for the address. - post_code (:obj:`str`): Address post code. - """ __slots__ = ( diff --git a/src/telegram/_payment/shippingoption.py b/src/telegram/_payment/shippingoption.py index 0b0a987a013..8fb16adf5f2 100644 --- a/src/telegram/_payment/shippingoption.py +++ b/src/telegram/_payment/shippingoption.py @@ -42,18 +42,6 @@ class ShippingOption(TelegramObject): id (:obj:`str`): Shipping option identifier. title (:obj:`str`): Option title. prices (Sequence[:class:`telegram.LabeledPrice`]): List of price portions. - - .. versionchanged:: 20.0 - |sequenceclassargs| - - Attributes: - id (:obj:`str`): Shipping option identifier. - title (:obj:`str`): Option title. - prices (tuple[:class:`telegram.LabeledPrice`]): List of price portions. - - .. versionchanged:: 20.0 - |tupleclassattrs| - """ __slots__ = ("id", "prices", "title") diff --git a/src/telegram/_payment/shippingquery.py b/src/telegram/_payment/shippingquery.py index 2b3f92b3a16..d2cd004c94d 100644 --- a/src/telegram/_payment/shippingquery.py +++ b/src/telegram/_payment/shippingquery.py @@ -47,14 +47,6 @@ class ShippingQuery(TelegramObject): from_user (:class:`telegram.User`): User who sent the query. invoice_payload (:obj:`str`): Bot-specified invoice payload. shipping_address (:class:`telegram.ShippingAddress`): User specified shipping address. - - Attributes: - id (:obj:`str`): Unique query identifier. - from_user (:class:`telegram.User`): User who sent the query. - invoice_payload (:obj:`str`): Bot-specified invoice payload. - shipping_address (:class:`telegram.ShippingAddress`): User specified shipping address. - - """ __slots__ = ("from_user", "id", "invoice_payload", "shipping_address") diff --git a/src/telegram/_payment/stars/affiliateinfo.py b/src/telegram/_payment/stars/affiliateinfo.py index 5b178f74483..00e41392386 100644 --- a/src/telegram/_payment/stars/affiliateinfo.py +++ b/src/telegram/_payment/stars/affiliateinfo.py @@ -54,22 +54,6 @@ class AffiliateInfo(TelegramObject): :tg-const:`~telegram.constants.NanostarLimit.MIN_AMOUNT` to :tg-const:`~telegram.constants.NanostarLimit.MAX_AMOUNT`; can be negative for refunds - - Attributes: - affiliate_user (:class:`telegram.User`): Optional. The bot or the user that received an - affiliate commission if it was received by a bot or a user - affiliate_chat (:class:`telegram.Chat`): Optional. The chat that received an affiliate - commission if it was received by a chat - commission_per_mille (:obj:`int`): The number of Telegram Stars received by the affiliate - for each 1000 Telegram Stars received by the bot from referred users - amount (:obj:`int`): Integer amount of Telegram Stars received by the affiliate from the - transaction, rounded to 0; can be negative for refunds - nanostar_amount (:obj:`int`): Optional. The number of - :tg-const:`~telegram.constants.Nanostar.VALUE` shares of Telegram - Stars received by the affiliate; from - :tg-const:`~telegram.constants.NanostarLimit.MIN_AMOUNT` to - :tg-const:`~telegram.constants.NanostarLimit.MAX_AMOUNT`; - can be negative for refunds """ __slots__ = ( diff --git a/src/telegram/_payment/stars/revenuewithdrawalstate.py b/src/telegram/_payment/stars/revenuewithdrawalstate.py index beb0e7de74f..8704e53dbd9 100644 --- a/src/telegram/_payment/stars/revenuewithdrawalstate.py +++ b/src/telegram/_payment/stars/revenuewithdrawalstate.py @@ -47,9 +47,6 @@ class RevenueWithdrawalState(TelegramObject): Args: type (:obj:`str`): The type of the state. - - Attributes: - type (:obj:`str`): The type of the state. """ __slots__ = ("type",) @@ -127,8 +124,6 @@ class RevenueWithdrawalStateSucceeded(RevenueWithdrawalState): Attributes: type (:obj:`str`): The type of the state, always :tg-const:`telegram.RevenueWithdrawalState.SUCCEEDED`. - date (:obj:`datetime.datetime`): Date the withdrawal was completed as a datetime object. - url (:obj:`str`): An HTTPS URL that can be used to see transaction details. """ __slots__ = ("date", "url") diff --git a/src/telegram/_payment/stars/staramount.py b/src/telegram/_payment/stars/staramount.py index 38765d8c8a9..7c4c75a59c0 100644 --- a/src/telegram/_payment/stars/staramount.py +++ b/src/telegram/_payment/stars/staramount.py @@ -35,15 +35,6 @@ class StarAmount(TelegramObject): Stars; from :tg-const:`telegram.constants.NanostarLimit.MIN_AMOUNT` to :tg-const:`telegram.constants.NanostarLimit.MAX_AMOUNT`; can be negative if and only if :attr:`amount` is non-positive. - - Attributes: - amount (:obj:`int`): Integer amount of Telegram Stars, rounded to ``0``; can be negative. - nanostar_amount (:obj:`int`): Optional. The number of - :tg-const:`telegram.constants.Nanostar.VALUE` shares of Telegram - Stars; from :tg-const:`telegram.constants.NanostarLimit.MIN_AMOUNT` - to :tg-const:`telegram.constants.NanostarLimit.MAX_AMOUNT`; can be - negative if and only if :attr:`amount` is non-positive. - """ __slots__ = ("amount", "nanostar_amount") diff --git a/src/telegram/_payment/stars/startransactions.py b/src/telegram/_payment/stars/startransactions.py index b8502fd8fd7..a3f9073c307 100644 --- a/src/telegram/_payment/stars/startransactions.py +++ b/src/telegram/_payment/stars/startransactions.py @@ -58,32 +58,13 @@ class StarTransaction(TelegramObject): .. versionadded:: 21.9 date (:obj:`datetime.datetime`): Date the transaction was created as a datetime object. + |datetime_localization| source (:class:`telegram.TransactionPartner`, optional): Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions. receiver (:class:`telegram.TransactionPartner`, optional): Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions. - - Attributes: - id (:obj:`str`): Unique identifier of the transaction. Coincides with the identifer - of the original transaction for refund transactions. - Coincides with :attr:`SuccessfulPayment.telegram_payment_charge_id` for - successful incoming payments from users. - amount (:obj:`int`): Integer amount of Telegram Stars transferred by the transaction. - nanostar_amount (:obj:`int`): Optional. The number of - :tg-const:`~telegram.constants.Nanostar.VALUE` shares of Telegram - Stars transferred by the transaction; from 0 to - :tg-const:`~telegram.constants.NanostarLimit.MAX_AMOUNT` - - .. versionadded:: 21.9 - date (:obj:`datetime.datetime`): Date the transaction was created as a datetime object. - source (:class:`telegram.TransactionPartner`): Optional. Source of an incoming transaction - (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). - Only for incoming transactions. - receiver (:class:`telegram.TransactionPartner`): Optional. Receiver of an outgoing - transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for - outgoing transactions. """ __slots__ = ("amount", "date", "id", "nanostar_amount", "receiver", "source") @@ -140,9 +121,6 @@ class StarTransactions(TelegramObject): Args: transactions (Sequence[:class:`telegram.StarTransaction`]): The list of transactions. - - Attributes: - transactions (tuple[:class:`telegram.StarTransaction`]): The list of transactions. """ __slots__ = ("transactions",) diff --git a/src/telegram/_payment/stars/transactionpartner.py b/src/telegram/_payment/stars/transactionpartner.py index 09d96c159da..c939a21096b 100644 --- a/src/telegram/_payment/stars/transactionpartner.py +++ b/src/telegram/_payment/stars/transactionpartner.py @@ -68,9 +68,6 @@ class TransactionPartner(TelegramObject): Args: type (:obj:`str`): The type of the transaction partner. - - Attributes: - type (:obj:`str`): The type of the transaction partner. """ __slots__ = ("type",) @@ -152,10 +149,6 @@ class TransactionPartnerAffiliateProgram(TransactionPartner): Attributes: type (:obj:`str`): The type of the transaction partner, always :tg-const:`telegram.TransactionPartner.AFFILIATE_PROGRAM`. - sponsor_user (:class:`telegram.User`): Optional. Information about the bot that sponsored - the affiliate program - commission_per_mille (:obj:`int`): The number of Telegram Stars received by the bot for - each 1000 Telegram Stars received by the affiliate program sponsor from referred users. """ __slots__ = ("commission_per_mille", "sponsor_user") @@ -204,9 +197,6 @@ class TransactionPartnerChat(TransactionPartner): Attributes: type (:obj:`str`): The type of the transaction partner, always :tg-const:`telegram.TransactionPartner.CHAT`. - chat (:class:`telegram.Chat`): Information about the chat. - gift (:class:`telegram.Gift`): Optional. The gift sent to the user by the bot. - """ __slots__ = ( @@ -255,8 +245,6 @@ class TransactionPartnerFragment(TransactionPartner): Attributes: type (:obj:`str`): The type of the transaction partner, always :tg-const:`telegram.TransactionPartner.FRAGMENT`. - withdrawal_state (:class:`telegram.RevenueWithdrawalState`): Optional. State of the - transaction if the transaction is outgoing. """ __slots__ = ("withdrawal_state",) @@ -352,55 +340,11 @@ class TransactionPartnerUser(TransactionPartner): Attributes: type (:obj:`str`): The type of the transaction partner, always :tg-const:`telegram.TransactionPartner.USER`. - transaction_type (:obj:`str`): Type of the transaction, currently one of - :tg-const:`telegram.constants.TransactionPartnerUser.INVOICE_PAYMENT` for payments via - invoices, :tg-const:`telegram.constants.TransactionPartnerUser.PAID_MEDIA_PAYMENT` - for payments for paid media, - :tg-const:`telegram.constants.TransactionPartnerUser.GIFT_PURCHASE` for gifts sent by - the bot, :tg-const:`telegram.constants.TransactionPartnerUser.PREMIUM_PURCHASE` - for Telegram Premium subscriptions gifted by the bot, - :tg-const:`telegram.constants.TransactionPartnerUser.BUSINESS_ACCOUNT_TRANSFER` for - direct transfers from managed business accounts. - - .. versionadded:: 22.1 - user (:class:`telegram.User`): Information about the user. - affiliate (:class:`telegram.AffiliateInfo`): Optional. Information about the affiliate that - received a commission via this transaction. Can be available only for - :tg-const:`telegram.constants.TransactionPartnerUser.INVOICE_PAYMENT` - and :tg-const:`telegram.constants.TransactionPartnerUser.PAID_MEDIA_PAYMENT` - transactions. - - .. versionadded:: 21.9 - invoice_payload (:obj:`str`): Optional. Bot-specified invoice payload. Can be available - only for :tg-const:`telegram.constants.TransactionPartnerUser.INVOICE_PAYMENT` - transactions. subscription_period (:class:`datetime.timedelta`): Optional. The duration of the paid subscription. Can be available only for :tg-const:`telegram.constants.TransactionPartnerUser.INVOICE_PAYMENT` transactions. .. versionadded:: 21.8 - paid_media (tuple[:class:`telegram.PaidMedia`]): Optional. Information about the paid - media bought by the user. for - :tg-const:`telegram.constants.TransactionPartnerUser.PAID_MEDIA_PAYMENT` - transactions only. - - .. versionadded:: 21.5 - paid_media_payload (:obj:`str`): Optional. Bot-specified paid media payload. Can be - available only for - :tg-const:`telegram.constants.TransactionPartnerUser.PAID_MEDIA_PAYMENT` transactions. - - .. versionadded:: 21.6 - gift (:class:`telegram.Gift`): Optional. The gift sent to the user by the bot; for - :tg-const:`telegram.constants.TransactionPartnerUser.GIFT_PURCHASE` transactions only. - - .. versionadded:: 21.8 - premium_subscription_duration (:obj:`int`): Optional. Number of months the gifted Telegram - Premium subscription will be active for; for - :tg-const:`telegram.constants.TransactionPartnerUser.PREMIUM_PURCHASE` - transactions only. - - .. versionadded:: 22.1 - """ __slots__ = ( @@ -511,8 +455,6 @@ class TransactionPartnerTelegramApi(TransactionPartner): Attributes: type (:obj:`str`): The type of the transaction partner, always :tg-const:`telegram.TransactionPartner.TELEGRAM_API`. - request_count (:obj:`int`): The number of successful requests that exceeded regular limits - and were therefore billed. """ __slots__ = ("request_count",) diff --git a/src/telegram/_payment/successfulpayment.py b/src/telegram/_payment/successfulpayment.py index 7fb284814c6..c6fd8f0bf30 100644 --- a/src/telegram/_payment/successfulpayment.py +++ b/src/telegram/_payment/successfulpayment.py @@ -67,34 +67,6 @@ class SuccessfulPayment(TelegramObject): order_info (:class:`telegram.OrderInfo`, optional): Order info provided by the user. telegram_payment_charge_id (:obj:`str`): Telegram payment identifier. provider_payment_charge_id (:obj:`str`): Provider payment identifier. - - Attributes: - currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in - |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, - **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. - See the ``exp`` parameter in - `currencies.json `_, - it shows the number of digits past the decimal point for each currency - (2 for the majority of currencies). - invoice_payload (:obj:`str`): Bot-specified invoice payload. - subscription_expiration_date (:class:`datetime.datetime`): Optional. Expiration - date of the subscription; for recurring payments only. - - .. versionadded:: 21.8 - is_recurring (:obj:`bool`): Optional. True, if the payment is for a subscription. - - .. versionadded:: 21.8 - is_first_recurring (:obj:`bool`): Optional. True, if the payment is the first payment of a - subscription. - - .. versionadded:: 21.8 - shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the - user. - order_info (:class:`telegram.OrderInfo`): Optional. Order info provided by the user. - telegram_payment_charge_id (:obj:`str`): Telegram payment identifier. - provider_payment_charge_id (:obj:`str`): Provider payment identifier. - """ __slots__ = ( diff --git a/src/telegram/_poll.py b/src/telegram/_poll.py index ba02062b33a..714cee4f4d5 100644 --- a/src/telegram/_poll.py +++ b/src/telegram/_poll.py @@ -69,18 +69,6 @@ class InputPollOption(TelegramObject): :paramref:`text_parse_mode`. Currently, only custom emoji entities are allowed. This list is empty if the text does not contain entities. - - Attributes: - text (:obj:`str`): Option text, - :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH` - characters. - text_parse_mode (:obj:`str`): Optional. |parse_mode| - Currently, only custom emoji entities are allowed. - text_entities (Sequence[:class:`telegram.MessageEntity`]): Special entities - that appear in the option :paramref:`text`. It can be specified instead of - :paramref:`text_parse_mode`. - Currently, only custom emoji entities are allowed. - This list is empty if the text does not contain entities. """ __slots__ = ("text", "text_entities", "text_parse_mode") @@ -144,34 +132,6 @@ class PollOption(TelegramObject): addition_date (:obj:`datetime.datetime`, optional): Point in time when the option was added; omitted if the option existed in the original poll. - .. versionadded:: NEXT.VERSION - - Attributes: - persistent_id (:obj:`str`): Unique identifier of the option, persistent on option addition - and deletion. - - .. versionadded:: NEXT.VERSION - text (:obj:`str`): Option text, - :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH` - characters. - voter_count (:obj:`int`): Number of users that voted for this option. - text_entities (tuple[:class:`telegram.MessageEntity`]): Special entities - that appear in the option text. Currently, only custom emoji entities are allowed in - poll option texts. - This list is empty if the question does not contain entities. - - .. versionadded:: 21.2 - added_by_user (:class:`telegram.User`): Optional. User who added the option; - omitted if the option wasn't added by a user after poll creation. - - .. versionadded:: NEXT.VERSION - added_by_chat (:class:`telegram.Chat`): Optional. Chat that added the option; - omitted if the option wasn't added by a chat after poll creation. - - .. versionadded:: NEXT.VERSION - addition_date (:obj:`datetime.datetime`): Optional. Point in time - when the option was added; omitted if the option existed in the original poll. - .. versionadded:: NEXT.VERSION """ @@ -319,28 +279,6 @@ class PollAnswer(TelegramObject): voter_chat (:class:`telegram.Chat`, optional): The chat that changed the answer to the poll, if the voter is anonymous. - .. versionadded:: 20.5 - - Attributes: - poll_id (:obj:`str`): Unique poll identifier. - option_ids (tuple[:obj:`int`]): Identifiers of answer options, chosen by the user. May - be empty if the user retracted their vote. - - .. versionchanged:: 20.0 - |tupleclassattrs| - option_persistent_ids (tuple[:obj:`str`]): Persistent identifiers of the - chosen answer options. May be empty if the vote was retracted. - - .. versionadded:: NEXT.VERSION - user (:class:`telegram.User`): Optional. The user, who changed the answer to the - poll, if the voter isn't anonymous. If the voter is anonymous, this field will contain - the user :tg-const:`telegram.constants.ChatID.FAKE_CHANNEL` for backwards compatibility - - .. versionchanged:: 20.5 - :paramref:`user` became optional. - voter_chat (:class:`telegram.Chat`): Optional. The chat that changed the answer to the - poll, if the voter is anonymous. - .. versionadded:: 20.5 """ @@ -403,16 +341,6 @@ class PollOptionAdded(TelegramObject): :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. option_text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities that appear in the :paramref:`option_text`. - - Attributes: - option_persistent_id (:obj:`str`): Unique identifier of the added option. - option_text (:obj:`str`): Option text. - poll_message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message - containing the poll to which the option was added, if known. - Note that the Message object in this field will not contain the - :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - option_text_entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special - entities that appear in the :paramref:`option_text`. """ __slots__ = ("option_persistent_id", "option_text", "option_text_entities", "poll_message") @@ -486,7 +414,7 @@ def parse_option_text_entities( Note: This method should always be used instead of the :attr:`option_text_entities` attribute, since it calculates the correct substring from the message text based on - UTF-16 codepoints. See :attr:`parse_entity` for more info. + UTF-16 codepoints. See :attr:`parse_option_text_entity` for more info. Args: types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the @@ -518,16 +446,6 @@ class PollOptionDeleted(TelegramObject): :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. option_text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities that appear in the option_text. - - Attributes: - option_persistent_id (:obj:`str`): Unique identifier of the deleted option. - option_text (:obj:`str`): Option text. - poll_message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message - containing the poll to which the option was deleted, if known. - Note that the Message object in this field will not contain the - :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - option_text_entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special - entities that appear in the option_text. """ __slots__ = ("option_persistent_id", "option_text", "option_text_entities", "poll_message") @@ -601,7 +519,7 @@ def parse_option_text_entities( Note: This method should always be used instead of the :attr:`option_text_entities` attribute, since it calculates the correct substring from the message text based on - UTF-16 codepoints. See :attr:`parse_entity` for more info. + UTF-16 codepoints. See :attr:`parse_option_text_entity` for more info. Args: types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the @@ -633,6 +551,7 @@ class Poll(TelegramObject): .. versionchanged:: 20.0 |sequenceclassargs| + total_voter_count (:obj:`int`): Total number of users that voted in the poll. is_closed (:obj:`bool`): :obj:`True`, if the poll is closed. is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous. type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`. @@ -689,70 +608,11 @@ class Poll(TelegramObject): .. versionadded:: NEXT.VERSION Attributes: - id (:obj:`str`): Unique poll identifier. - question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`- - :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters. - options (tuple[:class:`~telegram.PollOption`]): List of poll options. - - .. versionchanged:: 20.0 - |tupleclassattrs| - total_voter_count (:obj:`int`): Total number of users that voted in the poll. - is_closed (:obj:`bool`): :obj:`True`, if the poll is closed. - is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous. - type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`. - allows_multiple_answers (:obj:`bool`): :obj:`True`, if the poll allows multiple answers. - correct_option_id (:obj:`int`): Optional. A zero based identifier of the correct answer - option. Available only for closed polls in the quiz mode, which were sent - (not forwarded), by the bot or to a private chat with the bot. - - .. deprecated:: NEXT.VERSION - Use :attr:`correct_option_ids` instead. - explanation (:obj:`str`): Optional. Text that is shown when a user chooses an incorrect - answer or taps on the lamp icon in a quiz-style poll, - 0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters. - explanation_entities (tuple[:class:`telegram.MessageEntity`]): Special entities - like usernames, URLs, bot commands, etc. that appear in the :attr:`explanation`. - This list is empty if the message does not contain explanation entities. - - .. versionchanged:: 20.0 - |tupleclassattrs| - - .. versionchanged:: 20.0 - This attribute is now always a (possibly empty) list and never :obj:`None`. open_period (:obj:`int` | :class:`datetime.timedelta`): Optional. Amount of time in seconds the poll will be active after creation. .. deprecated:: v22.2 |time-period-int-deprecated| - close_date (:obj:`datetime.datetime`): Optional. Point in time when the poll will be - automatically closed. - - .. versionchanged:: 20.3 - |datetime_localization| - question_entities (tuple[:class:`telegram.MessageEntity`]): Special entities - that appear in the :attr:`question`. Currently, only custom emoji entities are allowed - in poll questions. - This list is empty if the question does not contain entities. - - .. versionadded:: 21.2 - allows_revoting (:obj:`bool`): Optional. :obj:`True`, if the poll - allows to change the chosenanswer options - - .. versionadded:: NEXT.VERSION - correct_option_ids (tuple[:class:`int`]): Array of 0-based identifiers of the - correct answer options. Available only for polls in quiz mode which are closed or were - sent (not forwarded) by the bot or to the private chat with the bot. - - .. versionadded:: NEXT.VERSION - description (:obj:`str`): Optional. Description of the poll; - for polls inside the Message object only - - .. versionadded:: NEXT.VERSION - description_entities (tuple[:class:`telegram.MessageEntity`]): Special - entities like usernames, URLs, bot commands, etc. that appear in the description - - .. versionadded:: NEXT.VERSION - """ __slots__ = ( diff --git a/src/telegram/_preparedkeyboardbutton.py b/src/telegram/_preparedkeyboardbutton.py index 0a650f9469e..8da4e449a47 100644 --- a/src/telegram/_preparedkeyboardbutton.py +++ b/src/telegram/_preparedkeyboardbutton.py @@ -35,9 +35,6 @@ class PreparedKeyboardButton(TelegramObject): Args: id (:obj:`str`): Unique identifier of the keyboard button. - - Attributes: - id (:obj:`str`): Unique identifier of the keyboard button. """ __slots__ = ("id",) diff --git a/src/telegram/_proximityalerttriggered.py b/src/telegram/_proximityalerttriggered.py index 8f07d9aede4..fa87c3479f6 100644 --- a/src/telegram/_proximityalerttriggered.py +++ b/src/telegram/_proximityalerttriggered.py @@ -41,12 +41,6 @@ class ProximityAlertTriggered(TelegramObject): traveler (:class:`telegram.User`): User that triggered the alert watcher (:class:`telegram.User`): User that set the alert distance (:obj:`int`): The distance between the users - - Attributes: - traveler (:class:`telegram.User`): User that triggered the alert - watcher (:class:`telegram.User`): User that set the alert - distance (:obj:`int`): The distance between the users - """ __slots__ = ("distance", "traveler", "watcher") diff --git a/src/telegram/_reaction.py b/src/telegram/_reaction.py index 2dbcd462e72..0d4f7a662af 100644 --- a/src/telegram/_reaction.py +++ b/src/telegram/_reaction.py @@ -45,11 +45,6 @@ class ReactionType(TelegramObject): type (:obj:`str`): Type of the reaction. Can be :attr:`~telegram.ReactionType.EMOJI`, :attr:`~telegram.ReactionType.CUSTOM_EMOJI` or :attr:`~telegram.ReactionType.PAID`. - Attributes: - type (:obj:`str`): Type of the reaction. Can be - :attr:`~telegram.ReactionType.EMOJI`, :attr:`~telegram.ReactionType.CUSTOM_EMOJI` or - :attr:`~telegram.ReactionType.PAID`. - """ __slots__ = ("type",) @@ -109,8 +104,6 @@ class ReactionTypeEmoji(ReactionType): Attributes: type (:obj:`str`): Type of the reaction, always :tg-const:`telegram.ReactionType.EMOJI`. - emoji (:obj:`str`): Reaction emoji. It can be one of - :const:`telegram.constants.ReactionEmoji`. """ __slots__ = ("emoji",) @@ -143,8 +136,6 @@ class ReactionTypeCustomEmoji(ReactionType): Attributes: type (:obj:`str`): Type of the reaction, always :tg-const:`telegram.ReactionType.CUSTOM_EMOJI`. - custom_emoji_id (:obj:`str`): Custom emoji identifier. - """ __slots__ = ("custom_emoji_id",) @@ -195,7 +186,6 @@ class ReactionCount(TelegramObject): Attributes: type (:class:`telegram.ReactionType`): Type of the reaction. - total_count (:obj:`int`): Number of times the reaction was added. """ __slots__ = ( diff --git a/src/telegram/_reply.py b/src/telegram/_reply.py index 6f1edfadeb8..b497ca723ac 100644 --- a/src/telegram/_reply.py +++ b/src/telegram/_reply.py @@ -113,58 +113,6 @@ class ExternalReplyInfo(TelegramObject): paid_media (:class:`telegram.PaidMedia`, optional): Message contains paid media; information about the paid media. - .. versionadded:: 21.4 - - Attributes: - origin (:class:`telegram.MessageOrigin`): Origin of the message replied to by the given - message. - chat (:class:`telegram.Chat`): Optional. Chat the original message belongs to. Available - only if the chat is a supergroup or a channel. - message_id (:obj:`int`): Optional. Unique message identifier inside the original chat. - Available only if the original chat is a supergroup or a channel. - link_preview_options (:class:`telegram.LinkPreviewOptions`): Optional. Options used for - link preview generation for the original message, if it is a text message. - animation (:class:`telegram.Animation`): Optional. Message is an animation, information - about the animation. - audio (:class:`telegram.Audio`): Optional. Message is an audio file, information about the - file. - document (:class:`telegram.Document`): Optional. Message is a general file, information - about the file. - photo (tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available sizes - of the photo. - sticker (:class:`telegram.Sticker`): Optional. Message is a sticker, information about the - sticker. - story (:class:`telegram.Story`): Optional. Message is a forwarded story. - video (:class:`telegram.Video`): Optional. Message is a video, information about the video. - video_note (:class:`telegram.VideoNote`): Optional. Message is a `video note - `_, information about the video - message. - voice (:class:`telegram.Voice`): Optional. Message is a voice message, information about - the file. - has_media_spoiler (:obj:`bool`): Optional. :obj:`True`, if the message media is covered by - a spoiler animation. - checklist (:class:`telegram.Checklist`): Optional. Message is a checklist. - - .. versionadded:: 22.3 - contact (:class:`telegram.Contact`): Optional. Message is a shared contact, information - about the contact. - dice (:class:`telegram.Dice`): Optional. Message is a dice with random value. - game (:Class:`telegram.Game`): Optional. Message is a game, information about the game. - :ref:`More about games >> `. - giveaway (:class:`telegram.Giveaway`): Optional. Message is a scheduled giveaway, - information about the giveaway. - giveaway_winners (:class:`telegram.GiveawayWinners`): Optional. A giveaway with public - winners was completed. - invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, - information about the invoice. :ref:`More about payments >> `. - location (:class:`telegram.Location`): Optional. Message is a shared location, information - about the location. - poll (:class:`telegram.Poll`): Optional. Message is a native poll, information about the - poll. - venue (:class:`telegram.Venue`): Optional. Message is a venue, information about the venue. - paid_media (:class:`telegram.PaidMedia`): Optional. Message contains paid media; - information about the paid media. - .. versionadded:: 21.4 """ @@ -315,17 +263,6 @@ class TextQuote(TelegramObject): custom_emoji, and date_time entities are kept in quotes. is_manual (:obj:`bool`, optional): :obj:`True`, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. - - Attributes: - text (:obj:`str`): Text of the quoted part of a message that is replied to by the given - message. - position (:obj:`int`): Approximate quote position in the original message in UTF-16 code - units as specified by the sender. - entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special entities that appear - in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, - custom_emoji, and date_time entities are kept in quotes. - is_manual (:obj:`bool`): Optional. :obj:`True`, if the quote was chosen manually by the - message sender. Otherwise, the quote was added automatically by the server. """ __slots__ = ( @@ -413,37 +350,6 @@ class ReplyParameters(TelegramObject): poll_option_id (:obj:`str`, optional): Persistent identifier of the specific poll option to be replied to. - .. versionadded:: NEXT.VERSION - - Attributes: - message_id (:obj:`int`): Identifier of the message that will be replied to in the current - chat, or in the chat :paramref:`chat_id` if it is specified. - chat_id (:obj:`int` | :obj:`str`): Optional. If the message to be replied to is from a - different chat, |chat_id_channel| - Not supported for messages sent on behalf of a business account and messages from - channel direct messages chats. - allow_sending_without_reply (:obj:`bool`): Optional. |allow_sending_without_reply| Can be - used only for replies in the same chat and forum topic. - quote (:obj:`str`): Optional. Quoted part of the message to be replied to; 0-1024 - characters after entities parsing. The quote must be an exact substring of the message - to be replied to, including bold, italic, underline, strikethrough, spoiler, - custom_emoji, and date_time entities. The message will fail to send if the quote isn't - found in the original message. - quote_parse_mode (:obj:`str`): Optional. Mode for parsing entities in the quote. See - :wiki:`formatting options ` for - more details. - quote_entities (tuple[:class:`telegram.MessageEntity`]): Optional. A JSON-serialized list - of special entities that appear in the quote. It can be specified instead of - :paramref:`quote_parse_mode`. - quote_position (:obj:`int`): Optional. Position of the quote in the original message in - UTF-16 code units. - checklist_task_id (:obj:`int`): Optional. Identifier of the specific checklist task to be - replied to. - - .. versionadded:: 22.4 - poll_option_id (:obj:`str`): Optional. Persistent - identifier of the specific poll option to be replied to. - .. versionadded:: NEXT.VERSION """ diff --git a/src/telegram/_replykeyboardmarkup.py b/src/telegram/_replykeyboardmarkup.py index 99ac0de3b00..e3ac0d78d73 100644 --- a/src/telegram/_replykeyboardmarkup.py +++ b/src/telegram/_replykeyboardmarkup.py @@ -84,41 +84,6 @@ class ReplyKeyboardMarkup(TelegramObject): keyboard can be hidden and opened with a keyboard icon. .. versionadded:: 20.0 - - Attributes: - keyboard (tuple[tuple[:class:`telegram.KeyboardButton`]]): Array of button rows, - each represented by an Array of :class:`telegram.KeyboardButton` objects. - resize_keyboard (:obj:`bool`): Optional. Requests clients to resize the keyboard vertically - for optimal fit (e.g., make the keyboard smaller if there are just two rows of - buttons). Defaults to :obj:`False`, in which case the custom keyboard is always of the - same height as the app's standard keyboard. - one_time_keyboard (:obj:`bool`): Optional. Requests clients to hide the keyboard as soon as - it's been used. The keyboard will still be available, but clients will automatically - display the usual letter-keyboard in the chat - the user can press a special button in - the input field to see the custom keyboard again. Defaults to :obj:`False`. - selective (:obj:`bool`): Optional. Show the keyboard to specific users only. - Targets: - - 1) Users that are @mentioned in the :attr:`~telegram.Message.text` of the - :class:`telegram.Message` object. - 2) If the bot's message is a reply to a message in the same chat and forum topic, - sender of the original message. - - Defaults to :obj:`False`. - - input_field_placeholder (:obj:`str`): Optional. The placeholder to be shown in the input - field when the keyboard is active; - :tg-const:`telegram.ReplyKeyboardMarkup.MIN_INPUT_FIELD_PLACEHOLDER`- - :tg-const:`telegram.ReplyKeyboardMarkup.MAX_INPUT_FIELD_PLACEHOLDER` - characters. - - .. versionadded:: 13.7 - is_persistent (:obj:`bool`): Optional. Requests clients to always show the keyboard when - the regular keyboard is hidden. If :obj:`False`, the custom keyboard can be hidden and - opened with a keyboard icon. - - .. versionadded:: 20.0 - """ __slots__ = ( diff --git a/src/telegram/_sentwebappmessage.py b/src/telegram/_sentwebappmessage.py index 1d26e231b9e..e9bdad50153 100644 --- a/src/telegram/_sentwebappmessage.py +++ b/src/telegram/_sentwebappmessage.py @@ -34,11 +34,6 @@ class SentWebAppMessage(TelegramObject): inline_message_id (:obj:`str`, optional): Identifier of the sent inline message. Available only if there is an :attr:`inline keyboard ` attached to the message. - - Attributes: - inline_message_id (:obj:`str`): Optional. Identifier of the sent inline message. Available - only if there is an :attr:`inline keyboard ` attached to - the message. """ __slots__ = ("inline_message_id",) diff --git a/src/telegram/_shared.py b/src/telegram/_shared.py index 2de07529c62..f61f7ca24c8 100644 --- a/src/telegram/_shared.py +++ b/src/telegram/_shared.py @@ -59,13 +59,6 @@ class UsersShared(TelegramObject): .. versionchanged:: 21.2 This argument is now required. - - Attributes: - request_id (:obj:`int`): Identifier of the request. - users (tuple[:class:`telegram.SharedUser`]): Information about users shared with the - bot. - - .. versionadded:: 21.1 """ __slots__ = ("request_id", "users") @@ -113,10 +106,7 @@ class ChatShared(TelegramObject): Args: request_id (:obj:`int`): Identifier of the request. - chat_id (:obj:`int`): Identifier of the shared user. This number may be greater than 32 - bits and some programming languages may have difficulty/silent defects in interpreting - it. But it is smaller than 52 bits, so a signed 64-bit integer or double-precision - float type are safe for storing this identifier. + chat_id (:obj:`int`): Identifier of the shared user. title (:obj:`str`, optional): Title of the chat, if the title was requested by the bot. .. versionadded:: 21.1 @@ -127,24 +117,6 @@ class ChatShared(TelegramObject): photo (Sequence[:class:`telegram.PhotoSize`], optional): Available sizes of the chat photo, if the photo was requested by the bot - .. versionadded:: 21.1 - - Attributes: - request_id (:obj:`int`): Identifier of the request. - chat_id (:obj:`int`): Identifier of the shared user. This number may be greater than 32 - bits and some programming languages may have difficulty/silent defects in interpreting - it. But it is smaller than 52 bits, so a signed 64-bit integer or double-precision - float type are safe for storing this identifier. - title (:obj:`str`): Optional. Title of the chat, if the title was requested by the bot. - - .. versionadded:: 21.1 - username (:obj:`str`): Optional. Username of the chat, if the username was requested by - the bot and available. - - .. versionadded:: 21.1 - photo (tuple[:class:`telegram.PhotoSize`]): Optional. Available sizes of the chat photo, - if the photo was requested by the bot - .. versionadded:: 21.1 """ @@ -200,10 +172,7 @@ class SharedUser(TelegramObject): .. versionadded:: 21.1 Args: - user_id (:obj:`int`): Identifier of the shared user. This number may have 32 significant - bits and some programming languages may have difficulty/silent defects in interpreting - it. But it has atmost 52 significant bits, so 64-bit integers or double-precision - float types are safe for storing these identifiers. The bot may not have access to the + user_id (:obj:`int`): Identifier of the shared user. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. first_name (:obj:`str`, optional): First name of the user, if the name was requested by the @@ -214,22 +183,6 @@ class SharedUser(TelegramObject): bot. photo (Sequence[:class:`telegram.PhotoSize`], optional): Available sizes of the chat photo, if the photo was requested by the bot. - - Attributes: - user_id (:obj:`int`): Identifier of the shared user. This number may have 32 significant - bits and some programming languages may have difficulty/silent defects in interpreting - it. But it has atmost 52 significant bits, so 64-bit integers or double-precision - float types are safe for storing these identifiers. The bot may not have access to the - user and could be unable to use this identifier, unless the user is already known to - the bot by some other means. - first_name (:obj:`str`): Optional. First name of the user, if the name was requested by the - bot. - last_name (:obj:`str`): Optional. Last name of the user, if the name was requested by the - bot. - username (:obj:`str`): Optional. Username of the user, if the username was requested by the - bot. - photo (tuple[:class:`telegram.PhotoSize`]): Available sizes of the chat photo, if - the photo was requested by the bot. This list is empty if the photo was not requsted. """ __slots__ = ("first_name", "last_name", "photo", "user_id", "username") diff --git a/src/telegram/_story.py b/src/telegram/_story.py index 680e7206230..eb95635f79b 100644 --- a/src/telegram/_story.py +++ b/src/telegram/_story.py @@ -44,11 +44,6 @@ class Story(TelegramObject): Args: chat (:class:`telegram.Chat`): Chat that posted the story. id (:obj:`int`): Unique identifier for the story in the chat. - - Attributes: - chat (:class:`telegram.Chat`): Chat that posted the story. - id (:obj:`int`): Unique identifier for the story in the chat. - """ __slots__ = ( diff --git a/src/telegram/_storyarea.py b/src/telegram/_storyarea.py index 27d8f168cf2..0317c0668d5 100644 --- a/src/telegram/_storyarea.py +++ b/src/telegram/_storyarea.py @@ -48,21 +48,6 @@ class StoryAreaPosition(TelegramObject): 0-:tg-const:`~telegram.constants.StoryAreaPositionLimit.MAX_ROTATION_ANGLE`. corner_radius_percentage (:obj:`float`): The radius of the rectangle corner rounding, as a percentage of the media width. - - Attributes: - x_percentage (:obj:`float`): The abscissa of the area's center, as a percentage of the - media width. - y_percentage (:obj:`float`): The ordinate of the area's center, as a percentage of the - media height. - width_percentage (:obj:`float`): The width of the area's rectangle, as a percentage of the - media width. - height_percentage (:obj:`float`): The height of the area's rectangle, as a percentage of - the media height. - rotation_angle (:obj:`float`): The clockwise rotation angle of the rectangle, in degrees; - 0-:tg-const:`~telegram.constants.StoryAreaPositionLimit.MAX_ROTATION_ANGLE`. - corner_radius_percentage (:obj:`float`): The radius of the rectangle corner rounding, as a - percentage of the media width. - """ __slots__ = ( @@ -119,14 +104,6 @@ class LocationAddress(TelegramObject): state (:obj:`str`, optional): State of the location. city (:obj:`str`, optional): City of the location. street (:obj:`str`, optional): Street address of the location. - - Attributes: - country_code (:obj:`str`): The two-letter ``ISO 3166-1 alpha-2`` country code of the - country where the location is located. - state (:obj:`str`): Optional. State of the location. - city (:obj:`str`): Optional. City of the location. - street (:obj:`str`): Optional. Street address of the location. - """ __slots__ = ("city", "country_code", "state", "street") @@ -166,10 +143,6 @@ class StoryAreaType(TelegramObject): Args: type (:obj:`str`): Type of the area. - - Attributes: - type (:obj:`str`): Type of the area. - """ __slots__ = ("type",) @@ -214,10 +187,6 @@ class StoryAreaTypeLocation(StoryAreaType): Attributes: type (:obj:`str`): Type of the area, always :attr:`~telegram.StoryAreaType.LOCATION`. - latitude (:obj:`float`): Location latitude in degrees. - longitude (:obj:`float`): Location longitude in degrees. - address (:class:`telegram.LocationAddress`): Optional. Address of the location. - """ __slots__ = ("address", "latitude", "longitude") @@ -261,11 +230,6 @@ class StoryAreaTypeSuggestedReaction(StoryAreaType): Attributes: type (:obj:`str`): Type of the area, always :tg-const:`~telegram.StoryAreaType.SUGGESTED_REACTION`. - reaction_type (:class:`ReactionType`): Type of the reaction. - is_dark (:obj:`bool`): Optional. Pass :obj:`True` if the reaction area has a dark - background. - is_flipped (:obj:`bool`): Optional. Pass :obj:`True` if reaction area corner is flipped. - """ __slots__ = ("is_dark", "is_flipped", "reaction_type") @@ -302,8 +266,6 @@ class StoryAreaTypeLink(StoryAreaType): Attributes: type (:obj:`str`): Type of the area, always :attr:`~telegram.StoryAreaType.LINK`. - url (:obj:`str`): ``HTTP`` or ``tg://`` URL to be opened when the area is clicked. - """ __slots__ = ("url",) @@ -341,10 +303,6 @@ class StoryAreaTypeWeather(StoryAreaType): Attributes: type (:obj:`str`): Type of the area, always :tg-const:`~telegram.StoryAreaType.WEATHER`. - temperature (:obj:`float`): Temperature, in degree Celsius. - emoji (:obj:`str`): Emoji representing the weather. - background_color (:obj:`int`): A color of the area background in the ``ARGB`` format. - """ __slots__ = ("background_color", "emoji", "temperature") @@ -383,8 +341,6 @@ class StoryAreaTypeUniqueGift(StoryAreaType): Attributes: type (:obj:`str`): Type of the area, always :tg-const:`~telegram.StoryAreaType.UNIQUE_GIFT`. - name (:obj:`str`): Unique name of the gift. - """ __slots__ = ("name",) @@ -414,11 +370,6 @@ class StoryArea(TelegramObject): Args: position (:class:`telegram.StoryAreaPosition`): Position of the area. type (:class:`telegram.StoryAreaType`): Type of the area. - - Attributes: - position (:class:`telegram.StoryAreaPosition`): Position of the area. - type (:class:`telegram.StoryAreaType`): Type of the area. - """ __slots__ = ("position", "type") diff --git a/src/telegram/_suggestedpost.py b/src/telegram/_suggestedpost.py index b820706685a..d4f1ffdea2e 100644 --- a/src/telegram/_suggestedpost.py +++ b/src/telegram/_suggestedpost.py @@ -55,19 +55,6 @@ class SuggestedPostPrice(TelegramObject): nanotoncoins must be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_NANOTONCOINS` and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_NANOTONCOINS`. - - Attributes: - currency (:obj:`str`): - Currency in which the post will be paid. Currently, must be one of ``“XTR”`` for - Telegram Stars or ``“TON”`` for toncoins. - amount (:obj:`int`): - The amount of the currency that will be paid for the post in the smallest units of the - currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must - be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_STARS` - and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_STARS`, and price in - nanotoncoins must be between - :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_NANOTONCOINS` - and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_NANOTONCOINS`. """ __slots__ = ("amount", "currency") @@ -108,20 +95,6 @@ class SuggestedPostParameters(TelegramObject): within :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) at the sole discretion of the user who approves it. |datetime_localization| - - Attributes: - price (:class:`telegram.SuggestedPostPrice`): - Optional. Proposed price for the post. If the field is omitted, then the post - is unpaid. - send_date (:class:`datetime.datetime`): - Optional. Proposed send date of the post. If specified, then the date - must be between :tg-const:`telegram.constants.SuggestedPost.MIN_SEND_DATE` - second and :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) - in the future. If the field is omitted, then the post can be published at any time - within :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) at - the sole discretion of the user who approves it. - |datetime_localization| - """ __slots__ = ("price", "send_date") @@ -178,21 +151,6 @@ class SuggestedPostInfo(TelegramObject): at any time within 30 days at the sole discretion of the user or administrator who approves it. |datetime_localization| - - Attributes: - state (:obj:`str`): - State of the suggested post. Currently, it can be one of - :tg-const:`~telegram.constants.SuggestedPostInfoState.PENDING`, - :tg-const:`~telegram.constants.SuggestedPostInfoState.APPROVED`, - :tg-const:`~telegram.constants.SuggestedPostInfoState.DECLINED`. - price (:obj:`SuggestedPostPrice`): - Optional. Proposed price of the post. If the field is omitted, then the post is unpaid. - send_date (:class:`datetime.datetime`): - Optional. Proposed send date of the post. If the field is omitted, then the post can be - published at any time within 30 days at the sole discretion of the user or - administrator who approves it. - |datetime_localization| - """ __slots__ = ("price", "send_date", "state") @@ -253,15 +211,6 @@ class SuggestedPostDeclined(TelegramObject): even if it itself is a reply. comment (:obj:`str`, optional): Comment with which the post was declined. - - Attributes: - suggested_post_message (:class:`telegram.Message`): - Optional. Message containing the suggested post. Note that the - :class:`~telegram.Message` object in this field will not contain - the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - comment (:obj:`str`): - Optional. Comment with which the post was declined. - """ __slots__ = ("comment", "suggested_post_message") @@ -316,23 +265,6 @@ class SuggestedPostPaid(TelegramObject): star_amount (:class:`telegram.StarAmount`, optional): The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only. - - - Attributes: - suggested_post_message (:class:`telegram.Message`): - Optional. Message containing the suggested post. Note that the - :class:`~telegram.Message` object in this field will not contain - the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - currency (:obj:`str`): - Currency in which the payment was made. Currently, one of ``“XTR”`` for Telegram Stars - or ``“TON”`` for toncoins. - amount (:obj:`int`): - Optional. The amount of the currency that was received by the channel in nanotoncoins; - for payments in toncoins only. - star_amount (:class:`telegram.StarAmount`): - Optional. The amount of Telegram Stars that was received by the channel; for payments - in Telegram Stars only. - """ __slots__ = ("amount", "currency", "star_amount", "suggested_post_message") @@ -396,19 +328,6 @@ class SuggestedPostRefunded(TelegramObject): was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or :tg-const:`telegram.constants.SuggestedPostRefunded.PAYMENT_REFUNDED` if the payer refunded their payment. - - Attributes: - suggested_post_message (:class:`telegram.Message`): - Optional. Message containing the suggested post. Note that the - :class:`~telegram.Message` object in this field will not contain - the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - reason (:obj:`str`): - Reason for the refund. Currently, - one of :tg-const:`telegram.constants.SuggestedPostRefunded.POST_DELETED` if the post - was deleted within 24 hours of being posted or removed from scheduled messages without - being posted, or :tg-const:`telegram.constants.SuggestedPostRefunded.PAYMENT_REFUNDED` - if the payer refunded their payment. - """ __slots__ = ("reason", "suggested_post_message") @@ -461,18 +380,6 @@ class SuggestedPostApproved(TelegramObject): send_date (:class:`datetime.datetime`): Date when the post will be published. |datetime_localization| - - Attributes: - suggested_post_message (:class:`telegram.Message`): - Optional. Message containing the suggested post. Note that the - :class:`~telegram.Message` object in this field will not contain - the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - price (:obj:`SuggestedPostPrice`): - Optional. Amount paid for the post. - send_date (:class:`datetime.datetime`): - Date when the post will be published. - |datetime_localization| - """ __slots__ = ("price", "send_date", "suggested_post_message") @@ -530,15 +437,6 @@ class SuggestedPostApprovalFailed(TelegramObject): even if it itself is a reply. price (:obj:`SuggestedPostPrice`): Expected price of the post. - - Attributes: - suggested_post_message (:class:`telegram.Message`): - Optional. Message containing the suggested post. Note that the - :class:`~telegram.Message` object in this field will not contain - the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. - price (:obj:`SuggestedPostPrice`): - Expected price of the post. - """ __slots__ = ("price", "suggested_post_message") diff --git a/src/telegram/_switchinlinequerychosenchat.py b/src/telegram/_switchinlinequerychosenchat.py index 30e721321e3..a1724f87426 100644 --- a/src/telegram/_switchinlinequerychosenchat.py +++ b/src/telegram/_switchinlinequerychosenchat.py @@ -48,18 +48,6 @@ class SwitchInlineQueryChosenChat(TelegramObject): can be chosen. allow_channel_chats (:obj:`bool`, optional): Pass :obj:`True`, if channel chats can be chosen. - - Attributes: - query (:obj:`str`): Optional. The default inline query to be inserted in the input field. - If left empty, only the bot's username will be inserted. - allow_user_chats (:obj:`bool`): Optional. :obj:`True`, if private chats with users can be - chosen. - allow_bot_chats (:obj:`bool`): Optional. :obj:`True`, if private chats with bots can be - chosen. - allow_group_chats (:obj:`bool`): Optional. :obj:`True`, if group and supergroup chats can - be chosen. - allow_channel_chats (:obj:`bool`): Optional. :obj:`True`, if channel chats can be chosen. - """ __slots__ = ( diff --git a/src/telegram/_telegramobject.py b/src/telegram/_telegramobject.py index 4098c75c37e..d0932acfd39 100644 --- a/src/telegram/_telegramobject.py +++ b/src/telegram/_telegramobject.py @@ -66,7 +66,7 @@ class TelegramObject: or delete attributes anymore. Moreover, attributes that were formerly of type :obj:`list` are now of type :obj:`tuple`. - Arguments: + Args: api_kwargs (dict[:obj:`str`, any], optional): |toapikwargsarg| .. versionadded:: 20.0 @@ -688,7 +688,7 @@ def set_bot(self, bot: "Bot | None") -> None: .. versionadded: 20.0 - Arguments: + Args: bot (:class:`telegram.Bot` | :obj:`None`): The bot instance. """ self._bot = bot diff --git a/src/telegram/_uniquegift.py b/src/telegram/_uniquegift.py index 33f35aae28e..bb6ee37528a 100644 --- a/src/telegram/_uniquegift.py +++ b/src/telegram/_uniquegift.py @@ -56,16 +56,6 @@ class UniqueGiftColors(TelegramObject): dark_theme_main_color (:obj:`int`): Main color used in dark themes; RGB format. dark_theme_other_colors (Sequence[:obj:`int`]): List of 1-3 additional colors used in dark themes; RGB format. |sequenceclassargs| - - Attributes: - model_custom_emoji_id (:obj:`str`): Custom emoji identifier of the unique gift's model. - symbol_custom_emoji_id (:obj:`str`): Custom emoji identifier of the unique gift's symbol. - light_theme_main_color (:obj:`int`): Main color used in light themes; RGB format. - light_theme_other_colors (Tuple[:obj:`int`]): Tuple of 1-3 additional colors used in - light themes; RGB format. - dark_theme_main_color (:obj:`int`): Main color used in dark themes; RGB format. - dark_theme_other_colors (Tuple[:obj:`int`]): Tuple of 1-3 additional colors used in dark - themes; RGB format. """ __slots__ = ( @@ -129,19 +119,6 @@ class UniqueGiftModel(TelegramObject): :tg-const:`telegram.constants.UniqueGiftModelRarity.EPIC`, or :tg-const:`telegram.constants.UniqueGiftModelRarity.LEGENDARY`. - .. versionadded:: 22.7 - - Attributes: - name (:obj:`str`): Name of the model. - sticker (:class:`telegram.Sticker`): The sticker that represents the unique gift. - rarity_per_mille (:obj:`int`): The number of unique gifts that receive this - model for every ``1000`` gifts upgraded. Always ``0`` for crafted gifts. - rarity (:obj:`str`): Optional. Rarity of the model if it is a crafted model. - Currently, can be :tg-const:`telegram.constants.UniqueGiftModelRarity.UNCOMMON`, - :tg-const:`telegram.constants.UniqueGiftModelRarity.RARE`, - :tg-const:`telegram.constants.UniqueGiftModelRarity.EPIC`, - or :tg-const:`telegram.constants.UniqueGiftModelRarity.LEGENDARY`. - .. versionadded:: 22.7 """ @@ -196,13 +173,6 @@ class UniqueGiftSymbol(TelegramObject): sticker (:class:`telegram.Sticker`): The sticker that represents the unique gift. rarity_per_mille (:obj:`int`): The number of unique gifts that receive this model for every ``1000`` gifts upgraded. - - Attributes: - name (:obj:`str`): Name of the symbol. - sticker (:class:`telegram.Sticker`): The sticker that represents the unique gift. - rarity_per_mille (:obj:`int`): The number of unique gifts that receive this - model for every ``1000`` gifts upgraded. - """ __slots__ = ( @@ -252,13 +222,6 @@ class UniqueGiftBackdropColors(TelegramObject): edge_color (:obj:`int`): The color on the edges of the backdrop in RGB format. symbol_color (:obj:`int`): The color to be applied to the symbol in RGB format. text_color (:obj:`int`): The color for the text on the backdrop in RGB format. - - Attributes: - center_color (:obj:`int`): The color in the center of the backdrop in RGB format. - edge_color (:obj:`int`): The color on the edges of the backdrop in RGB format. - symbol_color (:obj:`int`): The color to be applied to the symbol in RGB format. - text_color (:obj:`int`): The color for the text on the backdrop in RGB format. - """ __slots__ = ( @@ -301,13 +264,6 @@ class UniqueGiftBackdrop(TelegramObject): colors (:class:`telegram.UniqueGiftBackdropColors`): Colors of the backdrop. rarity_per_mille (:obj:`int`): The number of unique gifts that receive this backdrop for every ``1000`` gifts upgraded. - - Attributes: - name (:obj:`str`): Name of the backdrop. - colors (:class:`telegram.UniqueGiftBackdropColors`): Colors of the backdrop. - rarity_per_mille (:obj:`int`): The number of unique gifts that receive this backdrop - for every ``1000`` gifts upgraded. - """ __slots__ = ( @@ -388,41 +344,6 @@ class UniqueGift(TelegramObject): is_burned (:obj:`bool`, optional): :obj:`True`, if the gift was used to craft another gift and isn't available anymore. - .. versionadded:: 22.7 - - Attributes: - gift_id (:obj:`str`): Identifier of the regular gift from which the gift was upgraded. - - .. versionadded:: 22.6 - base_name (:obj:`str`): Human-readable name of the regular gift from which this unique - gift was upgraded. - name (:obj:`str`): Unique name of the gift. This name can be used - in ``https://t.me/nft/...`` links and story areas. - number (:obj:`int`): Unique number of the upgraded gift among gifts upgraded from the - same regular gift. - model (:class:`telegram.UniqueGiftModel`): Model of the gift. - symbol (:class:`telegram.UniqueGiftSymbol`): Symbol of the gift. - backdrop (:class:`telegram.UniqueGiftBackdrop`): Backdrop of the gift. - publisher_chat (:class:`telegram.Chat`): Optional. Information about the chat that - published the gift. - - .. versionadded:: 22.4 - is_premium (:obj:`bool`): Optional. :obj:`True`, if the original regular gift was - exclusively purchaseable by Telegram Premium subscribers. - - .. versionadded:: 22.6 - is_from_blockchain (:obj:`bool`): Optional. :obj:`True`, if the gift is assigned from the - TON blockchain and can't be resold or transferred in Telegram. - - .. versionadded:: 22.6 - colors (:class:`telegram.UniqueGiftColors`): Optional. The color scheme that can be used - by the gift's owner for the chat's name, replies to messages and link previews; for - business account gifts and gifts that are currently on sale only. - - .. versionadded:: 22.6 - is_burned (:obj:`bool`): Optional. :obj:`True`, if the gift was used to craft another - gift and isn't available anymore. - .. versionadded:: 22.7 """ @@ -520,7 +441,7 @@ class UniqueGiftInfo(TelegramObject): The :attr:`RESALE` origin was added. .. versionchanged:: 22.6 Bot API 9.3 added the :attr:`GIFTED_UPGRADE` and :attr:`OFFER` origins. - owned_gift_id (:obj:`str`, optional) Unique identifier of the received gift for the + owned_gift_id (:obj:`str`, optional): Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts. transfer_star_count (:obj:`int`, optional): Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift. @@ -539,36 +460,6 @@ class UniqueGiftInfo(TelegramObject): .. versionadded:: 22.3 - Attributes: - gift (:class:`UniqueGift`): Information about the gift. - origin (:obj:`str`): Origin of the gift. Currently, either :attr:`UPGRADE` for gifts - upgraded from regular gifts, :attr:`TRANSFER` for gifts transferred from other users - or channels, :attr:`RESALE` for gifts bought from other users, - :attr:`GIFTED_UPGRADE` for upgrades purchased after the gift was sent, or :attr:`OFFER` - for gifts bought or sold through gift purchase offers - - .. versionchanged:: 22.3 - The :attr:`RESALE` origin was added. - .. versionchanged:: 22.6 - Bot API 9.3 added the :attr:`GIFTED_UPGRADE` and :attr:`OFFER` origins. - owned_gift_id (:obj:`str`) Optional. Unique identifier of the received gift for the - bot; only present for gifts received on behalf of business accounts. - transfer_star_count (:obj:`int`): Optional. Number of Telegram Stars that must be paid - to transfer the gift; omitted if the bot cannot transfer the gift. - last_resale_currency (:obj:`str`): Optional. For gifts bought from other users, the - currency in which the payment for the gift was done. Currently, one of ``XTR`` for - Telegram Stars or ``TON`` for toncoins. - - .. versionadded:: 22.6 - last_resale_amount (:obj:`int`): Optional. For gifts bought from other users, the price - paid for the gift in either Telegram Stars or nanotoncoins. - - .. versionadded:: 22.6 - next_transfer_date (:obj:`datetime.datetime`): Optional. Date when the gift can be - transferred. If it's in the past, then the gift can be transferred now. - |datetime_localization| - - .. versionadded:: 22.3 """ GIFTED_UPGRADE: Final[str] = constants.UniqueGiftInfoOrigin.GIFTED_UPGRADE diff --git a/src/telegram/_update.py b/src/telegram/_update.py index a8b8668ad17..989c87d65f7 100644 --- a/src/telegram/_update.py +++ b/src/telegram/_update.py @@ -168,123 +168,6 @@ class Update(TelegramObject): managed by the bot, or token or owner of a managed bot was changed. .. versionadded:: NEXT.VERSION - - - Attributes: - update_id (:obj:`int`): The update's unique identifier. Update identifiers start from a - certain positive number and increase sequentially. This ID becomes especially handy if - you're using Webhooks, since it allows you to ignore repeated updates or to restore the - correct update sequence, should they get out of order. If there are no new updates for - at least a week, then identifier of the next update will be chosen randomly instead of - sequentially. - message (:class:`telegram.Message`): Optional. New incoming message of any kind - text, - photo, sticker, etc. - edited_message (:class:`telegram.Message`): Optional. New version of a message that is - known to the bot and was edited. This update may at times be triggered by changes to - message fields that are either unavailable or not actively used by your bot. - channel_post (:class:`telegram.Message`): Optional. New incoming channel post of any kind - - text, photo, sticker, etc. - edited_channel_post (:class:`telegram.Message`): Optional. New version of a channel post - that is known to the bot and was edited. This update may at times be triggered by - changes to message fields that are either unavailable or not actively used by your bot. - inline_query (:class:`telegram.InlineQuery`): Optional. New incoming inline query. - chosen_inline_result (:class:`telegram.ChosenInlineResult`): Optional. The result of an - inline query that was chosen by a user and sent to their chat partner. - callback_query (:class:`telegram.CallbackQuery`): Optional. New incoming callback query. - - Examples: - :any:`Arbitrary Callback Data Bot ` - shipping_query (:class:`telegram.ShippingQuery`): Optional. New incoming shipping query. - Only for invoices with flexible price. - pre_checkout_query (:class:`telegram.PreCheckoutQuery`): Optional. New incoming - pre-checkout query. Contains full information about checkout. - poll (:class:`telegram.Poll`): Optional. New poll state. Bots receive only updates about - manually stopped polls and polls, which are sent by the bot. - poll_answer (:class:`telegram.PollAnswer`): Optional. A user changed their answer - in a non-anonymous poll. Bots receive new votes only in polls that were sent - by the bot itself. - my_chat_member (:class:`telegram.ChatMemberUpdated`): Optional. The bot's chat member - status was updated in a chat. For private chats, this update is received only when the - bot is blocked or unblocked by the user. - - .. versionadded:: 13.4 - chat_member (:class:`telegram.ChatMemberUpdated`): Optional. A chat member's status was - updated in a chat. The bot must be an administrator in the chat and must explicitly - specify :attr:`CHAT_MEMBER` in the list of - :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these - updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, - :meth:`telegram.ext.Application.run_polling` and - :meth:`telegram.ext.Application.run_webhook`). - - .. versionadded:: 13.4 - chat_join_request (:class:`telegram.ChatJoinRequest`): Optional. A request to join the - chat has been sent. The bot must have the - :attr:`telegram.ChatPermissions.can_invite_users` administrator right in the chat to - receive these updates. - - .. versionadded:: 13.8 - - chat_boost (:class:`telegram.ChatBoostUpdated`): Optional. A chat boost was added or - changed. The bot must be an administrator in the chat to receive these updates. - - .. versionadded:: 20.8 - - removed_chat_boost (:class:`telegram.ChatBoostRemoved`): Optional. A boost was removed from - a chat. The bot must be an administrator in the chat to receive these updates. - - .. versionadded:: 20.8 - - message_reaction (:class:`telegram.MessageReactionUpdated`): Optional. A reaction to a - message was changed by a user. The bot must be an administrator in the chat and must - explicitly specify :attr:`MESSAGE_REACTION` in the list of - :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these - updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, - :meth:`telegram.ext.Application.run_polling` and - :meth:`telegram.ext.Application.run_webhook`). The update isn't received for reactions - set by bots. - - .. versionadded:: 20.8 - - message_reaction_count (:class:`telegram.MessageReactionCountUpdated`): Optional. Reactions - to a message with anonymous reactions were changed. The bot must be an administrator in - the chat and must explicitly specify :attr:`MESSAGE_REACTION_COUNT` in the list of - :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these - updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, - :meth:`telegram.ext.Application.run_polling` and - :meth:`telegram.ext.Application.run_webhook`). The updates are grouped and can be sent - with delay up to a few minutes. - - .. versionadded:: 20.8 - - business_connection (:class:`telegram.BusinessConnection`): Optional. The bot was connected - to or disconnected from a business account, or a user edited an existing connection - with the bot. - - .. versionadded:: 21.1 - - business_message (:class:`telegram.Message`): Optional. New message from a connected - business account. - - .. versionadded:: 21.1 - - edited_business_message (:class:`telegram.Message`): Optional. New version of a message - from a connected business account. - - .. versionadded:: 21.1 - - deleted_business_messages (:class:`telegram.BusinessMessagesDeleted`): Optional. Messages - were deleted from a connected business account. - - .. versionadded:: 21.1 - - purchased_paid_media (:class:`telegram.PaidMediaPurchased`): Optional. A user purchased - paid media with a non-empty payload sent by the bot in a non-channel chat. - - .. versionadded:: 21.6 - managed_bot (:class:`telegram.ManagedBotUpdated`): Optional. A new bot was created to be - managed by the bot, or token or owner of a managed bot was changed. - - .. versionadded:: NEXT.VERSION """ __slots__ = ( diff --git a/src/telegram/_user.py b/src/telegram/_user.py index 821f230adb6..72af9c2a9a9 100644 --- a/src/telegram/_user.py +++ b/src/telegram/_user.py @@ -130,51 +130,7 @@ class User(TelegramObject): .. versionadded:: NEXT.VERSION - Attributes: - id (:obj:`int`): Unique identifier for this user or bot. - is_bot (:obj:`bool`): :obj:`True`, if this user is a bot. - first_name (:obj:`str`): User's or bot's first name. - last_name (:obj:`str`): Optional. User's or bot's last name. - username (:obj:`str`): Optional. User's or bot's username. - language_code (:obj:`str`): Optional. IETF language tag of the user's language. - can_join_groups (:obj:`str`): Optional. :obj:`True`, if the bot can be invited to groups. - Returned only in :attr:`telegram.Bot.get_me` requests. - can_read_all_group_messages (:obj:`str`): Optional. :obj:`True`, if privacy mode is - disabled for the bot. Returned only in :attr:`telegram.Bot.get_me` requests. - supports_inline_queries (:obj:`str`): Optional. :obj:`True`, if the bot supports inline - queries. Returned only in :attr:`telegram.Bot.get_me` requests. - is_premium (:obj:`bool`): Optional. :obj:`True`, if this user is a Telegram - Premium user. - - .. versionadded:: 20.0 - added_to_attachment_menu (:obj:`bool`): Optional. :obj:`True`, if this user added - the bot to the attachment menu. - - .. versionadded:: 20.0 - can_connect_to_business (:obj:`bool`): Optional. :obj:`True`, if the bot can be connected - to a Telegram Business account to receive its messages. Returned only in - :meth:`telegram.Bot.get_me`. - - .. versionadded:: 21.1 - has_main_web_app (:obj:`bool`) Optional. :obj:`True`, if the bot has the main Web App. - Returned only in :meth:`telegram.Bot.get_me`. - - .. versionadded:: 21.5 - has_topics_enabled (:obj:`bool`): Optional. :obj:`True`, if the bot has forum topic mode - enabled in private chats. Returned only in :meth:`telegram.Bot.get_me`. - - .. versionadded:: 22.6 - allows_users_to_create_topics (:obj:`bool`): Optional. :obj:`True`, if the bot allows - users to create and delete topics in private chats. Returned only in - :meth:`telegram.Bot.get_me`. - - .. versionadded:: 22.7 - can_manage_bots (:obj:`bool`): Optional. :obj:`True`, if other bots can be created to be - controlled by the bot. Returned only in :meth:`telegram.Bot.get_me`. - - .. versionadded:: NEXT.VERSION - - .. |user_chat_id_note| replace:: This shortcuts build on the assumption that :attr:`User.id` + .. |user_chat_id_note| replace:: This shortcut builds on the assumption that :attr:`User.id` coincides with the :attr:`Chat.id` of the private chat with the user. This has been the case so far, but Telegram does not guarantee that this stays this way. """ diff --git a/src/telegram/_userprofileaudios.py b/src/telegram/_userprofileaudios.py index 769298f0b83..a94e581401e 100644 --- a/src/telegram/_userprofileaudios.py +++ b/src/telegram/_userprofileaudios.py @@ -41,11 +41,6 @@ class UserProfileAudios(TelegramObject): Args: total_count (:obj:`int`): Total number of profile audios for the target user. audios (Sequence[:class:`telegram.Audio`]): Requested profile audios. - - Attributes: - total_count (:obj:`int`): Total number of profile audios for the target user. - audios (tuple[:class:`telegram.Audio`]): Requested profile audios. - """ __slots__ = ("audios", "total_count") diff --git a/src/telegram/_userprofilephotos.py b/src/telegram/_userprofilephotos.py index 59cebae1835..f39cc7aeb11 100644 --- a/src/telegram/_userprofilephotos.py +++ b/src/telegram/_userprofilephotos.py @@ -39,18 +39,6 @@ class UserProfilePhotos(TelegramObject): total_count (:obj:`int`): Total number of profile pictures the target user has. photos (Sequence[Sequence[:class:`telegram.PhotoSize`]]): Requested profile pictures (in up to 4 sizes each). - - .. versionchanged:: 20.0 - |sequenceclassargs| - - Attributes: - total_count (:obj:`int`): Total number of profile pictures. - photos (tuple[tuple[:class:`telegram.PhotoSize`]]): Requested profile pictures (in up to 4 - sizes each). - - .. versionchanged:: 20.0 - |tupleclassattrs| - """ __slots__ = ("photos", "total_count") diff --git a/src/telegram/_userrating.py b/src/telegram/_userrating.py index f8045eed9ec..4f4f45b3e32 100644 --- a/src/telegram/_userrating.py +++ b/src/telegram/_userrating.py @@ -40,17 +40,6 @@ class UserRating(TelegramObject): current_level_rating (:obj:`int`): The rating value required to get the current level next_level_rating (:obj:`int`, optional): The rating value required to get to the next level; omitted if the maximum level was reached - - Attributes: - level (:obj:`int`): Current level of the user, indicating their reliability when purchasing - digital goods and services. A higher level suggests a more trustworthy customer; a - negative level is likely reason for concern. - rating (:obj:`int`): Numerical value of the user's rating; the higher the rating, the - better - current_level_rating (:obj:`int`): The rating value required to get the current level - next_level_rating (:obj:`int`): Optional. The rating value required to get to the next - level; omitted if the maximum level was reached - """ __slots__ = ("current_level_rating", "level", "next_level_rating", "rating") diff --git a/src/telegram/_videochat.py b/src/telegram/_videochat.py index b7f75dfc590..576e21e52ff 100644 --- a/src/telegram/_videochat.py +++ b/src/telegram/_videochat.py @@ -120,16 +120,6 @@ class VideoChatParticipantsInvited(TelegramObject): Args: users (Sequence[:class:`telegram.User`]): New members that were invited to the video chat. - - .. versionchanged:: 20.0 - |sequenceclassargs| - - Attributes: - users (tuple[:class:`telegram.User`]): New members that were invited to the video chat. - - .. versionchanged:: 20.0 - |tupleclassattrs| - """ __slots__ = ("users",) @@ -165,18 +155,11 @@ class VideoChatScheduled(TelegramObject): This class was renamed from ``VoiceChatScheduled`` in accordance to Bot API 6.0. Args: - start_date (:obj:`datetime.datetime`): Point in time (Unix timestamp) when the video - chat is supposed to be started by a chat administrator + start_date (:obj:`datetime.datetime`): Point in time when the video + chat is supposed to be started by a chat administrator. .. versionchanged:: 20.3 |datetime_localization| - Attributes: - start_date (:obj:`datetime.datetime`): Point in time (Unix timestamp) when the video - chat is supposed to be started by a chat administrator - - .. versionchanged:: 20.3 - |datetime_localization| - """ __slots__ = ("start_date",) diff --git a/src/telegram/_webappdata.py b/src/telegram/_webappdata.py index 04583cf99f5..2bcfaa8019a 100644 --- a/src/telegram/_webappdata.py +++ b/src/telegram/_webappdata.py @@ -39,12 +39,6 @@ class WebAppData(TelegramObject): button_text (:obj:`str`): Text of the :paramref:`~telegram.KeyboardButton.web_app` keyboard button, from which the Web App was opened. - Attributes: - data (:obj:`str`): The data. Be aware that a bad client can send arbitrary data in this - field. - button_text (:obj:`str`): Text of the :paramref:`~telegram.KeyboardButton.web_app` keyboard - button, from which the Web App was opened. - Warning: Be aware that a bad client can send arbitrary data in this field. """ diff --git a/src/telegram/_webappinfo.py b/src/telegram/_webappinfo.py index 2d29cef7df5..a3f090bb291 100644 --- a/src/telegram/_webappinfo.py +++ b/src/telegram/_webappinfo.py @@ -38,11 +38,6 @@ class WebAppInfo(TelegramObject): url (:obj:`str`): An HTTPS URL of a Web App to be opened with additional data as specified in `Initializing Web Apps \ `_. - - Attributes: - url (:obj:`str`): An HTTPS URL of a Web App to be opened with additional data as specified - in `Initializing Web Apps \ - `_. """ __slots__ = ("url",) diff --git a/src/telegram/_webhookinfo.py b/src/telegram/_webhookinfo.py index 94f6f7bf22e..7711fb52a99 100644 --- a/src/telegram/_webhookinfo.py +++ b/src/telegram/_webhookinfo.py @@ -65,40 +65,6 @@ class WebhookInfo(TelegramObject): subscribed to. Defaults to all update types, except :attr:`telegram.Update.chat_member`. - .. versionchanged:: 20.0 - |sequenceclassargs| - - last_synchronization_error_date (:class:`datetime.datetime`, optional): Datetime of the - most recent error that happened when trying to synchronize available updates with - Telegram datacenters. - - .. versionadded:: 20.0 - - .. versionchanged:: 20.3 - |datetime_localization| - Attributes: - url (:obj:`str`): Webhook URL, may be empty if webhook is not set up. - has_custom_certificate (:obj:`bool`): :obj:`True`, if a custom certificate was provided for - webhook certificate checks. - pending_update_count (:obj:`int`): Number of updates awaiting delivery. - ip_address (:obj:`str`): Optional. Currently used webhook IP address. - last_error_date (:class:`datetime.datetime`): Optional. Datetime for the most recent - error that happened when trying to deliver an update via webhook. - - .. versionchanged:: 20.3 - |datetime_localization| - last_error_message (:obj:`str`): Optional. Error message in human-readable format for the - most recent error that happened when trying to deliver an update via webhook. - max_connections (:obj:`int`): Optional. Maximum allowed number of simultaneous HTTPS - connections to the webhook for update delivery. - allowed_updates (tuple[:obj:`str`]): Optional. A tuple of update types the bot is - subscribed to. Defaults to all update types, except - :attr:`telegram.Update.chat_member`. - - .. versionchanged:: 20.0 - - * |tupleclassattrs| - * |alwaystuple| last_synchronization_error_date (:class:`datetime.datetime`, optional): Datetime of the most recent error that happened when trying to synchronize available updates with Telegram datacenters. diff --git a/src/telegram/_writeaccessallowed.py b/src/telegram/_writeaccessallowed.py index c0ff1322fc4..0c7c312f792 100644 --- a/src/telegram/_writeaccessallowed.py +++ b/src/telegram/_writeaccessallowed.py @@ -50,21 +50,6 @@ class WriteAccessAllowed(TelegramObject): the bot was added to the attachment or side menu. .. versionadded:: 20.6 - - Attributes: - web_app_name (:obj:`str`): Optional. Name of the Web App, if the access was granted when - the Web App was launched from a link. - - .. versionadded:: 20.3 - from_request (:obj:`bool`): Optional. :obj:`True`, if the access was granted after the user - accepted an explicit request from a Web App. - - .. versionadded:: 20.6 - from_attachment_menu (:obj:`bool`): Optional. :obj:`True`, if the access was granted when - the bot was added to the attachment or side menu. - - .. versionadded:: 20.6 - """ __slots__ = ("from_attachment_menu", "from_request", "web_app_name") diff --git a/src/telegram/error.py b/src/telegram/error.py index 014bf8631b3..e737fc72426 100644 --- a/src/telegram/error.py +++ b/src/telegram/error.py @@ -54,6 +54,9 @@ class TelegramError(Exception): conversion of the data may be needed on major updates of the library. .. seealso:: :wiki:`Exceptions, Warnings and Logging ` + + Args: + message (:obj:`str`): The error message. """ __slots__ = ("message",) @@ -188,10 +191,6 @@ class ChatMigrated(TelegramError): Args: new_chat_id (:obj:`int`): The new chat id of the group. - - Attributes: - new_chat_id (:obj:`int`): The new chat id of the group. - """ __slots__ = ("new_chat_id",) diff --git a/src/telegram/ext/_application.py b/src/telegram/ext/_application.py index d4a216e6b27..33781e97bd2 100644 --- a/src/telegram/ext/_application.py +++ b/src/telegram/ext/_application.py @@ -103,9 +103,6 @@ async def conversation_callback(update, context): Args: state (:obj:`object`, optional): The next state of the conversation. - - Attributes: - state (:obj:`object`): Optional. The next state of the conversation. """ __slots__ = ("state",) diff --git a/src/telegram/ext/_callbackdatacache.py b/src/telegram/ext/_callbackdatacache.py index 4fd73b4ad44..b341ed9f7fe 100644 --- a/src/telegram/ext/_callbackdatacache.py +++ b/src/telegram/ext/_callbackdatacache.py @@ -58,10 +58,6 @@ class InvalidCallbackData(TelegramError): Args: callback_data (:obj:`int`, optional): The button data of which the callback data could not be found. - - Attributes: - callback_data (:obj:`int`): Optional. The button data of which the callback data could not - be found. """ __slots__ = ("callback_data",) @@ -142,15 +138,10 @@ class CallbackDataCache: bot (:class:`telegram.ext.ExtBot`): The bot this cache is for. maxsize (:obj:`int`, optional): Maximum number of items in each of the internal mappings. Defaults to ``1024``. - persistent_data (tuple[list[tuple[:obj:`str`, :obj:`float`, \ dict[:obj:`str`, :class:`object`]]], dict[:obj:`str`, :obj:`str`]], optional): \ Data to initialize the cache with, as returned by \ :meth:`telegram.ext.BasePersistence.get_callback_data`. - - Attributes: - bot (:class:`telegram.ext.ExtBot`): The bot this cache is for. - """ __slots__ = ("_callback_queries", "_keyboard_data", "_maxsize", "bot") diff --git a/src/telegram/ext/_handlers/conversationhandler.py b/src/telegram/ext/_handlers/conversationhandler.py index 044e957aa41..2136251bba5 100644 --- a/src/telegram/ext/_handlers/conversationhandler.py +++ b/src/telegram/ext/_handlers/conversationhandler.py @@ -268,8 +268,8 @@ class ConversationHandler(BaseHandler[Update, CCT, object]): "_per_user", "_persistent", "_states", + "_timeout_jobs", "_timeout_jobs_lock", - "timeout_jobs", ) END: Final[int] = -1 @@ -326,7 +326,7 @@ def __init__( # if conversation_timeout is used, this dict is used to schedule a job which runs when the # conv has timed out. - self.timeout_jobs: dict[ConversationKey, Job[Any]] = {} + self._timeout_jobs: dict[ConversationKey, Job[Any]] = {} self._timeout_jobs_lock = asyncio.Lock() self._conversations: ConversationDict = {} self._child_conversations: set[ConversationHandler] = set() @@ -694,7 +694,7 @@ def _schedule_job( try: # both job_queue & conversation_timeout are checked before calling _schedule_job j_queue = application.job_queue - self.timeout_jobs[conversation_key] = j_queue.run_once( # type: ignore[union-attr] + self._timeout_jobs[conversation_key] = j_queue.run_once( # type: ignore[union-attr] self._trigger_timeout, self.conversation_timeout, # type: ignore[arg-type] data=_ConversationTimeoutContext(conversation_key, update, application, context), @@ -818,7 +818,7 @@ async def handle_update( # type: ignore[override] async with self._timeout_jobs_lock: # Remove the old timeout job (if present) - timeout_job = self.timeout_jobs.pop(conversation_key, None) + timeout_job = self._timeout_jobs.pop(conversation_key, None) if timeout_job is not None: timeout_job.schedule_removal() @@ -932,11 +932,11 @@ async def _trigger_timeout(self, context: CCT) -> None: callback_context = ctxt.callback_context async with self._timeout_jobs_lock: - found_job = self.timeout_jobs.get(ctxt.conversation_key) + found_job = self._timeout_jobs.get(ctxt.conversation_key) if found_job is not job: # The timeout has been cancelled in handle_update return - del self.timeout_jobs[ctxt.conversation_key] + del self._timeout_jobs[ctxt.conversation_key] # Now run all handlers which are in TIMEOUT state handlers = self.states.get(self.TIMEOUT, []) diff --git a/src/telegram/ext/_picklepersistence.py b/src/telegram/ext/_picklepersistence.py index acabff8da88..7b87ca6197c 100644 --- a/src/telegram/ext/_picklepersistence.py +++ b/src/telegram/ext/_picklepersistence.py @@ -185,6 +185,21 @@ class PicklePersistence(BasePersistence[UD, CD, BD]): in the ``context`` interface. .. versionadded:: 13.6 + user_data (dict[:obj:`int`, :obj:`dict`]): A dictionary mapping user ids to their + respective user data. This attribute is only populated after :meth:`get_user_data` + has been called. + chat_data (dict[:obj:`int`, :obj:`dict`]): A dictionary mapping chat ids to their + respective chat data. This attribute is only populated after :meth:`get_chat_data` + has been called. + bot_data (:attr:`telegram.ext.ContextTypes.bot_data`): The bot data. This + attribute is only populated after :meth:`get_bot_data` has been called. + callback_data (tuple[list[tuple[:obj:`str`, :obj:`float`, \ + dict[:obj:`str`, :class:`object`]]], dict[:obj:`str`, :obj:`str`]]): The data relevant + for restoring :class:`telegram.ext.CallbackDataCache`. This attribute is only + populated after :meth:`get_callback_data` has been called. + conversations (dict[:obj:`str`, dict[tuple[:obj:`int` | :obj:`str`, ...],\ + :obj:`object`]]]): A dictionary mapping handler names to their conversations. + This attribute is only populated after :meth:`get_conversations` has been called. """ __slots__ = ( diff --git a/src/telegram/ext/_updater.py b/src/telegram/ext/_updater.py index 672768afb8e..bf61bf2b5be 100644 --- a/src/telegram/ext/_updater.py +++ b/src/telegram/ext/_updater.py @@ -88,11 +88,6 @@ class Updater(contextlib.AbstractAsyncContextManager["Updater"]): Args: bot (:class:`telegram.Bot`): The bot used with this Updater. update_queue (:class:`asyncio.Queue`): Queue for the updates. - - Attributes: - bot (:class:`telegram.Bot`): The bot used with this Updater. - update_queue (:class:`asyncio.Queue`): Queue for the updates. - """ __slots__ = ( diff --git a/src/telegram/ext/_utils/stack.py b/src/telegram/ext/_utils/stack.py index 9c7c097ec06..0c88d5e50fa 100644 --- a/src/telegram/ext/_utils/stack.py +++ b/src/telegram/ext/_utils/stack.py @@ -43,7 +43,7 @@ def was_called_by(frame: FrameType | None, caller: Path) -> bool: >>> was_called_by(inspect.currentframe(), Path(__file__)) True - Arguments: + Args: frame (:obj:`FrameType`): The frame - usually the return value of ``inspect.currentframe()``. If :obj:`None` is passed, the return value will be :obj:`False`. diff --git a/src/telegram/ext/filters.py b/src/telegram/ext/filters.py index d8fa167e7b0..5e9f571e3f1 100644 --- a/src/telegram/ext/filters.py +++ b/src/telegram/ext/filters.py @@ -1260,15 +1260,15 @@ class FileExtension(MessageFilter): i.e. without a dot in the filename. """ - __slots__ = ("_file_extension", "is_case_sensitive") + __slots__ = ("_file_extension", "_is_case_sensitive") def __init__(self, file_extension: str | None, case_sensitive: bool = False): super().__init__() - self.is_case_sensitive: bool = case_sensitive + self._is_case_sensitive: bool = case_sensitive if file_extension is None: self._file_extension = None self.name = "filters.Document.FileExtension(None)" - elif self.is_case_sensitive: + elif self._is_case_sensitive: self._file_extension = f".{file_extension}" self.name = ( f"filters.Document.FileExtension({file_extension!r}, case_sensitive=True)" @@ -1282,7 +1282,7 @@ def filter(self, message: Message) -> bool: return False if self._file_extension is None: return "." not in message.document.file_name - if self.is_case_sensitive: + if self._is_case_sensitive: filename = message.document.file_name else: filename = message.document.file_name.lower() diff --git a/src/telegram/warnings.py b/src/telegram/warnings.py index 53d93db4271..87899e0b453 100644 --- a/src/telegram/warnings.py +++ b/src/telegram/warnings.py @@ -62,14 +62,6 @@ class PTBDeprecationWarning(PTBUserWarning, DeprecationWarning): message (:obj:`str`): The message to display. .. versionadded:: 21.2 - - Attributes: - version (:obj:`str`): The version in which the feature was deprecated. - - .. versionadded:: 21.2 - message (:obj:`str`): The message to display. - - .. versionadded:: 21.2 """ __slots__ = ("message", "version") diff --git a/tests/docs/attribute_inserter.py b/tests/docs/attribute_inserter.py new file mode 100644 index 00000000000..11595d39eeb --- /dev/null +++ b/tests/docs/attribute_inserter.py @@ -0,0 +1,585 @@ +#!/usr/bin/env python +# +# A library that provides a Python interface to the Telegram Bot API +# Copyright (C) 2015-2026 +# Leandro Toledo de Souza +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser Public License for more details. +# +# You should have received a copy of the GNU Lesser Public License +# along with this program. If not, see [http://www.gnu.org/licenses/]. + +""" +This module is intentionally named without a "test_" prefix. +These tests are supposed to be run on GitHub when building docs. +The tests require Python 3.12+ (just like AttributeInserter being tested), so they cannot be +included in the main suite while older versions of Python are supported. +""" + +import pytest + +from docs.auxil.attribute_inserter import ( + ENTRY_PATTERN, + KNOWN_SECTION_TITLES, + AttributeInserter, + DocstringEntry, + DocstringParser, + _is_col0_noncontent, + _is_section_header, +) + + +@pytest.fixture +def inserter(): + return AttributeInserter() + + +class TestHelpers: + def test_entry_pattern_matches_simple(self): + m = ENTRY_PATTERN.match(" name (:obj:`str`): The name.") + assert m is not None + assert m.group(1) == "name" + assert m.group(2) == ":obj:`str`" + assert m.group(3) == "The name." + + def test_entry_pattern_matches_optional(self): + m = ENTRY_PATTERN.match( + " invite_link (:class:`telegram.ChatInviteLink`, optional): Chat invite link." + ) + assert m is not None + assert m.group(1) == "invite_link" + assert m.group(2) == ":class:`telegram.ChatInviteLink`, optional" + assert m.group(3) == "Chat invite link." + + def test_entry_pattern_matches_sequence(self): + m = ENTRY_PATTERN.match( + " stickers (Sequence[:class:`telegram.Sticker`]): List of all set stickers." + ) + assert m is not None + assert m.group(1) == "stickers" + assert m.group(2) == "Sequence[:class:`telegram.Sticker`]" + assert m.group(3) == "List of all set stickers." + + def test_entry_pattern_rejects_wrong_indent(self): + # 8-space indent should not match + assert ENTRY_PATTERN.match(" name (:obj:`str`): desc.") is None + + def test_entry_pattern_rejects_no_type(self): + # No parenthesised type + assert ENTRY_PATTERN.match(" name: description") is None + + def test_is_section_header_known_titles(self): + for title in KNOWN_SECTION_TITLES: + assert _is_section_header(f"{title}:") + + def test_is_section_header_unknown_title(self): + assert not _is_section_header("FooBar:") + + def test_is_section_header_indented(self): + assert not _is_section_header(" Args:") + assert not _is_section_header(" Note:") + + def test_is_section_header_no_colon(self): + assert not _is_section_header("Args") + + +class TestDocstringEntry: + def test_to_attribute_lines_simple(self): + """Non-optional arg with a plain type produces attribute line unchanged.""" + entry = DocstringEntry( + name="title", + type_str=":obj:`str`", + is_optional=False, + all_lines=(" title (:obj:`str`): Sticker set title.",), + ) + assert entry.to_attribute_lines() == [" title (:obj:`str`): Sticker set title."] + + def test_to_attribute_lines_optional(self): + """Optional arg: 'Optional. ' prepended to description, type has no ', optional'.""" + entry = DocstringEntry( + name="invite_link", + type_str=":class:`telegram.ChatInviteLink`", + is_optional=True, + all_lines=( + " invite_link (:class:`telegram.ChatInviteLink`, optional): Chat invite link.", + ), + ) + result = entry.to_attribute_lines() + assert result == [ + " invite_link (:class:`telegram.ChatInviteLink`): Optional. Chat invite link." + ] + + def test_to_attribute_lines_sequence_not_optional(self): + """Sequence[ in type is replaced; body lines pass through unchanged.""" + entry = DocstringEntry( + name="stickers", + type_str="Sequence[:class:`telegram.Sticker`]", + is_optional=False, + all_lines=( + " stickers (Sequence[:class:`telegram.Sticker`]): List of all set stickers.", + "", + " .. versionchanged:: 20.0", + " |sequenceclassargs|", + ), + ) + result = entry.to_attribute_lines() + assert ( + result[0] + == " stickers (tuple[:class:`telegram.Sticker`]): List of all set stickers." + ) + # Body lines are unchanged - no substitution replacement + assert " |sequenceclassargs|" in result + assert "|tupleclassattrs|" not in "\n".join(result) + + def test_to_attribute_lines_sequence_optional(self): + """Optional Sequence: type replaced, Optional. prefix, body passes through.""" + entry = DocstringEntry( + name="caption_entities", + type_str="Sequence[:class:`telegram.MessageEntity`]", + is_optional=True, + all_lines=( + " caption_entities " + "(Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|", + "", + " .. versionchanged:: 20.0", + " |sequenceclassargs|", + ), + ) + result = entry.to_attribute_lines() + assert result[0].startswith( + " caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional." + ) + # Body lines unchanged + assert " |sequenceclassargs|" in result + + def test_to_attribute_lines_no_trailing_blank(self): + """to_attribute_lines() never appends a trailing blank line.""" + entry = DocstringEntry( + name="x", + type_str=":obj:`int`", + is_optional=False, + all_lines=(" x (:obj:`int`): Some value.",), + ) + result = entry.to_attribute_lines() + assert result[-1] != "" + + def test_to_attribute_lines_empty_all_lines_warns(self): + entry = DocstringEntry( + name="x", + type_str=":obj:`int`", + is_optional=False, + all_lines=(), + ) + with pytest.warns(UserWarning, match="no lines"): + result = entry.to_attribute_lines() + assert result == [] + + def test_to_attribute_lines_sequence_replaced_in_type(self): + """'Sequence[' is replaced with 'tuple[' in the header type string.""" + entry = DocstringEntry( + name="items", + type_str="Sequence[:obj:`str`]", + is_optional=False, + all_lines=(" items (Sequence[:obj:`str`]): Some items.",), + ) + result = entry.to_attribute_lines() + assert "tuple[:obj:`str`]" in result[0] + assert "Sequence" not in result[0] + + def test_to_attribute_lines_optional_empty_description(self): + """When the description is empty, 'Optional.' is still produced cleanly.""" + entry = DocstringEntry( + name="flag", + type_str=":obj:`bool`", + is_optional=True, + all_lines=(" flag (:obj:`bool`, optional): ",), + ) + result = entry.to_attribute_lines() + # The description part starts with "Optional. " (trailing space if original desc is empty) + assert result[0].startswith(" flag (:obj:`bool`): Optional.") + + +class TestDocstringParser: + def test_sections_empty_docstring(self): + parser = DocstringParser([]) + assert parser.sections == {} + + def test_sections_no_sections(self): + parser = DocstringParser(["Just a description.", "No sections here."]) + assert parser.sections == {} + + def test_parse_single_args_section(self): + lines = [ + "Description.", + "", + "Args:", + " name (:obj:`str`): The name.", + " value (:obj:`int`, optional): The value.", + ] + parser = DocstringParser(lines) + assert "Args" in parser.sections + + args = parser.sections["Args"] + assert args.start_idx == 2 + assert args.end_idx == 5 + assert set(args.entries.keys()) == {"name", "value"} + + assert args.entries["name"].is_optional is False + assert args.entries["name"].type_str == ":obj:`str`" + + assert args.entries["value"].is_optional is True + assert args.entries["value"].type_str == ":obj:`int`" + + def test_parse_preserves_continuation_lines(self): + lines = [ + "Args:", + " stickers (Sequence[:class:`telegram.Sticker`]): List of stickers.", + "", + " .. versionchanged:: 20.0", + " |sequenceclassargs|", + ] + parser = DocstringParser(lines) + entry = parser.sections["Args"].entries["stickers"] + # Trailing blank line should be stripped from all_lines. + assert entry.all_lines == ( + " stickers (Sequence[:class:`telegram.Sticker`]): List of stickers.", + "", + " .. versionchanged:: 20.0", + " |sequenceclassargs|", + ) + + def test_parse_multiple_sections(self): + lines = [ + "Args:", + " name (:obj:`str`): The name.", + "", + "Attributes:", + " name (:obj:`str`): The name.", + "", + ] + parser = DocstringParser(lines) + assert "Args" in parser.sections + assert "Attributes" in parser.sections + + args = parser.sections["Args"] + attrs = parser.sections["Attributes"] + + assert args.start_idx == 0 + assert args.end_idx == 3 # stops at "Attributes:" line + assert attrs.start_idx == 3 + assert attrs.end_idx == 6 + + def test_parse_end_idx_at_eof(self): + lines = [ + "Args:", + " name (:obj:`str`): The name.", + ] + parser = DocstringParser(lines) + assert parser.sections["Args"].end_idx == 2 # == len(lines) + + def test_get_section_args_present(self): + """'Args:' header is found when requesting 'Args'.""" + lines = [ + "Args:", + " x (:obj:`str`): X.", + ] + parser = DocstringParser(lines) + section = parser.get_section("Args") + assert section is not None + assert section.title == "Args" + + def test_col0_rst_directive_terminates_section(self): + """An RST substitution definition at column 0 stops section parsing.""" + lines = [ + "Attributes:", + " name (:obj:`str`): The name.", + "", + ".. |user_chat_id_note| replace:: This shortcut builds on the assumption.", + " continued text here.", + ] + parser = DocstringParser(lines) + attrs = parser.sections["Attributes"] + # The section ends before the substitution definition. + assert attrs.end_idx == 3 # points to the blank line before the directive + assert "name" in attrs.entries + + def test_is_col0_noncontent_cases(self): + assert _is_col0_noncontent(".. |foo| replace:: bar") + assert not _is_col0_noncontent(" some text") + assert not _is_col0_noncontent("") + assert not _is_col0_noncontent("Args:") + + def test_get_section_absent_returns_none(self): + parser = DocstringParser(["Description."]) + assert parser.get_section("Args") is None + assert parser.get_section("Attributes") is None + + def test_sections_lazily_parsed(self): + parser = DocstringParser(["Args:", " x (:obj:`str`): X."]) + assert parser._sections is None # not yet parsed + _ = parser.sections + assert parser._sections is not None # now parsed + + def test_parse_strips_trailing_blank_lines_from_entry(self): + lines = [ + "Args:", + " name (:obj:`str`): The name.", + "", + "", + ] + parser = DocstringParser(lines) + entry = parser.sections["Args"].entries["name"] + # Trailing blank lines must not be part of all_lines. + assert entry.all_lines == (" name (:obj:`str`): The name.",) + + def test_parse_indented_section_like_line_is_not_a_header(self): + """A line like ' Note:' inside an entry is continuation, not a new section.""" + lines = [ + "Args:", + " name (:obj:`str`): The name.", + " Note: some note.", + ] + parser = DocstringParser(lines) + # " Note:" must NOT have ended the Args section. + assert parser.sections["Args"].end_idx == 3 + entry = parser.sections["Args"].entries["name"] + assert len(entry.all_lines) == 2 + + +class TestAttributeInserter: + def test_no_args_section_noop(self, inserter): + """If there is no Args section, lines must not be modified.""" + lines = ["Just a description."] + original = list(lines) + inserter.insert_attributes(object, lines) + assert lines == original + + def test_creates_attributes_section(self, inserter): + """When no Attributes section exists one is created.""" + lines = [ + "Description.", + "", + "Args:", + " name (:obj:`str`): The name.", + ] + inserter.insert_attributes(object, lines) + + assert "Attributes:" in lines + attr_idx = lines.index("Attributes:") + assert " name (:obj:`str`): The name." in lines[attr_idx:] + + def test_creates_attributes_section_with_separator(self, inserter): + """A blank line is added between existing content and the new Attributes header.""" + lines = [ + "Args:", + " name (:obj:`str`): The name.", + ] + inserter.insert_attributes(object, lines) + attr_idx = lines.index("Attributes:") + # The line before "Attributes:" must be blank. + assert lines[attr_idx - 1] == "" + + def test_no_separator_if_already_blank(self, inserter): + """No extra blank line is inserted before Attributes: if the last line is already blank.""" + lines = [ + "Args:", + " name (:obj:`str`): The name.", + "", + ] + inserter.insert_attributes(object, lines) + attr_idx = lines.index("Attributes:") + assert lines[attr_idx - 1] == "" + # There must not be two consecutive blank lines before the header. + if attr_idx >= 2: + assert not (lines[attr_idx - 1] == "" and lines[attr_idx - 2] == "") + + def test_skips_already_documented_attributes(self, inserter): + """Attributes already present in the Attributes section are not duplicated.""" + lines = [ + "Args:", + " name (:obj:`str`): The name.", + "", + "Attributes:", + " name (:obj:`str`): The name.", + ] + original_len = len(lines) + inserter.insert_attributes(object, lines) + # Nothing new should have been added. + assert len(lines) == original_len + + def test_inserts_missing_into_existing_section(self, inserter): + """When some args are missing from Attributes, they are appended to the section.""" + lines = [ + "Args:", + " name (:obj:`str`): The name.", + " title (:obj:`str`): The title.", + "", + "Attributes:", + " name (:obj:`str`): The name.", + ] + inserter.insert_attributes(object, lines) + + attr_idx = lines.index("Attributes:") + attrs_block = lines[attr_idx:] + assert " title (:obj:`str`): The title." in attrs_block + + def test_inserts_before_trailing_blanks(self, inserter): + """New entries are inserted before any trailing blank lines in the Attributes section.""" + lines = [ + "Args:", + " title (:obj:`str`): The title.", + "", + "Attributes:", + " name (:obj:`str`): The name.", + "", + ] + inserter.insert_attributes(object, lines) + + attr_idx = lines.index("Attributes:") + attrs_block = lines[attr_idx:] + title_idx = attrs_block.index(" title (:obj:`str`): The title.") + # The trailing blank from the original section should still be present. + assert "" in attrs_block[title_idx + 1 :] + + def test_optional_gets_optional_prefix(self, inserter): + """Optional args produce 'Optional. ' prefix in the generated attribute entry.""" + lines = [ + "Args:", + " thumb (:class:`telegram.PhotoSize`, optional): The thumbnail.", + ] + inserter.insert_attributes(object, lines) + assert " thumb (:class:`telegram.PhotoSize`): Optional. The thumbnail." in lines + + def test_sequence_type_replaced(self, inserter): + """'Sequence[' is replaced with 'tuple[' in generated attribute entries.""" + lines = [ + "Args:", + " items (Sequence[:obj:`str`]): The items.", + ] + inserter.insert_attributes(object, lines) + attr_idx = lines.index("Attributes:") + attrs_block = "\n".join(lines[attr_idx:]) + assert "tuple[:obj:`str`]" in attrs_block + assert "Sequence" not in attrs_block + + def test_property_not_duplicated(self, inserter): + """Args entries that correspond to a property on the class are not generated.""" + + class _MyClass: + __slots__ = ("_value",) + + @property + def value(self) -> int: + return self._value # type: ignore[return-value] + + lines = [ + "Args:", + " value (:obj:`int`): The value.", + ] + inserter.insert_attributes(_MyClass, lines) + # No Attributes section should be created because 'value' is a property. + assert "Attributes:" not in lines + + def test_undocumented_public_slot_raises(self, inserter): + """A public own slot with no Args entry and no Attributes entry raises an error.""" + + class _MyClass: + __slots__ = ("computed",) + + lines = [ + "Args:", + " name (:obj:`str`): The name.", + ] + with pytest.raises(RuntimeError, match="public slot 'computed'"): + inserter.insert_attributes(_MyClass, lines) + + def test_rst_substitution_after_attributes_not_swallowed(self, inserter): + """RST substitution definitions after Attributes section are preserved intact.""" + lines = [ + "Args:", + " name (:obj:`str`): The name.", + "", + "Attributes:", + " name (:obj:`str`): The name.", + "", + ".. |my_note| replace:: Some note text.", + " continued.", + ] + original_directive_line = lines[6] + inserter.insert_attributes(object, lines) + # The substitution definition must still be present and in the right place. + assert original_directive_line in lines + assert lines.index(original_directive_line) == 6 + + def test_sequence_classargs_substitution_non_optional(self, inserter): + """Full round-trip: Sequence->tuple in type; body lines pass through unchanged.""" + lines = [ + "Args:", + " stickers (Sequence[:class:`telegram.Sticker`]): List of stickers.", + "", + " .. versionchanged:: 20.0", + " |sequenceclassargs|", + ] + inserter.insert_attributes(object, lines) + + attr_idx = lines.index("Attributes:") + attrs_block = lines[attr_idx:] + assert " stickers (tuple[:class:`telegram.Sticker`]): List of stickers." in attrs_block + # Body lines pass through unchanged + assert " |sequenceclassargs|" in attrs_block + assert "|tupleclassattrs|" not in "\n".join(attrs_block) + + def test_sequence_classargs_substitution_optional(self, inserter): + """Full round-trip: optional Sequence; body lines pass through unchanged.""" + lines = [ + "Args:", + " items (Sequence[:obj:`str`], optional): The items.", + "", + " .. versionchanged:: 20.0", + " |sequenceclassargs|", + ] + inserter.insert_attributes(object, lines) + + attr_idx = lines.index("Attributes:") + attrs_block = lines[attr_idx:] + assert " items (tuple[:obj:`str`]): Optional. The items." in attrs_block + assert " |sequenceclassargs|" in attrs_block + assert "|tupleclassattrs|" not in "\n".join(attrs_block) + assert "|alwaystuple|" not in "\n".join(attrs_block) + + def test_no_args_section_slot_raises(self, inserter): + """No Args section but class has undocumented public slot -> raises.""" + + class _MyClass: + __slots__ = ("computed",) + + lines = ["Just a description."] + with pytest.raises(RuntimeError, match="public slot 'computed'"): + inserter.insert_attributes(_MyClass, lines) + # Lines unchanged (no args to generate from) + assert "Attributes:" not in lines + + def test_modifies_lines_in_place(self, inserter): + """insert_attributes must modify the *same* list object, not replace it.""" + lines = ["Args:", " x (:obj:`str`): X."] + original_id = id(lines) + inserter.insert_attributes(object, lines) + assert id(lines) == original_id + + def test_no_args_entries_is_noop(self, inserter): + """An Args section with no parsable entries leaves lines unchanged.""" + lines = [ + "Args:", + " Some non-entry text.", + ] + original = list(lines) + inserter.insert_attributes(object, lines) + assert lines == original