From 02afc0bc036980440aed0556d0246d9ba958455f Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 29 Jan 2018 21:31:10 +0200 Subject: [PATCH] Update metadata and fix small things --- README.md | 2 +- mautrix_telegram/portal.py | 4 +--- mautrix_telegram/user.py | 4 ++-- requirements.txt | 1 - setup.py | 19 ++++++++++++++++--- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index be8ec899..55dd1d5f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ A Telegram chat will be created once the bridge is stable enough. 1. Create with `virtualenv -p /usr/bin/python3.6 .venv` 2. Activate with `source .venv/bin/activate` 2. Install dependencies with `pip install -r requirements.txt` -3. Create a copy of `example-config.yaml` and fill out the fields. +3. Copy `example-config.yaml` to `config.yaml` and fill out the fields. 4. Generate the appservice registration with `python -m mautrix_telegram -g`. You can use the `-c` and `-r` flags to change the location of the config and registration files. They default to `config.yaml` and `registration.yaml` respectively. diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py index d94763bd..90dd3c17 100644 --- a/mautrix_telegram/portal.py +++ b/mautrix_telegram/portal.py @@ -261,9 +261,7 @@ class Portal: message = "/me " + message reply_to = None if len(entities) > 0 and isinstance(entities[0], formatter.MessageEntityReply): - reply = entities.pop(0) - # message = message[:reply.offset] + message[reply.offset + reply.length:] - reply_to = reply.msg_id + reply_to = entities.pop(0).msg_id response = sender.send_message(self.peer, message, entities=entities, reply_to=reply_to) else: diff --git a/mautrix_telegram/user.py b/mautrix_telegram/user.py index af614397..9a729852 100644 --- a/mautrix_telegram/user.py +++ b/mautrix_telegram/user.py @@ -40,8 +40,8 @@ class User: self.command_status = None self.connected = False self.client = None - whitelist = config.get("bridge", {}).get("whitelist", [self.mxid]) - self.whitelisted = self.mxid in whitelist + whitelist = config.get("bridge", {}).get("whitelist", None) or [self.mxid] + self.whitelisted = not whitelist or self.mxid in whitelist if not self.whitelisted: homeserver = self.mxid[self.mxid.index(":") + 1:] self.whitelisted = homeserver in whitelist diff --git a/requirements.txt b/requirements.txt index 1b0bc7a0..e938a66a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ aiohttp -e git+git://github.com/Cadair/matrix-python-sdk#egg=matrix_client -#matrix-client ruamel.yaml python-magic SQLAlchemy diff --git a/setup.py b/setup.py index 03299893..abffd047 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import setuptools setuptools.setup( - name="mautrix_telegram", + name="mautrix-telegram", version="0.1.0", url="https://github.com/tulir/mautrix-telegram", @@ -13,12 +13,25 @@ setuptools.setup( packages=setuptools.find_packages(), - install_requires=["telethon", "matrix-client", "sqlalchemy"], + install_requires=[ + "Telethon>=0.16.2.3,<0.17", + "git://github.com/Cadair/matrix-python-sdk@1fab9821d98d15769e44e66f714d00a32a48d692#egg=matrix_client", + "aiohttp>=2.3.9,<3", + "SQLAlchemy>=1.2.2,<2", + "Markdown>=2.6.11,<3", + "ruamel.yaml>=0.15.35,<0.16", + "Pillow>=5.0.0,<6", + "future-fstrings>=0.4.1", + "python-magic>=0.4.15,<0.5", + ], classifiers=[ - "Development Status :: 2 - Pre-Alpha", + "Development Status :: 4 Beta", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Topic :: Communications :: Chat", "Programming Language :: Python", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", ], entry_points="""