Attempt to load and save MessageBox state

This commit is contained in:
Lonami Exo
2022-05-13 17:40:03 +02:00
parent 053a0052c8
commit a5c3df2743
7 changed files with 60 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
from typing import Optional, Tuple
from enum import IntEnum
from ..tl.types import InputPeerUser, InputPeerChat, InputPeerChannel
class SessionState:
@@ -175,3 +176,11 @@ class Entity:
def __bytes__(self):
return struct.pack('<Bqq', self.ty, self.id, self.hash)
def _as_input_peer(self):
if self.is_user:
return InputPeerUser(self.id, self.hash)
elif self.ty == EntityType.GROUP:
return InputPeerChat(self.id)
else:
return InputPeerChannel(self.id, self.hash)