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

Fix Things on copyMessage

This commit is contained in:
Alireza
2021-01-12 11:17:53 +03:30
parent 58281f0a10
commit b684c4f60d
4 changed files with 52 additions and 8 deletions

View File

@ -261,6 +261,19 @@ class Chat(JsonDeserializable):
self.location = location
class MessageID(JsonDeserializable):
@classmethod
def de_json(cls, json_string):
if(json_string is None):
return None
obj = cls.check_json(json_string)
message_id = obj['message_id']
return cls(message_id)
def __init__(self, message_id):
self.message_id = message_id
class Message(JsonDeserializable):
@classmethod
def de_json(cls, json_string):
@ -548,7 +561,7 @@ class Message(JsonDeserializable):
return self.__html_text(self.caption, self.caption_entities)
class MessageEntity(JsonDeserializable):
class MessageEntity(Dictionaryable, JsonSerializable, JsonDeserializable):
@classmethod
def de_json(cls, json_string):
if (json_string is None): return None
@ -569,6 +582,17 @@ class MessageEntity(JsonDeserializable):
self.user = user
self.language = language
def to_json(self):
return json.dumps(self.to_dict())
def to_dict(self):
return {"type": self.type,
"offset": self.offset,
"length": self.length,
"url": self.url,
"user": self.user,
"language": self.language}
class Dice(JsonSerializable, Dictionaryable, JsonDeserializable):
@classmethod