From a5f9aa3171f055acb4026bb8f0212e7d3f4c0096 Mon Sep 17 00:00:00 2001 From: Noam Meltzer Date: Mon, 17 Oct 2016 23:44:40 +0300 Subject: [PATCH] more documentation --- telegram/inlinequeryresultcachedphoto.py | 28 ++++++++++++++-- telegram/inlinequeryresultcachedsticker.py | 22 +++++++++++-- telegram/inlinequeryresultcachedvideo.py | 28 ++++++++++++++-- telegram/inlinequeryresultcachedvoice.py | 26 +++++++++++++-- telegram/inlinequeryresultcontact.py | 32 +++++++++++++++++-- telegram/inlinequeryresultdocument.py | 37 ++++++++++++++++++++-- telegram/inlinequeryresultgif.py | 29 +++++++++++++++++ telegram/inlinequeryresultlocation.py | 33 +++++++++++++++++-- telegram/inlinequeryresultmpeg4gif.py | 34 ++++++++++++++++++-- telegram/inlinequeryresultphoto.py | 22 +++++++++++-- 10 files changed, 273 insertions(+), 18 deletions(-) diff --git a/telegram/inlinequeryresultcachedphoto.py b/telegram/inlinequeryresultcachedphoto.py index fa7bbe5d3..98a9fa30c 100644 --- a/telegram/inlinequeryresultcachedphoto.py +++ b/telegram/inlinequeryresultcachedphoto.py @@ -16,13 +16,37 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultPhoto""" +"""This module contains the classes that represent Telegram InlineQueryResultPhoto""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultcachedsticker.py b/telegram/inlinequeryresultcachedsticker.py index f27f2e406..cdf644e77 100644 --- a/telegram/inlinequeryresultcachedsticker.py +++ b/telegram/inlinequeryresultcachedsticker.py @@ -16,13 +16,31 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultCachedSticker""" +"""This module contains the classes that represent Telegram InlineQueryResultCachedSticker""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultcachedvideo.py b/telegram/inlinequeryresultcachedvideo.py index 6890176aa..a8033d240 100644 --- a/telegram/inlinequeryresultcachedvideo.py +++ b/telegram/inlinequeryresultcachedvideo.py @@ -16,13 +16,37 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultCachedVideo""" +"""This module contains the classes that represent Telegram InlineQueryResultCachedVideo""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultcachedvoice.py b/telegram/inlinequeryresultcachedvoice.py index 927d51045..8b8cb882c 100644 --- a/telegram/inlinequeryresultcachedvoice.py +++ b/telegram/inlinequeryresultcachedvoice.py @@ -16,13 +16,35 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultCachedVoice""" +"""This module contains the classes that represent Telegram InlineQueryResultCachedVoice""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultcontact.py b/telegram/inlinequeryresultcontact.py index 2755a456a..d6df97718 100644 --- a/telegram/inlinequeryresultcontact.py +++ b/telegram/inlinequeryresultcontact.py @@ -16,13 +16,41 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultContact""" +"""This module contains the classes that represent Telegram InlineQueryResultContact""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultdocument.py b/telegram/inlinequeryresultdocument.py index 81345bb8a..30a79af01 100644 --- a/telegram/inlinequeryresultdocument.py +++ b/telegram/inlinequeryresultdocument.py @@ -16,13 +16,46 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultDocument""" +"""This module contains the classes that represent Telegram InlineQueryResultDocument""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultgif.py b/telegram/inlinequeryresultgif.py index b96bfbb17..42cfd2015 100644 --- a/telegram/inlinequeryresultgif.py +++ b/telegram/inlinequeryresultgif.py @@ -23,6 +23,35 @@ from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageConten 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, id, diff --git a/telegram/inlinequeryresultlocation.py b/telegram/inlinequeryresultlocation.py index 8d2f53f31..3c442e317 100644 --- a/telegram/inlinequeryresultlocation.py +++ b/telegram/inlinequeryresultlocation.py @@ -16,13 +16,42 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultLocation""" +"""This module contains the classes that represent Telegram InlineQueryResultLocation""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultmpeg4gif.py b/telegram/inlinequeryresultmpeg4gif.py index bf9a9822a..9d4f23bf0 100644 --- a/telegram/inlinequeryresultmpeg4gif.py +++ b/telegram/inlinequeryresultmpeg4gif.py @@ -16,13 +16,43 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultMpeg4Gif""" +"""This module contains the classes that represent Telegram InlineQueryResultMpeg4Gif""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id, diff --git a/telegram/inlinequeryresultphoto.py b/telegram/inlinequeryresultphoto.py index c79f4389f..6606b2ae1 100644 --- a/telegram/inlinequeryresultphoto.py +++ b/telegram/inlinequeryresultphoto.py @@ -16,13 +16,31 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains the classes that represent Telegram -InlineQueryResultPhoto""" +"""This module contains the classes that represent Telegram InlineQueryResultPhoto""" from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent 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, id,