more documentation

This commit is contained in:
Noam Meltzer 2016-10-17 23:44:40 +03:00
parent 59fa717023
commit a5f9aa3171
10 changed files with 273 additions and 18 deletions

View file

@ -16,13 +16,37 @@
# #
# 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 InlineQueryResultPhoto"""
InlineQueryResultPhoto"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultCachedPhoto(InlineQueryResult): class InlineQueryResultCachedPhoto(InlineQueryResult):
"""Represents a link to a photo stored on the Telegram servers. By default, this photo 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 photo.
Attributes:
photo_file_id (str): A valid file identifier of the photo.
title (Optional[str]): Title for the result.
description (Optional[str]): Short description of the result.
caption (Optional[str]): Caption of the photo 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 photo
Args:
id (str):
photo_file_id (str):
title (Optional[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,

View file

@ -16,13 +16,31 @@
# #
# 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 InlineQueryResultCachedSticker"""
InlineQueryResultCachedSticker"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultCachedSticker(InlineQueryResult): class InlineQueryResultCachedSticker(InlineQueryResult):
"""Represents a link to a sticker stored on the Telegram servers. By default, this sticker will
be sent by the user. Alternatively, you can use input_message_content to send a message with
the specified content instead of the sticker.
Attributes:
sticker_file_id (str): A valid file identifier of the sticker.
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 sticker.
Args:
id (str):
sticker_file_id (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,

View file

@ -16,13 +16,37 @@
# #
# 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 InlineQueryResultCachedVideo"""
InlineQueryResultCachedVideo"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultCachedVideo(InlineQueryResult): class InlineQueryResultCachedVideo(InlineQueryResult):
"""Represents a link to a video file stored on the Telegram servers. By default, this video
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 video.
Attributes:
video_file_id (str): A valid file identifier for the video file.
title (str): Title for the result.
description (Optional[str]): Short description of the result.
caption (Optional[str]): Caption of the video 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
Args:
id (str):
video_file_id (str):
title (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,

View file

@ -16,13 +16,35 @@
# #
# 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 InlineQueryResultCachedVoice"""
InlineQueryResultCachedVoice"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultCachedVoice(InlineQueryResult): class InlineQueryResultCachedVoice(InlineQueryResult):
"""Represents a link to a voice message stored on the Telegram servers. By default, this voice
message will be sent by the user. Alternatively, you can use input_message_content to send a
message with the specified content instead of the voice message.
Attributes:
voice_file_id (str): A valid file identifier for the voice message.
title (str): Voice message title.
caption (Optional[str]): Caption, 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 voice message.
Args:
id (str):
voice_file_id (str):
title (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,

View file

@ -16,13 +16,41 @@
# #
# 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 InlineQueryResultContact"""
InlineQueryResultContact"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultContact(InlineQueryResult): class InlineQueryResultContact(InlineQueryResult):
"""Represents a contact with a phone number. By default, this contact will be sent by the user.
Alternatively, you can use input_message_content to send a message with the specified content
instead of the contact.
Attributes:
phone_number (str): Contact's phone number.
first_name (str): Contact's first name.
last_name (Optional[str]): Contact's last name.
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 contact.
thumb_url (Optional[str]): Url of the thumbnail for the result.
thumb_width (Optional[int]): Thumbnail width.
thumb_height (Optional[int]): Thumbnail height.
Args:
id (str):
phone_number (str):
first_name (str):
last_name (Optional[str]):
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
input_message_content (Optional[:class:`telegram.InputMessageContent`]):
thumb_url (Optional[str]): Url of the thumbnail for the result.
thumb_width (Optional[int]):
thumb_height (Optional[int]):
**kwargs (dict): Arbitrary keyword arguments.
"""
def __init__(self, def __init__(self,
id, id,

View file

@ -16,13 +16,46 @@
# #
# 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 InlineQueryResultDocument"""
InlineQueryResultDocument"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultDocument(InlineQueryResult): class InlineQueryResultDocument(InlineQueryResult):
"""Represents a link to a file. 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 and .ZIP files can be sent using this method.
Attributes:
title (str): Title for the result.
caption (Optional[str]): Caption of the document to be sent, 0-200 characters.
document_url (Optional[str]): A valid URL for the file.
mime_type (Optional[str]): Mime type of the content of the file, either "application/pdf"
or "application/zip".
description (Optional[str]): Short description of the result.
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.
thumb_url (Optional[str]): URL of the thumbnail (jpeg only) for the file.
thumb_width (Optional[int]): Thumbnail width.
thumb_height (Optional[int]): Thumbnail height.
Args:
id (str):
document_url (str):
title (str):
mime_type (str):
caption (Optional[str]):
description (Optional[str]):
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
input_message_content (Optional[:class:`telegram.InputMessageContent`]):
thumb_url (Optional[str]):
thumb_width (Optional[int]):
thumb_height (Optional[int]):
**kwargs (dict): Arbitrary keyword arguments.
"""
def __init__(self, def __init__(self,
id, id,

View file

@ -23,6 +23,35 @@ from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageConten
class InlineQueryResultGif(InlineQueryResult): class InlineQueryResultGif(InlineQueryResult):
"""Represents a link to an animated GIF file. By default, this animated GIF file will be sent
by the user with optional caption. Alternatively, you can use input_message_content to send a
message with the specified content instead of the animation.
Attributes:
gif_url (str): A valid URL for the GIF file. File size must not exceed 1MB.
thumb_url (str): URL of the static thumbnail for the result (jpeg or gif).
gif_width (Optional[int]): Width of the GIF.
gif_height (Optional[int]): Height of the GIF.
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_url (str):
thumb_url (str):
gif_width (Optional[int]):
gif_height (Optional[int]):
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,

View file

@ -16,13 +16,42 @@
# #
# 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 InlineQueryResultLocation"""
InlineQueryResultLocation"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultLocation(InlineQueryResult): class InlineQueryResultLocation(InlineQueryResult):
"""Represents a location on a map. By default, the location will be sent by the user.
Alternatively, you can use input_message_content to send a message with the specified content
instead of the location.
Attributes:
latitude (float): Location latitude in degrees.
longitude (float): Location longitude in degrees.
title (str): Location title.
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 location.
thumb_url (Optional[str]): Url of the thumbnail for the result.
thumb_width (Optional[int]): Thumbnail width.
thumb_height (Optional[int]): Thumbnail height.
Args:
latitude (float): Location latitude in degrees.
longitude (float): Location longitude in degrees.
title (str): Location title.
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 location.
thumb_url (Optional[str]): Url of the thumbnail for the result.
thumb_width (Optional[int]): Thumbnail width.
thumb_height (Optional[int]): Thumbnail height.
**kwargs (dict): Arbitrary keyword arguments.
"""
def __init__(self, def __init__(self,
id, id,

View file

@ -16,13 +16,43 @@
# #
# 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 InlineQueryResultMpeg4Gif"""
InlineQueryResultMpeg4Gif"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultMpeg4Gif(InlineQueryResult): class InlineQueryResultMpeg4Gif(InlineQueryResult):
"""Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default,
this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you
can use input_message_content to send a message with the specified content instead of the
animation.
Attributes:
mpeg4_url (str): A valid URL for the MP4 file. File size must not exceed 1MB.
thumb_url (str): URL of the static thumbnail (jpeg or gif) for the result.
mpeg4_width (Optional[int]): Video width.
mpeg4_height (Optional[int]): Video height.
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:
mpeg4_url (str): A valid URL for the MP4 file. File size must not exceed 1MB.
thumb_url (str): URL of the static thumbnail (jpeg or gif) for the result.
mpeg4_width (Optional[int]): Video width.
mpeg4_height (Optional[int]): Video height.
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.
**kwargs (dict): Arbitrary keyword arguments.
"""
def __init__(self, def __init__(self,
id, id,

View file

@ -16,13 +16,31 @@
# #
# 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 InlineQueryResultPhoto"""
InlineQueryResultPhoto"""
from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
class InlineQueryResultPhoto(InlineQueryResult): class InlineQueryResultPhoto(InlineQueryResult):
"""Represents a link to a photo. By default, this photo will be sent by the user with optional
caption. Alternatively, you can use input_message_content to send a message with the specified
content instead of the photo.
Attributes:
photo_url (str): A valid URL of the photo. Photo must be in jpeg format. Photo size must
not exceed 5MB.
thumb_url (str): URL of the thumbnail for the photo.
photo_width (Optional[int]): Width of the photo.
photo_height (Optional[int]): Height of the photo.
title (Optional[str]): Title for the result.
description (Optional[str]): Short description of the result.
caption (Optional[str]): Caption of the photo 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 photo.
"""
def __init__(self, def __init__(self,
id, id,