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

Update types.py

Added 'json' property to class 'Message', to quickly save a message to the database
This commit is contained in:
sviat9440 2018-03-21 07:35:42 +03:00 committed by GitHub
parent dadcd5a577
commit c11a9f810c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -369,7 +369,7 @@ class Message(JsonDeserializable):
if 'connected_website' in obj: if 'connected_website' in obj:
opts['connected_website'] = obj['connected_website'] opts['connected_website'] = obj['connected_website']
content_type = 'connected_website' content_type = 'connected_website'
return cls(message_id, from_user, date, chat, content_type, opts) return cls(message_id, from_user, date, chat, content_type, opts, json)
@classmethod @classmethod
def parse_chat(cls, chat): def parse_chat(cls, chat):
@ -436,6 +436,7 @@ class Message(JsonDeserializable):
self.connected_website = None self.connected_website = None
for key in options: for key in options:
setattr(self, key, options[key]) setattr(self, key, options[key])
self.json = json
class MessageEntity(JsonDeserializable): class MessageEntity(JsonDeserializable):