diff --git a/mautrix_telegram/__main__.py b/mautrix_telegram/__main__.py
index 8e981c41..2c5ce1ff 100644
--- a/mautrix_telegram/__main__.py
+++ b/mautrix_telegram/__main__.py
@@ -22,7 +22,7 @@ import asyncio
import sqlalchemy as sql
from sqlalchemy import orm
-from telethon.sessions import AlchemySessionContainer
+from telethon_aio.sessions import AlchemySessionContainer
from mautrix_appservice import AppService
from .base import Base
@@ -66,7 +66,7 @@ if args.generate_registration:
sys.exit(0)
if config["appservice.debug"]:
- telethon_log = logging.getLogger("telethon")
+ telethon_log = logging.getLogger("telethon_aio")
telethon_log.addHandler(handler)
telethon_log.setLevel(logging.DEBUG)
log.setLevel(logging.DEBUG)
diff --git a/mautrix_telegram/abstract_user.py b/mautrix_telegram/abstract_user.py
index b8dc492c..0fe33d2c 100644
--- a/mautrix_telegram/abstract_user.py
+++ b/mautrix_telegram/abstract_user.py
@@ -17,7 +17,7 @@
import platform
import os
-from telethon.tl.types import *
+from telethon_aio.tl.types import *
from mautrix_appservice import MatrixRequestError
from .tgclient import MautrixTelegramClient
diff --git a/mautrix_telegram/bot.py b/mautrix_telegram/bot.py
index 1e456ff7..a92455c3 100644
--- a/mautrix_telegram/bot.py
+++ b/mautrix_telegram/bot.py
@@ -17,10 +17,10 @@
import logging
import re
-from telethon.tl.types import *
-from telethon.tl.functions.messages import GetChatsRequest
-from telethon.tl.functions.channels import GetChannelsRequest
-from telethon.errors import ChannelInvalidError, ChannelPrivateError
+from telethon_aio.tl.types import *
+from telethon_aio.tl.functions.messages import GetChatsRequest
+from telethon_aio.tl.functions.channels import GetChannelsRequest
+from telethon_aio.errors import ChannelInvalidError, ChannelPrivateError
from .abstract_user import AbstractUser
from .db import BotChat
diff --git a/mautrix_telegram/commands/auth.py b/mautrix_telegram/commands/auth.py
index 260bdafb..60ce69d4 100644
--- a/mautrix_telegram/commands/auth.py
+++ b/mautrix_telegram/commands/auth.py
@@ -16,7 +16,7 @@
# along with this program. If not, see .
import asyncio
-from telethon.errors import *
+from telethon_aio.errors import *
from . import command_handler
from .. import puppet as pu
diff --git a/mautrix_telegram/commands/handler.py b/mautrix_telegram/commands/handler.py
index e3350fbf..fbbbfadc 100644
--- a/mautrix_telegram/commands/handler.py
+++ b/mautrix_telegram/commands/handler.py
@@ -17,7 +17,7 @@
import markdown
import logging
-from telethon.errors import FloodWaitError
+from telethon_aio.errors import FloodWaitError
from ..util import format_duration
diff --git a/mautrix_telegram/commands/portal.py b/mautrix_telegram/commands/portal.py
index c3e9340f..ffb4bcc2 100644
--- a/mautrix_telegram/commands/portal.py
+++ b/mautrix_telegram/commands/portal.py
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from telethon.errors import *
+from telethon_aio.errors import *
from mautrix_appservice import MatrixRequestError
from .. import portal as po
diff --git a/mautrix_telegram/commands/telegram.py b/mautrix_telegram/commands/telegram.py
index 21b3f6fc..7be428e0 100644
--- a/mautrix_telegram/commands/telegram.py
+++ b/mautrix_telegram/commands/telegram.py
@@ -14,10 +14,10 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from telethon.errors import *
-from telethon.tl.types import User as TLUser
-from telethon.tl.functions.messages import ImportChatInviteRequest, CheckChatInviteRequest
-from telethon.tl.functions.channels import JoinChannelRequest
+from telethon_aio.errors import *
+from telethon_aio.tl.types import User as TLUser
+from telethon_aio.tl.functions.messages import ImportChatInviteRequest, CheckChatInviteRequest
+from telethon_aio.tl.functions.channels import JoinChannelRequest
from .. import puppet as pu, portal as po
from . import command_handler
diff --git a/mautrix_telegram/formatter/from_matrix.py b/mautrix_telegram/formatter/from_matrix.py
index f6a9a5e5..c74ac1ae 100644
--- a/mautrix_telegram/formatter/from_matrix.py
+++ b/mautrix_telegram/formatter/from_matrix.py
@@ -21,7 +21,7 @@ import math
import re
import logging
-from telethon.tl.types import *
+from telethon_aio.tl.types import *
from .. import user as u, puppet as pu, portal as po
from ..db import Message as DBMessage
diff --git a/mautrix_telegram/formatter/from_telegram.py b/mautrix_telegram/formatter/from_telegram.py
index 80519ab8..82b38c10 100644
--- a/mautrix_telegram/formatter/from_telegram.py
+++ b/mautrix_telegram/formatter/from_telegram.py
@@ -17,7 +17,7 @@
from html import escape
import logging
-from telethon.tl.types import *
+from telethon_aio.tl.types import *
from mautrix_appservice import MatrixRequestError
from .. import user as u, puppet as pu, portal as po
diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py
index a7230166..108b3069 100644
--- a/mautrix_telegram/portal.py
+++ b/mautrix_telegram/portal.py
@@ -25,10 +25,10 @@ import re
import magic
-from telethon.tl.functions.messages import *
-from telethon.tl.functions.channels import *
-from telethon.errors.rpc_error_list import *
-from telethon.tl.types import *
+from telethon_aio.tl.functions.messages import *
+from telethon_aio.tl.functions.channels import *
+from telethon_aio.errors.rpc_error_list import *
+from telethon_aio.tl.types import *
from mautrix_appservice import MatrixRequestError, IntentError
from .db import Portal as DBPortal, Message as DBMessage
diff --git a/mautrix_telegram/public/__init__.py b/mautrix_telegram/public/__init__.py
index c8817815..3f57e369 100644
--- a/mautrix_telegram/public/__init__.py
+++ b/mautrix_telegram/public/__init__.py
@@ -20,7 +20,7 @@ import asyncio
import pkg_resources
import logging
-from telethon.errors import *
+from telethon_aio.errors import *
from ..user import User
from ..commands.auth import enter_password
diff --git a/mautrix_telegram/puppet.py b/mautrix_telegram/puppet.py
index f01238ef..4340498a 100644
--- a/mautrix_telegram/puppet.py
+++ b/mautrix_telegram/puppet.py
@@ -18,8 +18,8 @@ from difflib import SequenceMatcher
import re
import logging
-from telethon.tl.types import UserProfilePhoto
-from telethon.errors.rpc_error_list import LocationInvalidError
+from telethon_aio.tl.types import UserProfilePhoto
+from telethon_aio.errors.rpc_error_list import LocationInvalidError
from .db import Puppet as DBPuppet
from . import util
diff --git a/mautrix_telegram/tgclient.py b/mautrix_telegram/tgclient.py
index 171007b3..d70511a7 100644
--- a/mautrix_telegram/tgclient.py
+++ b/mautrix_telegram/tgclient.py
@@ -16,10 +16,10 @@
# along with this program. If not, see .
from io import BytesIO
-from telethon import TelegramClient
-from telethon.tl.functions.messages import SendMessageRequest, SendMediaRequest
-from telethon.tl.types import *
-from telethon.extensions.markdown import parse as parse_md
+from telethon_aio import TelegramClient
+from telethon_aio.tl.functions.messages import SendMessageRequest, SendMediaRequest
+from telethon_aio.tl.types import *
+from telethon_aio.extensions.markdown import parse as parse_md
class MautrixTelegramClient(TelegramClient):
diff --git a/mautrix_telegram/user.py b/mautrix_telegram/user.py
index 90c9c149..26f1d79e 100644
--- a/mautrix_telegram/user.py
+++ b/mautrix_telegram/user.py
@@ -18,9 +18,9 @@ import logging
import asyncio
import re
-from telethon.tl.types import *
-from telethon.tl.types.contacts import ContactsNotModified
-from telethon.tl.functions.contacts import GetContactsRequest, SearchRequest
+from telethon_aio.tl.types import *
+from telethon_aio.tl.types.contacts import ContactsNotModified
+from telethon_aio.tl.functions.contacts import GetContactsRequest, SearchRequest
from mautrix_appservice import MatrixRequestError
from .db import User as DBUser, Contact as DBContact
diff --git a/mautrix_telegram/util/file_transfer.py b/mautrix_telegram/util/file_transfer.py
index 4c4a2f87..8c56113d 100644
--- a/mautrix_telegram/util/file_transfer.py
+++ b/mautrix_telegram/util/file_transfer.py
@@ -22,9 +22,9 @@ import magic
from PIL import Image
from sqlalchemy.exc import IntegrityError
-from telethon.tl.types import (Document, FileLocation, InputFileLocation,
+from telethon_aio.tl.types import (Document, FileLocation, InputFileLocation,
InputDocumentFileLocation)
-from telethon.errors import LocationInvalidError
+from telethon_aio.errors import LocationInvalidError
from ..db import TelegramFile as DBTelegramFile
diff --git a/requirements/3.5.txt b/requirements/3.5.txt
index aefb3d6a..5d2171b8 100644
--- a/requirements/3.5.txt
+++ b/requirements/3.5.txt
@@ -1,2 +1,2 @@
-r base.txt
-git+https://github.com/tulir/telethon-asyncio@asyncio-3.5#egg=Telethon
+git+https://github.com/tulir/telethon-asyncio@asyncio-3.5#egg=telethon_aio
diff --git a/requirements/default.txt b/requirements/default.txt
index 287924c4..7eb92737 100644
--- a/requirements/default.txt
+++ b/requirements/default.txt
@@ -1,2 +1,2 @@
-r base.txt
-git+https://github.com/tulir/telethon-asyncio@asyncio#egg=Telethon
+telethon-aio
diff --git a/setup.py b/setup.py
index 404b2153..dbc732ed 100644
--- a/setup.py
+++ b/setup.py
@@ -26,12 +26,10 @@ setuptools.setup(
"future-fstrings>=0.4.2",
"python-magic>=0.4.15,<0.5",
"cryptg>=0.1,<0.2",
- "telethon-asyncio-git",
+ "telethon-aio>=0.18,<0.19" if sys.version_info >= (3, 6) else "telethon-aio-git",
],
dependency_links=[
- ("https://github.com/tulir/telethon-asyncio/tarball/cd2226c4a0c293f039b865565933c6f3dce25247#egg=telethon-asyncio-git-0.17.4+2"
- if sys.version_info >= (3, 6)
- else "https://github.com/tulir/telethon-asyncio/tarball/fabaadb3159d22c3f4a77c8ea280e7dc1aa7b723#egg=telethon-asyncio-git-0.17.4+2")
+ "https://github.com/tulir/telethon-asyncio/tarball/9b389cfb4b6d3876e9661c23507f17e96897e4b0#egg=telethon-aio-git-0.18.0+1"
],
classifiers=[
@@ -56,3 +54,4 @@ setuptools.setup(
("alembic/versions", glob.glob("alembic/versions/*.py"))
],
)
+