diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 02cd1448..58015e46 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -19,6 +19,7 @@ class Message: in the original :tl:`Message`. """ def __init__(self, client, original, entities, input_chat): + self.__dict__['_init'] = False self.original_message = original self.stringify = self.original_message.stringify self.to_dict = self.original_message.to_dict @@ -42,6 +43,7 @@ class Message: elif fwd.channel_id: self._fwd_from_entity = entities.get(get_peer_id( types.PeerChannel(fwd.channel_id))) + self._init = True def __new__(cls, client, original, entities, input_chat): if isinstance(original, types.Message): @@ -55,7 +57,10 @@ class Message: return getattr(self.original_message, item) def __setattr__(self, name, value): - return setattr(self.original_message, name, value) + if not self._init or name in self.__dict__: + self.__dict__[name] = value + else: + setattr(self.original_message, name, value) def __str__(self): return str(self.original_message)