1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Add MessageEntity.

This commit is contained in:
eternnoir 2016-04-14 10:51:05 +08:00
parent a2d91808ef
commit 2449a3ea64

View File

@ -246,6 +246,25 @@ class Message(JsonDeserializable):
setattr(self, key, options[key]) setattr(self, key, options[key])
class MessageEntity(JsonDeserializable):
@classmethod
def de_json(cls, json_string):
obj = cls.check_json(json_string)
type = obj['type']
offset = obj['offset']
length = obj['length']
url = None
if 'url' in obj:
url = obj['url']
return cls(type, offset, length, url)
def __init__(self, type, offset, length, url=None):
self.type = type
self.offset = offset
self.length = length
self.url = url
class PhotoSize(JsonDeserializable): class PhotoSize(JsonDeserializable):
@classmethod @classmethod
def de_json(cls, json_string): def de_json(cls, json_string):
@ -507,6 +526,8 @@ class ReplyKeyboardMarkup(JsonSerializable):
return json.dumps(json_dict) return json.dumps(json_dict)
# InlineQuery
class InlineQuery(JsonDeserializable): class InlineQuery(JsonDeserializable):
@classmethod @classmethod
def de_json(cls, json_type): def de_json(cls, json_type):