mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-09 19:49:39 +01:00
Merge pull request #442 from python-telegram-bot/explicit-kwargs
Use explicit kwargs and change/add a bunch of documentation.
This commit is contained in:
commit
225bc24c2a
40 changed files with 1060 additions and 735 deletions
|
@ -35,24 +35,30 @@ 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, file_id, duration, **kwargs):
|
def __init__(self,
|
||||||
|
file_id,
|
||||||
|
duration,
|
||||||
|
performer='',
|
||||||
|
title='',
|
||||||
|
mime_type='',
|
||||||
|
file_size=0,
|
||||||
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.file_id = str(file_id)
|
self.file_id = str(file_id)
|
||||||
self.duration = int(duration)
|
self.duration = int(duration)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.performer = kwargs.get('performer', '')
|
self.performer = performer
|
||||||
self.title = kwargs.get('title', '')
|
self.title = title
|
||||||
self.mime_type = str(kwargs.get('mime_type', ''))
|
self.mime_type = str(mime_type)
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
self.file_size = int(file_size)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
1065
telegram/bot.py
1065
telegram/bot.py
File diff suppressed because it is too large
Load diff
|
@ -25,14 +25,15 @@ from telegram import TelegramObject, Message, User
|
||||||
class CallbackQuery(TelegramObject):
|
class CallbackQuery(TelegramObject):
|
||||||
"""This object represents a Telegram CallbackQuery."""
|
"""This object represents a Telegram CallbackQuery."""
|
||||||
|
|
||||||
def __init__(self, id, from_user, data, bot=None, **kwargs):
|
def __init__(self, id, from_user, data, message=None, inline_message_id='', bot=None,
|
||||||
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.id = id
|
self.id = id
|
||||||
self.from_user = from_user
|
self.from_user = from_user
|
||||||
self.data = data
|
self.data = data
|
||||||
# Optionals
|
# Optionals
|
||||||
self.message = kwargs.get('message')
|
self.message = message
|
||||||
self.inline_message_id = kwargs.get('inline_message_id', '')
|
self.inline_message_id = inline_message_id
|
||||||
|
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
|
@ -36,27 +36,36 @@ 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'
|
||||||
CHANNEL = 'channel'
|
CHANNEL = 'channel'
|
||||||
|
|
||||||
def __init__(self, id, type, bot=None, **kwargs):
|
def __init__(self,
|
||||||
|
id,
|
||||||
|
type,
|
||||||
|
title='',
|
||||||
|
username='',
|
||||||
|
first_name='',
|
||||||
|
last_name='',
|
||||||
|
bot=None,
|
||||||
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.id = int(id)
|
self.id = int(id)
|
||||||
self.type = type
|
self.type = type
|
||||||
# Optionals
|
# Optionals
|
||||||
self.title = kwargs.get('title', '')
|
self.title = title
|
||||||
self.username = kwargs.get('username', '')
|
self.username = username
|
||||||
self.first_name = kwargs.get('first_name', '')
|
self.first_name = first_name
|
||||||
self.last_name = kwargs.get('last_name', '')
|
self.last_name = last_name
|
||||||
|
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
|
@ -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,20 +33,19 @@ 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, **kwargs):
|
def __init__(self, phone_number, first_name, last_name='', user_id=0, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.phone_number = str(phone_number)
|
self.phone_number = str(phone_number)
|
||||||
self.first_name = first_name
|
self.first_name = first_name
|
||||||
# Optionals
|
# Optionals
|
||||||
self.last_name = kwargs.get('last_name', '')
|
self.last_name = last_name
|
||||||
self.user_id = int(kwargs.get('user_id', 0))
|
self.user_id = int(user_id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -33,23 +33,22 @@ 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, **kwargs):
|
def __init__(self, file_id, thumb=None, file_name='', mime_type='', file_size=0, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.file_id = str(file_id)
|
self.file_id = str(file_id)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.thumb = kwargs.get('thumb')
|
self.thumb = thumb
|
||||||
self.file_name = kwargs.get('file_name', '')
|
self.file_name = file_name
|
||||||
self.mime_type = str(kwargs.get('mime_type', ''))
|
self.mime_type = str(mime_type)
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
self.file_size = int(file_size)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -34,21 +34,19 @@ 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.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, file_id, bot, **kwargs):
|
def __init__(self, file_id, bot, file_size=0, file_path='', **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.file_id = str(file_id)
|
self.file_id = str(file_id)
|
||||||
|
|
||||||
# Optionals
|
# Optionals
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
self.file_size = int(file_size)
|
||||||
self.file_path = str(kwargs.get('file_path', ''))
|
self.file_path = str(file_path)
|
||||||
|
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
|
@ -30,17 +30,16 @@ 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, **kwargs):
|
def __init__(self, force_reply=True, selective=False, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.force_reply = bool(force_reply)
|
self.force_reply = bool(force_reply)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.selective = bool(kwargs.get('selective', False))
|
self.selective = bool(selective)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -33,23 +33,21 @@ 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.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, text, **kwargs):
|
def __init__(self, text, url=None, callback_data=None, switch_inline_query=None, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.text = text
|
self.text = text
|
||||||
|
|
||||||
# Optionals
|
# Optionals
|
||||||
self.url = kwargs.get('url')
|
self.url = url
|
||||||
self.callback_data = kwargs.get('callback_data')
|
self.callback_data = callback_data
|
||||||
self.switch_inline_query = kwargs.get('switch_inline_query')
|
self.switch_inline_query = switch_inline_query
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -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,14 +38,13 @@ 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, bot=None, **kwargs):
|
def __init__(self, id, from_user, query, offset, location=None, bot=None, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.id = id
|
self.id = id
|
||||||
self.from_user = from_user
|
self.from_user = from_user
|
||||||
|
@ -53,7 +52,7 @@ class InlineQuery(TelegramObject):
|
||||||
self.offset = offset
|
self.offset = offset
|
||||||
|
|
||||||
# Optional
|
# Optional
|
||||||
self.location = kwargs.get('location')
|
self.location = location
|
||||||
|
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -106,41 +106,75 @@ class Message(TelegramObject):
|
||||||
bot (Optional[Bot]): The Bot to use for instance methods
|
bot (Optional[Bot]): The Bot to use for instance methods
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, message_id, from_user, date, chat, bot=None, **kwargs):
|
def __init__(self,
|
||||||
|
message_id,
|
||||||
|
from_user,
|
||||||
|
date,
|
||||||
|
chat,
|
||||||
|
forward_from=None,
|
||||||
|
forward_from_chat=None,
|
||||||
|
forward_date=None,
|
||||||
|
reply_to_message=None,
|
||||||
|
edit_date=None,
|
||||||
|
text='',
|
||||||
|
entities=None,
|
||||||
|
audio=None,
|
||||||
|
document=None,
|
||||||
|
photo=None,
|
||||||
|
sticker=None,
|
||||||
|
video=None,
|
||||||
|
voice=None,
|
||||||
|
caption='',
|
||||||
|
contact=None,
|
||||||
|
location=None,
|
||||||
|
venue=None,
|
||||||
|
new_chat_member=None,
|
||||||
|
left_chat_member=None,
|
||||||
|
new_chat_title='',
|
||||||
|
new_chat_photo=None,
|
||||||
|
delete_chat_photo=False,
|
||||||
|
group_chat_created=False,
|
||||||
|
supergroup_chat_created=False,
|
||||||
|
migrate_to_chat_id=0,
|
||||||
|
migrate_from_chat_id=0,
|
||||||
|
channel_chat_created=False,
|
||||||
|
pinned_message=None,
|
||||||
|
bot=None,
|
||||||
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.message_id = int(message_id)
|
self.message_id = int(message_id)
|
||||||
self.from_user = from_user
|
self.from_user = from_user
|
||||||
self.date = date
|
self.date = date
|
||||||
self.chat = chat
|
self.chat = chat
|
||||||
# Optionals
|
# Optionals
|
||||||
self.forward_from = kwargs.get('forward_from')
|
self.forward_from = forward_from
|
||||||
self.forward_from_chat = kwargs.get('forward_from_chat')
|
self.forward_from_chat = forward_from_chat
|
||||||
self.forward_date = kwargs.get('forward_date')
|
self.forward_date = forward_date
|
||||||
self.reply_to_message = kwargs.get('reply_to_message')
|
self.reply_to_message = reply_to_message
|
||||||
self.edit_date = kwargs.get('edit_date')
|
self.edit_date = edit_date
|
||||||
self.text = kwargs.get('text', '')
|
self.text = text
|
||||||
self.entities = kwargs.get('entities', list())
|
self.entities = entities or list()
|
||||||
self.audio = kwargs.get('audio')
|
self.audio = audio
|
||||||
self.document = kwargs.get('document')
|
self.document = document
|
||||||
self.photo = kwargs.get('photo')
|
self.photo = photo
|
||||||
self.sticker = kwargs.get('sticker')
|
self.sticker = sticker
|
||||||
self.video = kwargs.get('video')
|
self.video = video
|
||||||
self.voice = kwargs.get('voice')
|
self.voice = voice
|
||||||
self.caption = kwargs.get('caption', '')
|
self.caption = caption
|
||||||
self.contact = kwargs.get('contact')
|
self.contact = contact
|
||||||
self.location = kwargs.get('location')
|
self.location = location
|
||||||
self.venue = kwargs.get('venue')
|
self.venue = venue
|
||||||
self.new_chat_member = kwargs.get('new_chat_member')
|
self.new_chat_member = new_chat_member
|
||||||
self.left_chat_member = kwargs.get('left_chat_member')
|
self.left_chat_member = left_chat_member
|
||||||
self.new_chat_title = kwargs.get('new_chat_title', '')
|
self.new_chat_title = new_chat_title
|
||||||
self.new_chat_photo = kwargs.get('new_chat_photo')
|
self.new_chat_photo = new_chat_photo
|
||||||
self.delete_chat_photo = bool(kwargs.get('delete_chat_photo', False))
|
self.delete_chat_photo = bool(delete_chat_photo)
|
||||||
self.group_chat_created = bool(kwargs.get('group_chat_created', False))
|
self.group_chat_created = bool(group_chat_created)
|
||||||
self.supergroup_chat_created = bool(kwargs.get('supergroup_chat_created', False))
|
self.supergroup_chat_created = bool(supergroup_chat_created)
|
||||||
self.migrate_to_chat_id = int(kwargs.get('migrate_to_chat_id', 0))
|
self.migrate_to_chat_id = int(migrate_to_chat_id)
|
||||||
self.migrate_from_chat_id = int(kwargs.get('migrate_from_chat_id', 0))
|
self.migrate_from_chat_id = int(migrate_from_chat_id)
|
||||||
self.channel_chat_created = bool(kwargs.get('channel_chat_created', False))
|
self.channel_chat_created = bool(channel_chat_created)
|
||||||
self.pinned_message = kwargs.get('pinned_message')
|
self.pinned_message = pinned_message
|
||||||
|
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,14 @@ class MessageEntity(TelegramObject):
|
||||||
user (Optional[:class:`telegram.User`]):
|
user (Optional[:class:`telegram.User`]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, type, offset, length, **kwargs):
|
def __init__(self, type, offset, length, url=None, user=None, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.type = type
|
self.type = type
|
||||||
self.offset = offset
|
self.offset = offset
|
||||||
self.length = length
|
self.length = length
|
||||||
# Optionals
|
# Optionals
|
||||||
self.url = kwargs.get('url')
|
self.url = url
|
||||||
self.user = kwargs.get('user')
|
self.user = user
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -40,13 +40,13 @@ class PhotoSize(TelegramObject):
|
||||||
file_size (Optional[int]):
|
file_size (Optional[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, file_id, width, height, **kwargs):
|
def __init__(self, file_id, width, height, file_size=0, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.file_id = str(file_id)
|
self.file_id = str(file_id)
|
||||||
self.width = int(width)
|
self.width = int(width)
|
||||||
self.height = int(height)
|
self.height = int(height)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
self.file_size = int(file_size)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if not isinstance(other, self.__class__):
|
if not isinstance(other, self.__class__):
|
||||||
|
|
|
@ -37,11 +37,11 @@ class ReplyKeyboardHide(ReplyMarkup):
|
||||||
selective (Optional[bool]):
|
selective (Optional[bool]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, hide_keyboard=True, **kwargs):
|
def __init__(self, hide_keyboard=True, selective=False, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.hide_keyboard = bool(hide_keyboard)
|
self.hide_keyboard = bool(hide_keyboard)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.selective = bool(kwargs.get('selective', False))
|
self.selective = bool(selective)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -41,13 +41,18 @@ class ReplyKeyboardMarkup(ReplyMarkup):
|
||||||
selective (Optional[bool]):
|
selective (Optional[bool]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, keyboard, **kwargs):
|
def __init__(self,
|
||||||
|
keyboard,
|
||||||
|
resize_keyboard=False,
|
||||||
|
one_time_keyboard=False,
|
||||||
|
selective=False,
|
||||||
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.keyboard = keyboard
|
self.keyboard = keyboard
|
||||||
# Optionals
|
# Optionals
|
||||||
self.resize_keyboard = bool(kwargs.get('resize_keyboard', False))
|
self.resize_keyboard = bool(resize_keyboard)
|
||||||
self.one_time_keyboard = bool(kwargs.get('one_time_keyboard', False))
|
self.one_time_keyboard = bool(one_time_keyboard)
|
||||||
self.selective = bool(kwargs.get('selective', False))
|
self.selective = bool(selective)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -44,15 +44,15 @@ class Sticker(TelegramObject):
|
||||||
file_size (Optional[int]):
|
file_size (Optional[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, file_id, width, height, **kwargs):
|
def __init__(self, file_id, width, height, thumb=None, emoji='', file_size=0, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.file_id = str(file_id)
|
self.file_id = str(file_id)
|
||||||
self.width = int(width)
|
self.width = int(width)
|
||||||
self.height = int(height)
|
self.height = int(height)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.thumb = kwargs.get('thumb')
|
self.thumb = thumb
|
||||||
self.emoji = kwargs.get('emoji', '')
|
self.emoji = emoji
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
self.file_size = int(file_size)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -44,15 +44,22 @@ class Update(TelegramObject):
|
||||||
callback_query (Optional[:class:`telegram.CallbackQuery`]):
|
callback_query (Optional[:class:`telegram.CallbackQuery`]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, update_id, **kwargs):
|
def __init__(self,
|
||||||
|
update_id,
|
||||||
|
message=None,
|
||||||
|
edited_message=None,
|
||||||
|
inline_query=None,
|
||||||
|
chosen_inline_result=None,
|
||||||
|
callback_query=None,
|
||||||
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.update_id = int(update_id)
|
self.update_id = int(update_id)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.message = kwargs.get('message')
|
self.message = message
|
||||||
self.edited_message = kwargs.get('edited_message')
|
self.edited_message = edited_message
|
||||||
self.inline_query = kwargs.get('inline_query')
|
self.inline_query = inline_query
|
||||||
self.chosen_inline_result = kwargs.get('chosen_inline_result')
|
self.chosen_inline_result = chosen_inline_result
|
||||||
self.callback_query = kwargs.get('callback_query')
|
self.callback_query = callback_query
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -44,14 +44,14 @@ class User(TelegramObject):
|
||||||
bot (Optional[Bot]): The Bot to use for instance methods
|
bot (Optional[Bot]): The Bot to use for instance methods
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, id, first_name, bot=None, **kwargs):
|
def __init__(self, id, first_name, type='', last_name='', username='', bot=None, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.id = int(id)
|
self.id = int(id)
|
||||||
self.first_name = first_name
|
self.first_name = first_name
|
||||||
# Optionals
|
# Optionals
|
||||||
self.type = kwargs.get('type', '')
|
self.type = type
|
||||||
self.last_name = kwargs.get('last_name', '')
|
self.last_name = last_name
|
||||||
self.username = kwargs.get('username', '')
|
self.username = username
|
||||||
|
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
|
@ -46,16 +46,24 @@ class Video(TelegramObject):
|
||||||
file_size (Optional[int]):
|
file_size (Optional[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, file_id, width, height, duration, **kwargs):
|
def __init__(self,
|
||||||
|
file_id,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
duration,
|
||||||
|
thumb=None,
|
||||||
|
mime_type='',
|
||||||
|
file_size=0,
|
||||||
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.file_id = str(file_id)
|
self.file_id = str(file_id)
|
||||||
self.width = int(width)
|
self.width = int(width)
|
||||||
self.height = int(height)
|
self.height = int(height)
|
||||||
self.duration = int(duration)
|
self.duration = int(duration)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.thumb = kwargs.get('thumb')
|
self.thumb = thumb
|
||||||
self.mime_type = str(kwargs.get('mime_type', ''))
|
self.mime_type = str(mime_type)
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
self.file_size = int(file_size)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
|
@ -32,21 +32,21 @@ class Voice(TelegramObject):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
file_id (str):
|
file_id (str):
|
||||||
|
duration (Optional[int]):
|
||||||
**kwargs: Arbitrary keyword arguments.
|
**kwargs: Arbitrary keyword arguments.
|
||||||
|
|
||||||
Keyword Args:
|
Keyword Args:
|
||||||
duration (Optional[int]):
|
|
||||||
mime_type (Optional[str]):
|
mime_type (Optional[str]):
|
||||||
file_size (Optional[int]):
|
file_size (Optional[int]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, file_id, **kwargs):
|
def __init__(self, file_id, duration, mime_type='', file_size=0, **kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.file_id = str(file_id)
|
self.file_id = str(file_id)
|
||||||
|
self.duration = int(duration)
|
||||||
# Optionals
|
# Optionals
|
||||||
self.duration = int(kwargs.get('duration', 0))
|
self.mime_type = str(mime_type)
|
||||||
self.mime_type = str(kwargs.get('mime_type', ''))
|
self.file_size = int(file_size)
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data, bot):
|
def de_json(data, bot):
|
||||||
|
|
Loading…
Reference in a new issue