Split portal.py and migrate more stuff to mautrix-0.4

This commit is contained in:
Tulir Asokan
2019-08-05 00:11:15 +03:00
parent 32d686e908
commit d6a2e7a9f7
23 changed files with 2470 additions and 2265 deletions
+3 -3
View File
@@ -17,10 +17,9 @@ from typing import Awaitable, Any, Dict, Iterable, Optional, Union, TYPE_CHECKIN
from difflib import SequenceMatcher
import asyncio
import logging
import re
from telethon.tl.types import (UserProfilePhoto, User, UpdateUserName, PeerUser, TypeInputPeer,
InputPeerPhotoFileLocation, UserProfilePhotoEmpty)
InputPeerPhotoFileLocation, UserProfilePhotoEmpty, TypeInputUser)
from mautrix.appservice import AppService, IntentAPI
from mautrix.errors import MatrixRequestError
@@ -126,7 +125,8 @@ class Puppet(CustomPuppetMixin):
return self.displayname[len(prefix):-len(suffix)]
return self.displayname
def get_input_entity(self, user: 'AbstractUser') -> Awaitable[TypeInputPeer]:
def get_input_entity(self, user: 'AbstractUser'
) -> Awaitable[Union[TypeInputPeer, TypeInputUser]]:
return user.client.get_input_entity(PeerUser(user_id=self.tgid))
# region DB conversion