Move more things to use telethon methods

This commit is contained in:
Tulir Asokan
2019-08-06 01:46:22 +03:00
parent 8536bdd614
commit 6852bae7f9
2 changed files with 22 additions and 38 deletions
+5 -1
View File
@@ -112,6 +112,10 @@ class Puppet(CustomPuppetMixin):
def tgid(self) -> TelegramID:
return self.id
@property
def peer(self) -> PeerUser:
return PeerUser(user_id=self.tgid)
@staticmethod
async def is_logged_in() -> bool:
""" Is True if the puppet is logged in. """
@@ -127,7 +131,7 @@ class Puppet(CustomPuppetMixin):
def get_input_entity(self, user: 'AbstractUser'
) -> Awaitable[Union[TypeInputPeer, TypeInputUser]]:
return user.client.get_input_entity(PeerUser(user_id=self.tgid))
return user.client.get_input_entity(self.peer)
# region DB conversion