Merge branch 'bot-api-2.0' into dispatcher-rework

This commit is contained in:
Jannes Höke 2016-04-16 19:00:01 +02:00
commit f2a92ccf46
21 changed files with 92 additions and 73 deletions

View file

@ -45,6 +45,7 @@ from .emoji import Emoji
from .parsemode import ParseMode
from .message import Message
from .messageentity import MessageEntity
from .inputmessagecontent import InputMessageContent
from .callbackquery import CallbackQuery
from .choseninlineresult import ChosenInlineResult
from .inlinekeyboardbutton import InlineKeyboardButton
@ -70,7 +71,6 @@ from .inlinequeryresultphoto import InlineQueryResultPhoto
from .inlinequeryresultvenue import InlineQueryResultVenue
from .inlinequeryresultvideo import InlineQueryResultVideo
from .inlinequeryresultvoice import InlineQueryResultVoice
from .inputmessagecontent import InputMessageContent
from .inputtextmessagecontent import InputTextMessageContent
from .inputlocationmessagecontent import InputLocationMessageContent
from .inputvenuemessagecontent import InputVenueMessageContent

View file

@ -63,7 +63,8 @@ class InlineQueryResultArticle(InlineQueryResult):
description=None,
thumb_url=None,
thumb_width=None,
thumb_height=None):
thumb_height=None,
**kwargs):
# Required
super(InlineQueryResultArticle, self).__init__('article', id)

View file

@ -32,7 +32,8 @@ class InlineQueryResultAudio(InlineQueryResult):
performer=None,
audio_duration=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultAudio, self).__init__('audio', id)

View file

@ -29,7 +29,8 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
id,
audio_file_id,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedAudio, self).__init__('audio', id)
self.audio_file_id = audio_file_id

View file

@ -32,7 +32,8 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
description=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedDocument, self).__init__('document', id)
self.title = title

View file

@ -31,7 +31,8 @@ class InlineQueryResultCachedGif(InlineQueryResult):
title=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedGif, self).__init__('gif', id)
self.gif_file_id = gif_file_id

View file

@ -31,7 +31,8 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
title=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedMpeg4Gif, self).__init__('mpeg4_gif', id)
self.mpeg4_file_id = mpeg4_file_id

View file

@ -32,7 +32,8 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
description=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedPhoto, self).__init__('photo', id)
self.photo_file_id = photo_file_id

View file

@ -29,7 +29,8 @@ class InlineQueryResultCachedSticker(InlineQueryResult):
id,
sticker_file_id,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedSticker, self).__init__('sticker', id)
self.sticker_file_id = sticker_file_id

View file

@ -32,7 +32,8 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
description=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedVideo, self).__init__('video', id)
self.video_file_id = video_file_id

View file

@ -31,7 +31,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
title,
description=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultCachedVoice, self).__init__('voice', id)
self.voice_file_id = voice_file_id

View file

@ -34,7 +34,8 @@ class InlineQueryResultContact(InlineQueryResult):
input_message_content=None,
thumb_url=None,
thumb_width=None,
thumb_height=None):
thumb_height=None,
**kwargs):
# Required
super(InlineQueryResultContact, self).__init__('contact', id)
self.phone_number = phone_number

View file

@ -36,7 +36,8 @@ class InlineQueryResultDocument(InlineQueryResult):
input_message_content=None,
thumb_url=None,
thumb_width=None,
thumb_height=None):
thumb_height=None,
**kwargs):
# Required
super(InlineQueryResultDocument, self).__init__('document', id)
self.document_url = document_url

View file

@ -34,7 +34,8 @@ class InlineQueryResultGif(InlineQueryResult):
title=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultGif, self).__init__('gif', id)

View file

@ -34,7 +34,8 @@ class InlineQueryResultLocation(InlineQueryResult):
input_message_content=None,
thumb_url=None,
thumb_width=None,
thumb_height=None):
thumb_height=None,
**kwargs):
# Required
super(InlineQueryResultLocation, self).__init__('location', id)
self.latitude = latitude

View file

@ -34,7 +34,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
title=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultMpeg4Gif, self).__init__('mpeg4_gif', id)

View file

@ -35,7 +35,8 @@ class InlineQueryResultPhoto(InlineQueryResult):
description=None,
caption=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultPhoto, self).__init__('photo', id)
self.photo_url = photo_url

View file

@ -36,7 +36,8 @@ class InlineQueryResultVenue(InlineQueryResult):
input_message_content=None,
thumb_url=None,
thumb_width=None,
thumb_height=None):
thumb_height=None,
**kwargs):
# Required
super(InlineQueryResultVenue, self).__init__('venue', id)

View file

@ -37,7 +37,8 @@ class InlineQueryResultVideo(InlineQueryResult):
video_duration=None,
description=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultVideo, self).__init__('video', id)

View file

@ -31,7 +31,8 @@ class InlineQueryResultVoice(InlineQueryResult):
title,
voice_duration=None,
reply_markup=None,
input_message_content=None):
input_message_content=None,
**kwargs):
# Required
super(InlineQueryResultVoice, self).__init__('voice', id)

View file

@ -40,9 +40,9 @@ class InlineQueryResultArticleTest(BaseTest, unittest.TestCase):
self.id = 'id'
self.type = 'article'
self.title = 'title'
self.message_text = 'message text'
self.parse_mode = 'HTML'
self.disable_web_page_preview = True
#self.message_text = 'message text'
#self.parse_mode = 'HTML'
#self.disable_web_page_preview = True
self.url = 'url'
self.hide_url = True
self.description = 'description'
@ -54,9 +54,9 @@ class InlineQueryResultArticleTest(BaseTest, unittest.TestCase):
'type': self.type,
'id': self.id,
'title': self.title,
'message_text': self.message_text,
'parse_mode': self.parse_mode,
'disable_web_page_preview': self.disable_web_page_preview,
#'message_text': self.message_text,
#'parse_mode': self.parse_mode,
##'disable_web_page_preview': self.disable_web_page_preview,
'url': self.url,
'hide_url': self.hide_url,
'description': self.description,
@ -71,10 +71,10 @@ class InlineQueryResultArticleTest(BaseTest, unittest.TestCase):
self.assertEqual(article.type, self.type)
self.assertEqual(article.id, self.id)
self.assertEqual(article.title, self.title)
self.assertEqual(article.message_text, self.message_text)
self.assertEqual(article.parse_mode, self.parse_mode)
self.assertEqual(article.disable_web_page_preview,
self.disable_web_page_preview)
#self.assertEqual(article.message_text, self.message_text)
#self.assertEqual(article.parse_mode, self.parse_mode)
#self.assertEqual(article.disable_web_page_preview,
# self.disable_web_page_preview)
self.assertEqual(article.url, self.url)
self.assertEqual(article.hide_url, self.hide_url)
self.assertEqual(article.description, self.description)
@ -102,29 +102,29 @@ class InlineQueryResultPhotoTest(BaseTest, unittest.TestCase):
self.id = 'id'
self.type = 'photo'
self.photo_url = 'photo url'
self.mime_type = 'mime type'
#self.mime_type = 'mime type'
self.photo_width = 10
self.photo_height = 15
self.thumb_url = 'thumb url'
self.title = 'title'
self.caption = 'caption'
self.message_text = 'message text'
self.parse_mode = 'parse mode'
self.disable_web_page_preview = True
#self.message_text = 'message text'
#self.parse_mode = 'parse mode'
#self.disable_web_page_preview = True
self.json_dict = {
'type': self.type,
'id': self.id,
'photo_url': self.photo_url,
'mime_type': self.mime_type,
#'mime_type': self.mime_type,
'photo_width': self.photo_width,
'photo_height': self.photo_height,
'thumb_url': self.thumb_url,
'title': self.title,
'caption': self.caption,
'message_text': self.message_text,
'parse_mode': self.parse_mode,
'disable_web_page_preview': self.disable_web_page_preview
#'message_text': self.message_text,
#'parse_mode': self.parse_mode,
#'disable_web_page_preview': self.disable_web_page_preview
}
def test_photo_de_json(self):
@ -133,16 +133,16 @@ class InlineQueryResultPhotoTest(BaseTest, unittest.TestCase):
self.assertEqual(photo.type, self.type)
self.assertEqual(photo.id, self.id)
self.assertEqual(photo.photo_url, self.photo_url)
self.assertEqual(photo.mime_type, self.mime_type)
#self.assertEqual(photo.mime_type, self.mime_type)
self.assertEqual(photo.photo_width, self.photo_width)
self.assertEqual(photo.photo_height, self.photo_height)
self.assertEqual(photo.thumb_url, self.thumb_url)
self.assertEqual(photo.title, self.title)
self.assertEqual(photo.caption, self.caption)
self.assertEqual(photo.message_text, self.message_text)
self.assertEqual(photo.parse_mode, self.parse_mode)
self.assertEqual(photo.disable_web_page_preview,
self.disable_web_page_preview)
#self.assertEqual(photo.message_text, self.message_text)
#self.assertEqual(photo.parse_mode, self.parse_mode)
#self.assertEqual(photo.disable_web_page_preview,
# self.disable_web_page_preview)
def test_photo_to_json(self):
photo = telegram.InlineQueryResultPhoto.de_json(self.json_dict)
@ -169,9 +169,9 @@ class InlineQueryResultGifTest(BaseTest, unittest.TestCase):
self.thumb_url = 'thumb url'
self.title = 'title'
self.caption = 'caption'
self.message_text = 'message text'
self.parse_mode = 'parse mode'
self.disable_web_page_preview = True
#self.message_text = 'message text'
#self.parse_mode = 'parse mode'
#self.disable_web_page_preview = True
self.json_dict = {
'type': self.type,
@ -182,9 +182,9 @@ class InlineQueryResultGifTest(BaseTest, unittest.TestCase):
'thumb_url': self.thumb_url,
'title': self.title,
'caption': self.caption,
'message_text': self.message_text,
'parse_mode': self.parse_mode,
'disable_web_page_preview': self.disable_web_page_preview
#'message_text': self.message_text,
#'parse_mode': self.parse_mode,
#'disable_web_page_preview': self.disable_web_page_preview
}
def test_gif_de_json(self):
@ -198,10 +198,10 @@ class InlineQueryResultGifTest(BaseTest, unittest.TestCase):
self.assertEqual(gif.thumb_url, self.thumb_url)
self.assertEqual(gif.title, self.title)
self.assertEqual(gif.caption, self.caption)
self.assertEqual(gif.message_text, self.message_text)
self.assertEqual(gif.parse_mode, self.parse_mode)
self.assertEqual(gif.disable_web_page_preview,
self.disable_web_page_preview)
#self.assertEqual(gif.message_text, self.message_text)
#self.assertEqual(gif.parse_mode, self.parse_mode)
#self.assertEqual(gif.disable_web_page_preview,
# self.disable_web_page_preview)
def test_gif_to_json(self):
gif = telegram.InlineQueryResultGif.de_json(self.json_dict)
@ -227,9 +227,9 @@ class InlineQueryResultMpeg4GifTest(BaseTest, unittest.TestCase):
self.thumb_url = 'thumb url'
self.title = 'title'
self.caption = 'caption'
self.message_text = 'message text'
self.parse_mode = 'parse mode'
self.disable_web_page_preview = True
#self.message_text = 'message text'
#self.parse_mode = 'parse mode'
#self.disable_web_page_preview = True
self.json_dict = {
'type': self.type,
@ -240,9 +240,9 @@ class InlineQueryResultMpeg4GifTest(BaseTest, unittest.TestCase):
'thumb_url': self.thumb_url,
'title': self.title,
'caption': self.caption,
'message_text': self.message_text,
'parse_mode': self.parse_mode,
'disable_web_page_preview': self.disable_web_page_preview
#'message_text': self.message_text,
#'parse_mode': self.parse_mode,
#'disable_web_page_preview': self.disable_web_page_preview
}
def test_mpeg4_de_json(self):
@ -256,10 +256,10 @@ class InlineQueryResultMpeg4GifTest(BaseTest, unittest.TestCase):
self.assertEqual(mpeg4.thumb_url, self.thumb_url)
self.assertEqual(mpeg4.title, self.title)
self.assertEqual(mpeg4.caption, self.caption)
self.assertEqual(mpeg4.message_text, self.message_text)
self.assertEqual(mpeg4.parse_mode, self.parse_mode)
self.assertEqual(mpeg4.disable_web_page_preview,
self.disable_web_page_preview)
#self.assertEqual(mpeg4.message_text, self.message_text)
#self.assertEqual(mpeg4.parse_mode, self.parse_mode)
#self.assertEqual(mpeg4.disable_web_page_preview,
# self.disable_web_page_preview)
def test_mpeg4_to_json(self):
mpeg4 = telegram.InlineQueryResultMpeg4Gif.de_json(self.json_dict)
@ -289,9 +289,9 @@ class InlineQueryResultVideoTest(BaseTest, unittest.TestCase):
self.title = 'title'
self.caption = 'caption'
self.description = 'description'
self.message_text = 'message text'
self.parse_mode = 'parse mode'
self.disable_web_page_preview = True
#self.message_text = 'message text'
#self.parse_mode = 'parse mode'
#self.disable_web_page_preview = True
self.json_dict = {
'type': self.type,
@ -305,9 +305,9 @@ class InlineQueryResultVideoTest(BaseTest, unittest.TestCase):
'title': self.title,
'caption': self.caption,
'description': self.description,
'message_text': self.message_text,
'parse_mode': self.parse_mode,
'disable_web_page_preview': self.disable_web_page_preview
#'message_text': self.message_text,
#'parse_mode': self.parse_mode,
#'disable_web_page_preview': self.disable_web_page_preview
}
def test_video_de_json(self):
@ -324,10 +324,10 @@ class InlineQueryResultVideoTest(BaseTest, unittest.TestCase):
self.assertEqual(video.title, self.title)
self.assertEqual(video.description, self.description)
self.assertEqual(video.caption, self.caption)
self.assertEqual(video.message_text, self.message_text)
self.assertEqual(video.parse_mode, self.parse_mode)
self.assertEqual(video.disable_web_page_preview,
self.disable_web_page_preview)
#self.assertEqual(video.message_text, self.message_text)
#self.assertEqual(video.parse_mode, self.parse_mode)
#self.assertEqual(video.disable_web_page_preview,
# self.disable_web_page_preview)
def test_video_to_json(self):
video = telegram.InlineQueryResultVideo.de_json(self.json_dict)