Bridge group chat portal metadata from Matrix to Telegram. Fixes #33

WARNING: Portal table schema changed. Run the following SQL before updating:
    ALTER TABLE portal ADD COLUMN about VARCHAR
This commit is contained in:
Tulir Asokan
2018-02-03 16:15:37 +02:00
parent 1bc246af37
commit f49f71ce8d
7 changed files with 154 additions and 48 deletions
+4 -1
View File
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
from telethon.tl.types import UserProfilePhoto
from telethon.tl.types import UserProfilePhoto, PeerUser
from telethon.errors.rpc_error_list import LocationInvalidError
from .db import Puppet as DBPuppet
@@ -47,6 +47,9 @@ class Puppet:
def tgid(self):
return self.id
def get_input_entity(self, user):
return user.client.get_input_entity(PeerUser(user_id=self.tgid))
def to_db(self):
return self.db.merge(
DBPuppet(id=self.id, username=self.username, displayname=self.displayname,