Skip to content

Commit fa6f16c

Browse files
committed
Add InlineQueryResultPhoto class.
1 parent a1267a7 commit fa6f16c

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

‎telebot/types.py‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,3 +593,46 @@ def to_json(self):
593593
if self.thumb_height:
594594
json_dict['thumb_height'] = self.thumb_height
595595
return json.dumps(json_dict)
596+
597+
598+
class InlineQueryResultPhoto(JsonSerializable):
599+
def __init__(self, id, photo_url, mime_type=None, photo_width=None, photo_height=None, thumb_url=None, title=None,
600+
description=None, caption=None, message_text=None, parse_mode=None, disable_web_page_preview=None):
601+
self.type = 'photo'
602+
self.id = id
603+
self.photo_url = photo_url
604+
self.mime_type = mime_type
605+
self.photo_width = photo_width
606+
self.photo_height = photo_height
607+
self.thumb_url = thumb_url
608+
self.title = title
609+
self.description = description
610+
self.caption = caption
611+
self.message_text = message_text
612+
self.parse_mode = parse_mode
613+
self.disable_web_page_preview = disable_web_page_preview
614+
615+
def to_json(self):
616+
json_dict = {'id': self.type, 'photo_url': self.photo_url}
617+
if self.mime_type:
618+
json_dict['mime_type'] = self.mime_type
619+
if self.photo_width:
620+
json_dict['photo_width'] = self.photo_width
621+
if self.photo_height:
622+
json_dict['photo_height'] = self.photo_height
623+
if self.thumb_url:
624+
json_dict['thumb_url'] = self.thumb_url
625+
if self.title:
626+
json_dict['title'] = self.title
627+
if self.description:
628+
json_dict['description'] = self.description
629+
if self.caption:
630+
json_dict['caption'] = self.caption
631+
if self.message_text:
632+
json_dict['message_text'] = self.message_text
633+
if self.parse_mode:
634+
json_dict['parse_mode'] = self.parse_mode
635+
if self.disable_web_page_preview:
636+
json_dict['disable_web_page_preview'] = self.disable_web_page_preview
637+
return json.dumps(json_dict)
638+

0 commit comments

Comments
 (0)