Compare commits

..

2 Commits

Author SHA1 Message Date
harshil21 75e700b4f3 Add chango fragment for PR #5267 2026-06-17 07:35:35 +00:00
Harshil 143b64581d Autogenerate Attribute docstrings (#5246) 2026-06-16 09:52:17 -04:00
158 changed files with 994 additions and 4678 deletions
@@ -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
- name: Test autogeneration of admonitions and attributes
run: pytest -v --tb=short tests/docs/admonition_inserter.py tests/docs/attribute_inserter.py
@@ -0,0 +1,5 @@
documentation = "Autogenerate Attribute docstrings"
[[pull_requests]]
uid = "5246"
author_uids = ["harshil21"]
closes_threads = []
@@ -0,0 +1,5 @@
documentation = "Documentation Improvements"
[[pull_requests]]
uid = "5267"
author_uids = ["harshil21"]
closes_threads = []
+260
View File
@@ -0,0 +1,260 @@
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# 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*(.*)")
"""Matches a single entry like `` name (type): description`` in a docstring."""
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))
}
# Raise when own public slots 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)
+1 -9
View File
@@ -91,14 +91,6 @@ RAISES_BLOCK = [
]
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:
@@ -106,7 +98,7 @@ def find_insert_pos_for_raises(lines: list[str]) -> int:
return len(lines) # Insert at the end if there's no Raises block
def check_timeout_and_api_kwargs_presence(obj: object) -> int:
def check_timeout_and_api_kwargs_presence(obj: object) -> bool:
"""Checks if the method has timeout and api_kwargs keyword only parameters."""
sig = inspect.signature(obj)
params_to_check = (
+18 -12
View File
@@ -27,11 +27,10 @@ from sphinx.application import Sphinx
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 @@ if TYPE_CHECKING:
ADMONITION_INSERTER = AdmonitionInserter()
ATTRIBUTE_INSERTER = AttributeInserter()
# Some base classes are implementation detail
# We want to instead show *their* base class
@@ -93,8 +93,9 @@ def autodoc_process_docstring(
2) Use this method to automatically insert "Returned in" admonition into classes
that are returned from the Bot methods
3) Use this method to automatically insert "Available in" admonition into classes
whose instances are available as attributes of other classes
3) Use this method to automatically insert the Attributes block, wherever applicable,
for Telegram objects. The "Available in" admonition is then also inserted. These are
instances of a class which are available as attributes of other classes.
4) Use this method to automatically insert "Use in" admonition into classes
whose instances can be used as arguments of the Bot methods
@@ -103,7 +104,7 @@ def autodoc_process_docstring(
to the actual object here.
"""
# 1) Insert the Keyword Args and "Shortcuts" admonitions for the Bot methods
# 1) Insert the Keyword Args, "Shortcuts" admonitions, and "Raises" block for the Bot methods
method_name = name.rsplit(".", maxsplit=1)[-1]
if (
name.startswith("telegram.Bot.")
@@ -111,13 +112,15 @@ def autodoc_process_docstring(
and method_name.islower()
and check_timeout_and_api_kwargs_presence(obj)
):
parser = DocstringParser(lines)
# Logic for inserting keyword args into docstrings:
# -------------------------------------------------
insert_index = find_insert_pos_for_kwargs(lines)
if not insert_index:
returns_section = parser.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
@@ -141,10 +144,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 parser.get_section("Raises") is None:
lines.extend(RAISES_BLOCK)
# Logic for inserting "Shortcuts" admonition:
# -------------------------------------------
@@ -155,7 +156,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,
-6
View File
@@ -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")
+1
View File
@@ -4692,6 +4692,7 @@ class Bot(TelegramObject, contextlib.AbstractAsyncContextManager["Bot"]):
"""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.
-9
View File
@@ -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")
-7
View File
@@ -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")
-8
View File
@@ -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",)
-4
View File
@@ -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",)
+1 -73
View File
@@ -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 @@ class BusinessOpeningHours(TelegramObject):
):
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
)
-16
View File
@@ -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__ = (
-18
View File
@@ -4253,24 +4253,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
"""
-58
View File
@@ -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
"""
-47
View File
@@ -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",)
-41
View File
@@ -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",)
-176
View File
@@ -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 <telegram.constants.AccentColor>` 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 <https://telegram.org/blog/topics-in-groups-collectible-usernames\
#collectible-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 <telegram.constants.ProfileAccentColor>` 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=<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
-32
View File
@@ -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__ = (
+2 -21
View File
@@ -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 <https://github.com/tdlib/telegram-bot-api/issues/428>`_
for some discussion.
-7
View File
@@ -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")
-153
View File
@@ -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__ = (
@@ -529,64 +442,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.
If omitted, defaults to the value of :attr:`can_pin_messages`.
.. versionadded:: 22.7
can_react_to_messages (:obj:`bool`): :obj:`True`, if the user is allowed to react to
messages.
.. versionadded:: 22.8
tag (:obj:`str`): Optional. Tag of the member.
.. versionadded:: 22.7
"""
__slots__ = (
@@ -678,7 +533,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__ = ()
@@ -711,13 +565,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",)
-23
View File
@@ -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__ = (
-9
View File
@@ -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 who will become 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 who will become the new owner of the
chat if the previous owner does not return to the chat
"""
__slots__ = ("new_owner",)
+2 -51
View File
@@ -47,6 +47,7 @@ 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.
@@ -54,7 +55,6 @@ class ChatPermissions(TelegramObject):
:attr:`can_react_to_messages` 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
@@ -103,60 +103,11 @@ class ChatPermissions(TelegramObject):
tag.
.. versionadded:: 22.7
can_react_to_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to react
to messages. If omitted, defaults to the value of :attr:`can_send_messages`.
.. versionadded:: 22.8
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
can_react_to_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to react
to messages. If omitted, defaults to the value of :attr:`can_send_messages`.
.. versionadded:: 22.8
"""
__slots__ = (
+3 -47
View File
@@ -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")
-11
View File
@@ -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")
+1 -7
View File
@@ -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",)
-13
View File
@@ -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")
@@ -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")
+1 -15
View File
@@ -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")
-15
View File
@@ -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")
-17
View File
@@ -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")
-19
View File
@@ -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__ = (
-8
View File
@@ -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")
-14
View File
@@ -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")
-10
View File
@@ -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__ = (
-1
View File
@@ -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://<attach_name>`` URI.
filename (:obj:`str`): Filename for the file to be sent.
mimetype (:obj:`str`): The mimetype inferred from the file to be sent.
"""
+2 -131
View File
@@ -95,26 +95,11 @@ class InputMedia(_BaseInputMedia):
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")
@@ -165,7 +150,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.
"""
@@ -270,20 +254,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__ = (
@@ -412,10 +388,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
@@ -447,33 +419,14 @@ class InputMediaAnimation(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.BaseInputMediaType.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__ = (
@@ -573,14 +526,11 @@ 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
@@ -596,23 +546,6 @@ class InputMediaPhoto(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.BaseInputMediaType.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__ = (
@@ -701,10 +634,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.
@@ -728,7 +657,7 @@ 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
@@ -744,40 +673,16 @@ class InputMediaVideo(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.BaseInputMediaType.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
"""
@@ -1047,10 +952,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.
@@ -1076,24 +977,11 @@ class InputMediaAudio(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.BaseInputMediaType.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
@@ -1189,10 +1077,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.
@@ -1213,19 +1097,6 @@ class InputMediaDocument(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.BaseInputMediaType.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
-4
View File
@@ -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
-20
View File
@@ -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")
+1 -5
View File
@@ -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")
-10
View File
@@ -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__ = (
-12
View File
@@ -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")
+2 -78
View File
@@ -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")
-13
View File
@@ -50,19 +50,6 @@ class Venue(TelegramObject):
google_place_type (:obj:`str`, optional): Google Places type of the venue. (See
`supported types <https://developers.google.com/maps/documentation/places/web-service\
/place-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 <https://developers.google.com/maps/documentation/places/web-service\
/place-types>`_.)
"""
__slots__ = (
-21
View File
@@ -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__ = (
-12
View File
@@ -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")
-13
View File
@@ -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")
-8
View File
@@ -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")
-14
View File
@@ -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")
-26
View File
@@ -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")
-33
View File
@@ -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 <https://t.me/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 <https://t.me/BotFather>`_.
"""
__slots__ = (
-6
View File
@@ -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")
+1 -92
View File
@@ -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__ = (
-64
View File
@@ -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
"""
@@ -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=<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=<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
<https://core.telegram.org/bots/webapps>`_ 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 <https://fragment.com/>`_ 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__ = (
@@ -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",)
-18
View File
@@ -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")
@@ -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")
@@ -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__ = (
+1 -25
View File
@@ -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__ = (
@@ -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__ = (
@@ -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__ = (
@@ -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__ = (
@@ -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__ = (
@@ -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__ = (
@@ -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")
@@ -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__ = (
@@ -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__ = (
@@ -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__ = (
@@ -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__ = (
@@ -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")
+2 -35
View File
@@ -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__ = (
@@ -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__ = (
@@ -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__ = (
+2 -33
View File
@@ -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__ = (
@@ -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 <https://core.telegram.org/bots/webapps>`_ 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")
+1 -30
View File
@@ -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 <https://developers.google.com/maps/documentation/places/web-service\
/place-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__ = (
+2 -37
View File
@@ -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__ = (
+1 -25
View File
@@ -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__ = (
@@ -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")
@@ -65,10 +65,6 @@ class InputInvoiceMessageContent(InputMessageContent):
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 InputInvoiceMessageContent(InputMessageContent):
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 InputInvoiceMessageContent(InputMessageContent):
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 <https://t.me/Botfather>`_. Pass an empty string for payments in `Telegram
Stars <https://t.me/BotNews/90>`_.
currency (:obj:`str`): Three-letter ISO 4217 currency code, see more on
`currencies <https://core.telegram.org/bots/payments#supported-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 <https://core.telegram.org/bots/payments/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__ = (
@@ -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__ = (
@@ -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")
@@ -46,21 +46,6 @@ class InputVenueMessageContent(InputMessageContent):
google_place_type (:obj:`str`, optional): Google Places type of the venue. (See
`supported types <https://developers.google.com/maps/documentation/places/web-service\
/place-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 <https://developers.google.com/maps/documentation/places/web-service\
/place-types>`_.)
"""
__slots__ = (
@@ -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")
-41
View File
@@ -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__ = (
+4 -63
View File
@@ -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:: 22.8
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
<https://core.telegram.org/bots/webapps>`_ 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 <https://telegram.me/BotFather>` Mini App. Available in private
chats only.
.. versionadded:: 22.8
"""
__slots__ = (
-5
View File
@@ -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",)
+1 -63
View File
@@ -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:: 22.8
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__ = (
-14
View File
@@ -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__ = (
-21
View File
@@ -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
<https://core.telegram.org/widgets/login#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 <https://core.telegram.org/widgets/login#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
<https://core.telegram.org/widgets/login#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")
-8
View File
@@ -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")
-11
View File
@@ -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")
+1 -463
View File
@@ -164,14 +164,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")
@@ -244,10 +236,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__ = ()
@@ -647,7 +637,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
@@ -734,458 +724,6 @@ class Message(MaybeInaccessibleMessage):
.. versionadded:: 22.8
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 <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 <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 <Working-with-Files-and-Media>`
game (:class:`telegram.Game`): Optional. Message is a game, information about the game.
:ref:`More about games >> <games-tree>`.
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 <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 <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 <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 <Working-with-Files-and-Media>`
video_note (:class:`telegram.VideoNote`): Optional. Message is a
`video note <https://telegram.org/blog/video-messages-and-telescope>`_, information
about the video message.
.. seealso:: :wiki:`Working with Files and Media <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 >> <payments-tree>`.
successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Message is a service
message about a successful payment, information about the payment.
:ref:`More about payments >> <payments-tree>`.
connected_website (:obj:`str`): Optional. The domain name of the website on which the user
has logged in.
`More about Telegram Login >> <https://core.telegram.org/widgets/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 <examples.passportbot>`
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:: 22.8
poll_option_deleted (:class:`telegram.PollOptionDeleted`): Optional. Service message:
answer option was deleted from a poll.
.. versionadded:: 22.8
reply_to_poll_option_id (:obj:`str`): Optional. Persistent
identifier of the specific poll option that is being replied to.
.. versionadded:: 22.8
managed_bot_created (:class:`telegram.ManagedBotCreated`): Optional. Service message: user
created a bot that will be managed by the current bot.
.. versionadded:: 22.8
guest_bot_caller_user (:class:`telegram.User`): Optional. For a message sent by a guest
bot, this is the user whose original message triggered the bot's response.
.. versionadded:: 22.8
guest_bot_caller_chat (:class:`telegram.Chat`): Optional. For a message sent by a guest
bot, this is the chat whose original message triggered the bot's response.
.. versionadded:: 22.8
guest_query_id (:obj:`str`): Optional. The unique identifier for the guest query. Use this
identifier with the method :meth:`telegram.Bot.answer_guest_query` to send a response
message. If non-empty, the message belongs to the chat where the guest bot was
summoned, which may not coincide with other existing bot chats sharing the same
identifier.
.. versionadded:: 22.8
live_photo (:class:`telegram.LivePhoto`): Optional. Message is a live photo, information
about the live photo. For backward compatibility, when this field is set, the photo
field will also be set.
.. versionadded:: 22.8
.. |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.
-46
View File
@@ -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
<https://core.telegram.org/bots/api#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__ = (
-6
View File
@@ -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",)
-23
View File
@@ -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__ = (

Some files were not shown because too many files have changed in this diff Show More