mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-25 08:37:07 +01:00
Documentation improvements + small style fixes
This commit is contained in:
parent
31cab0d1b4
commit
59fa717023
20 changed files with 476 additions and 588 deletions
|
@ -35,13 +35,12 @@ class Audio(TelegramObject):
|
||||||
Args:
|
Args:
|
||||||
file_id (str):
|
file_id (str):
|
||||||
duration (int):
|
duration (int):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
performer (Optional[str]):
|
performer (Optional[str]):
|
||||||
title (Optional[str]):
|
title (Optional[str]):
|
||||||
mime_type (Optional[str]):
|
mime_type (Optional[str]):
|
||||||
file_size (Optional[int]):
|
file_size (Optional[int]):
|
||||||
|
**kwargs: Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
|
881
telegram/bot.py
881
telegram/bot.py
File diff suppressed because it is too large
Load diff
|
@ -36,13 +36,14 @@ class Chat(TelegramObject):
|
||||||
Args:
|
Args:
|
||||||
id (int):
|
id (int):
|
||||||
type (str):
|
type (str):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
title (Optional[str]):
|
||||||
|
username(Optional[str]):
|
||||||
Keyword Args:
|
first_name(Optional[str]):
|
||||||
type (Optional[str]):
|
last_name(Optional[str]):
|
||||||
bot (Optional[Bot]): The Bot to use for instance methods
|
bot (Optional[Bot]): The Bot to use for instance methods
|
||||||
"""
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
|
"""
|
||||||
PRIVATE = 'private'
|
PRIVATE = 'private'
|
||||||
GROUP = 'group'
|
GROUP = 'group'
|
||||||
SUPERGROUP = 'supergroup'
|
SUPERGROUP = 'supergroup'
|
||||||
|
|
|
@ -32,8 +32,9 @@ class ChatMember(TelegramObject):
|
||||||
Args:
|
Args:
|
||||||
user (:class:`telegram.User`):
|
user (:class:`telegram.User`):
|
||||||
status (str):
|
status (str):
|
||||||
"""
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
|
"""
|
||||||
CREATOR = 'creator'
|
CREATOR = 'creator'
|
||||||
ADMINISTRATOR = 'administrator'
|
ADMINISTRATOR = 'administrator'
|
||||||
MEMBER = 'member'
|
MEMBER = 'member'
|
||||||
|
|
|
@ -33,11 +33,16 @@ class ChosenInlineResult(TelegramObject):
|
||||||
result_id (str):
|
result_id (str):
|
||||||
from_user (:class:`telegram.User`):
|
from_user (:class:`telegram.User`):
|
||||||
query (str):
|
query (str):
|
||||||
|
location (:class:`telegram.Location`):
|
||||||
|
inline_message_id (str):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
result_id (str):
|
result_id (str):
|
||||||
from_user (:class:`telegram.User`):
|
from_user (:class:`telegram.User`):
|
||||||
query (str):
|
query (str):
|
||||||
|
location (Optional[:class:`telegram.Location`]):
|
||||||
|
inline_message_id (Optional[str]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,10 @@ class Contact(TelegramObject):
|
||||||
Args:
|
Args:
|
||||||
phone_number (str):
|
phone_number (str):
|
||||||
first_name (str):
|
first_name (str):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
last_name (Optional[str]):
|
last_name (Optional[str]):
|
||||||
user_id (Optional[int]):
|
user_id (Optional[int]):
|
||||||
|
**kwargs: Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, phone_number, first_name, last_name='', user_id=0, **kwargs):
|
def __init__(self, phone_number, first_name, last_name='', user_id=0, **kwargs):
|
||||||
|
|
|
@ -33,13 +33,12 @@ class Document(TelegramObject):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
file_id (str):
|
file_id (str):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
thumb (Optional[:class:`telegram.PhotoSize`]):
|
thumb (Optional[:class:`telegram.PhotoSize`]):
|
||||||
file_name (Optional[str]):
|
file_name (Optional[str]):
|
||||||
mime_type (Optional[str]):
|
mime_type (Optional[str]):
|
||||||
file_size (Optional[int]):
|
file_size (Optional[int]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, file_id, thumb=None, file_name='', mime_type='', file_size=0, **kwargs):
|
def __init__(self, file_id, thumb=None, file_name='', mime_type='', file_size=0, **kwargs):
|
||||||
|
|
|
@ -34,11 +34,9 @@ class File(TelegramObject):
|
||||||
Args:
|
Args:
|
||||||
file_id (str):
|
file_id (str):
|
||||||
bot (telegram.Bot):
|
bot (telegram.Bot):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
file_size (Optional[int]):
|
file_size (Optional[int]):
|
||||||
file_path (Optional[str]):
|
file_path (Optional[str]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,9 @@ class ForceReply(ReplyMarkup):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
force_reply (bool):
|
force_reply (bool):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
selective (Optional[bool]):
|
selective (Optional[bool]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, force_reply=True, selective=False, **kwargs):
|
def __init__(self, force_reply=True, selective=False, **kwargs):
|
||||||
|
|
|
@ -33,12 +33,10 @@ class InlineKeyboardButton(TelegramObject):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text (str):
|
text (str):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
url (Optional[str]):
|
url (Optional[str]):
|
||||||
callback_data (Optional[str]):
|
callback_data (Optional[str]):
|
||||||
switch_inline_query (Optional[str]):
|
switch_inline_query (Optional[str]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ class InlineKeyboardMarkup(ReplyMarkup):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
inline_keyboard (List[List[:class:`telegram.InlineKeyboardButton`]]):
|
inline_keyboard (List[List[:class:`telegram.InlineKeyboardButton`]]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ class InlineKeyboardMarkup(ReplyMarkup):
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
telegram.InlineKeyboardMarkup:
|
telegram.InlineKeyboardMarkup:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
data = super(InlineKeyboardMarkup, InlineKeyboardMarkup).de_json(data, bot)
|
data = super(InlineKeyboardMarkup, InlineKeyboardMarkup).de_json(data, bot)
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,10 @@ class InlineQuery(TelegramObject):
|
||||||
from_user (:class:`telegram.User`):
|
from_user (:class:`telegram.User`):
|
||||||
query (str):
|
query (str):
|
||||||
offset (str):
|
offset (str):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
location (optional[:class:`telegram.Location`]):
|
location (optional[:class:`telegram.Location`]):
|
||||||
bot (Optional[Bot]): The Bot to use for instance methods
|
bot (Optional[Bot]): The Bot to use for instance methods
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, id, from_user, query, offset, location=None, bot=None, **kwargs):
|
def __init__(self, id, from_user, query, offset, location=None, bot=None, **kwargs):
|
||||||
|
|
|
@ -26,12 +26,13 @@ class InlineQueryResult(TelegramObject):
|
||||||
"""This object represents a Telegram InlineQueryResult.
|
"""This object represents a Telegram InlineQueryResult.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
type (str):
|
type (str): Type of the result.
|
||||||
id (str):
|
id (str): Unique identifier for this result, 1-64 Bytes
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
type (str):
|
type (str): Type of the result.
|
||||||
id (str): Unique identifier for this result, 1-64 Bytes
|
id (str): Unique identifier for this result, 1-64 Bytes
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -42,21 +42,20 @@ class InlineQueryResultArticle(InlineQueryResult):
|
||||||
|
|
||||||
parse_mode (str): Use :class:`InputTextMessageContent` instead.
|
parse_mode (str): Use :class:`InputTextMessageContent` instead.
|
||||||
|
|
||||||
disable_web_page_preview (bool): Use :class:`InputTextMessageContent`
|
disable_web_page_preview (bool): Use :class:`InputTextMessageContent` instead.
|
||||||
instead.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
id (str): Unique identifier for this result, 1-64 Bytes
|
id (str): Unique identifier for this result, 1-64 Bytes
|
||||||
title (str):
|
title (str):
|
||||||
reply_markup (:class:`telegram.ReplyMarkup`):
|
reply_markup (:class:`telegram.ReplyMarkup`):
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
url (Optional[str]):
|
url (Optional[str]):
|
||||||
hide_url (Optional[bool]):
|
hide_url (Optional[bool]):
|
||||||
description (Optional[str]):
|
description (Optional[str]):
|
||||||
thumb_url (Optional[str]):
|
thumb_url (Optional[str]):
|
||||||
thumb_width (Optional[int]):
|
thumb_width (Optional[int]):
|
||||||
thumb_height (Optional[int]):
|
thumb_height (Optional[int]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
|
|
@ -34,28 +34,24 @@ class InlineQueryResultAudio(InlineQueryResult):
|
||||||
performer (Optional[str]):
|
performer (Optional[str]):
|
||||||
audio_duration (Optional[str]):
|
audio_duration (Optional[str]):
|
||||||
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
||||||
input_message_content (Optional[
|
input_message_content (Optional[:class:`telegram.input_message_content`]):
|
||||||
:class:`telegram.input_message_content`]):
|
|
||||||
|
|
||||||
Deprecated: 4.0
|
Deprecated: 4.0
|
||||||
message_text (str): Use :class:`InputTextMessageContent` instead.
|
message_text (str): Use :class:`InputTextMessageContent` instead.
|
||||||
|
|
||||||
parse_mode (str): Use :class:`InputTextMessageContent` instead.
|
parse_mode (str): Use :class:`InputTextMessageContent` instead.
|
||||||
|
|
||||||
disable_web_page_preview (bool): Use :class:`InputTextMessageContent`
|
disable_web_page_preview (bool): Use :class:`InputTextMessageContent` instead.
|
||||||
instead.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
audio_url (str):
|
audio_url (str):
|
||||||
title (str):
|
title (str):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
performer (Optional[str]):
|
performer (Optional[str]):
|
||||||
audio_duration (Optional[str]):
|
audio_duration (Optional[str]):
|
||||||
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
||||||
input_message_content (Optional[
|
input_message_content (Optional[:class:`telegram.input_message_content`]):
|
||||||
:class:`telegram.input_message_content`]):
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
|
|
@ -23,34 +23,29 @@ from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageConten
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedAudio(InlineQueryResult):
|
class InlineQueryResultCachedAudio(InlineQueryResult):
|
||||||
"""Represents a link to an mp3 audio file stored on the Telegram
|
"""Represents a link to an mp3 audio file stored on the Telegram servers. By default, this
|
||||||
servers. By default, this audio file will be sent by the user.
|
audio file will be sent by the user. Alternatively, you can use input_message_content to send a
|
||||||
Alternatively, you can use input_message_content to send a message with
|
message with the specified content instead of the audio.
|
||||||
the specified content instead of the audio.
|
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
id (str):
|
id (str):
|
||||||
audio_file_id (str):
|
audio_file_id (str):
|
||||||
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
||||||
input_message_content (Optional[
|
input_message_content (Optional[:class:`telegram.input_message_content`]):
|
||||||
:class:`telegram.input_message_content`]):
|
|
||||||
|
|
||||||
Deprecated: 4.0
|
Deprecated: 4.0
|
||||||
message_text (str): Use :class:`InputTextMessageContent` instead.
|
message_text (str): Use :class:`InputTextMessageContent` instead.
|
||||||
|
|
||||||
parse_mode (str): Use :class:`InputTextMessageContent` instead.
|
parse_mode (str): Use :class:`InputTextMessageContent` instead.
|
||||||
|
|
||||||
disable_web_page_preview (bool): Use :class:`InputTextMessageContent`
|
disable_web_page_preview (bool): Use :class:`InputTextMessageContent` instead.
|
||||||
instead.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
audio_file_id (str):
|
audio_file_id (str):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
||||||
input_message_content (Optional[
|
input_message_content (Optional[:class:`telegram.input_message_content`]):
|
||||||
:class:`telegram.input_message_content`]):
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, id, audio_file_id, reply_markup=None, input_message_content=None, **kwargs):
|
def __init__(self, id, audio_file_id, reply_markup=None, input_message_content=None, **kwargs):
|
||||||
|
|
|
@ -16,13 +16,38 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser Public License
|
# You should have received a copy of the GNU Lesser Public License
|
||||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||||
"""This module contains the classes that represent Telegram
|
"""This module contains the classes that represent Telegram InlineQueryResultCachedDocument"""
|
||||||
InlineQueryResultCachedDocument"""
|
|
||||||
|
|
||||||
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
|
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedDocument(InlineQueryResult):
|
class InlineQueryResultCachedDocument(InlineQueryResult):
|
||||||
|
"""Represents a link to a file stored on the Telegram servers. By default, this file will be
|
||||||
|
sent by the user with an optional caption. Alternatively, you can use input_message_content to
|
||||||
|
send a message with the specified content instead of the file. Currently, only pdf-files and
|
||||||
|
zip archives can be sent using this method.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
title (str): Title for the result.
|
||||||
|
document_file_id (str): A valid file identifier for the file.
|
||||||
|
description (Optional[str]): Short description of the result.
|
||||||
|
caption (Optional[str]): Caption of the document to be sent, 0-200 characters.
|
||||||
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): Inline keyboard attached
|
||||||
|
to the message.
|
||||||
|
input_message_content (Optional[:class:`telegram.InputMessageContent`]): Content of the
|
||||||
|
message to be sent instead of the file.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (str):
|
||||||
|
title (str):
|
||||||
|
document_file_id (str):
|
||||||
|
description (Optional[str]):
|
||||||
|
caption (Optional[str]):
|
||||||
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
||||||
|
input_message_content (Optional[:class:`telegram.InputMessageContent`]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -23,6 +23,29 @@ from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageConten
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedGif(InlineQueryResult):
|
class InlineQueryResultCachedGif(InlineQueryResult):
|
||||||
|
"""Represents a link to an animated GIF file stored on the Telegram servers. By default, this
|
||||||
|
animated GIF file will be sent by the user with an optional caption. Alternatively, you can use
|
||||||
|
input_message_content to send a message with specified content instead of the animation.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
gif_file_id (str): A valid file identifier for the GIF file.
|
||||||
|
title (Optional[str]): Title for the result.
|
||||||
|
caption (Optional[str]): Caption of the GIF file to be sent, 0-200 characters.
|
||||||
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): Inline keyboard attached
|
||||||
|
to the message.
|
||||||
|
input_message_content (Optional[:class:`telegram.InputMessageContent`]): Content of the
|
||||||
|
message to be sent instead of the GIF animation.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (str):
|
||||||
|
gif_file_id (str):
|
||||||
|
title (Optional[str]):
|
||||||
|
caption (Optional[str]):
|
||||||
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
||||||
|
input_message_content (Optional[:class:`telegram.InputMessageContent`]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -23,6 +23,30 @@ from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageConten
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
||||||
|
"""Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the
|
||||||
|
Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an
|
||||||
|
optional caption. Alternatively, you can use input_message_content to send a message with the
|
||||||
|
specified content instead of the animation.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
mpeg4_file_id (str): A valid file identifier for the MP4 file.
|
||||||
|
title (Optional[str]): Title for the result.
|
||||||
|
caption (Optional[str]): Caption of the MPEG-4 file to be sent, 0-200 characters.
|
||||||
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): Inline keyboard attached
|
||||||
|
to the message.
|
||||||
|
input_message_content (Optional[:class:`telegram.InputMessageContent`]): Content of the
|
||||||
|
message to be sent instead of the video animation
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (str):
|
||||||
|
mpeg4_file_id (str):
|
||||||
|
title (Optional[str]):
|
||||||
|
caption (Optional[str]):
|
||||||
|
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
|
||||||
|
input_message_content (Optional[:class:`telegram.InputMessageContent`]):
|
||||||
|
**kwargs (dict): Arbitrary keyword arguments.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -153,9 +153,7 @@ class Message(TelegramObject):
|
||||||
self.reply_to_message = reply_to_message
|
self.reply_to_message = reply_to_message
|
||||||
self.edit_date = edit_date
|
self.edit_date = edit_date
|
||||||
self.text = text
|
self.text = text
|
||||||
if entities is None:
|
self.entities = entities or list()
|
||||||
entities = list()
|
|
||||||
self.entities = entities
|
|
||||||
self.audio = audio
|
self.audio = audio
|
||||||
self.document = document
|
self.document = document
|
||||||
self.photo = photo
|
self.photo = photo
|
||||||
|
|
Loading…
Reference in a new issue