Fix Telethon 0.18.1 compatibility. Fixes #96
This commit is contained in:
@@ -22,7 +22,7 @@ import asyncio
|
||||
import sqlalchemy as sql
|
||||
from sqlalchemy import orm
|
||||
|
||||
from telethon_aio.sessions import AlchemySessionContainer
|
||||
from alchemysession import AlchemySessionContainer
|
||||
from mautrix_appservice import AppService
|
||||
|
||||
from .base import Base
|
||||
@@ -70,7 +70,7 @@ if args.generate_registration:
|
||||
sys.exit(0)
|
||||
|
||||
if config["appservice.debug"]:
|
||||
telethon_log = logging.getLogger("telethon_aio")
|
||||
telethon_log = logging.getLogger("telethon")
|
||||
telethon_log.addHandler(handler)
|
||||
telethon_log.setLevel(logging.DEBUG)
|
||||
log.setLevel(logging.DEBUG)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import platform
|
||||
import os
|
||||
|
||||
from telethon_aio.tl.types import *
|
||||
from telethon.tl.types import *
|
||||
from mautrix_appservice import MatrixRequestError
|
||||
|
||||
from .tgclient import MautrixTelegramClient
|
||||
|
||||
@@ -18,10 +18,10 @@ from typing import Awaitable, Callable
|
||||
import logging
|
||||
import re
|
||||
|
||||
from telethon_aio.tl.types import *
|
||||
from telethon_aio.tl.functions.messages import GetChatsRequest, GetFullChatRequest
|
||||
from telethon_aio.tl.functions.channels import GetChannelsRequest, GetParticipantRequest
|
||||
from telethon_aio.errors import ChannelInvalidError, ChannelPrivateError
|
||||
from telethon.tl.types import *
|
||||
from telethon.tl.functions.messages import GetChatsRequest, GetFullChatRequest
|
||||
from telethon.tl.functions.channels import GetChannelsRequest, GetParticipantRequest
|
||||
from telethon.errors import ChannelInvalidError, ChannelPrivateError
|
||||
|
||||
from .abstract_user import AbstractUser
|
||||
from .db import BotChat
|
||||
@@ -29,7 +29,6 @@ from . import puppet as pu, portal as po, user as u
|
||||
|
||||
config = None
|
||||
|
||||
|
||||
ReplyFunc = Callable[[str], Awaitable[Message]]
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import asyncio
|
||||
|
||||
from telethon_aio.errors import *
|
||||
from telethon.errors import *
|
||||
|
||||
from . import command_handler
|
||||
from .. import puppet as pu
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import markdown
|
||||
import logging
|
||||
|
||||
from telethon_aio.errors import FloodWaitError
|
||||
from telethon.errors import FloodWaitError
|
||||
|
||||
from ..util import format_duration
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import asyncio
|
||||
|
||||
from telethon_aio.errors import *
|
||||
from telethon.errors import *
|
||||
from mautrix_appservice import MatrixRequestError
|
||||
|
||||
from .. import portal as po
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
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 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 .. import puppet as pu, portal as po
|
||||
from . import command_handler
|
||||
|
||||
@@ -22,20 +22,12 @@ import math
|
||||
import re
|
||||
import logging
|
||||
|
||||
from telethon_aio.tl.types import (MessageEntityMention,
|
||||
InputMessageEntityMentionName, MessageEntityEmail,
|
||||
MessageEntityUrl, MessageEntityTextUrl, MessageEntityBold,
|
||||
MessageEntityItalic, MessageEntityCode, MessageEntityPre,
|
||||
MessageEntityBotCommand, MessageEntityHashtag,
|
||||
MessageEntityMentionName, InputUser)
|
||||
|
||||
try:
|
||||
from telethon_aio.tl.types import TypeMessageEntity
|
||||
except ImportError:
|
||||
TypeMessageEntity = Union[
|
||||
MessageEntityMention, MessageEntityHashtag, MessageEntityBotCommand, MessageEntityUrl,
|
||||
MessageEntityEmail, MessageEntityBold, MessageEntityItalic, MessageEntityCode,
|
||||
MessageEntityPre, MessageEntityTextUrl, MessageEntityMentionName]
|
||||
from telethon.tl.types import (MessageEntityMention,
|
||||
InputMessageEntityMentionName, MessageEntityEmail,
|
||||
MessageEntityUrl, MessageEntityTextUrl, MessageEntityBold,
|
||||
MessageEntityItalic, MessageEntityCode, MessageEntityPre,
|
||||
MessageEntityBotCommand, MessageEntityHashtag,
|
||||
MessageEntityMentionName, InputUser, TypeMessageEntity)
|
||||
|
||||
from ..context import Context
|
||||
from .. import user as u, puppet as pu, portal as po
|
||||
|
||||
@@ -24,19 +24,11 @@ except ImportError:
|
||||
import logging
|
||||
import re
|
||||
|
||||
from telethon_aio.tl.types import (MessageEntityMention, MessageEntityMentionName,
|
||||
MessageEntityEmail, MessageEntityUrl, MessageEntityTextUrl,
|
||||
MessageEntityBold, MessageEntityItalic, MessageEntityCode,
|
||||
MessageEntityPre, MessageEntityBotCommand, Message, PeerChannel,
|
||||
MessageEntityHashtag)
|
||||
|
||||
try:
|
||||
from telethon_aio.tl.types import TypeMessageEntity
|
||||
except ImportError:
|
||||
TypeMessageEntity = Union[
|
||||
MessageEntityMention, MessageEntityHashtag, MessageEntityBotCommand, MessageEntityUrl,
|
||||
MessageEntityEmail, MessageEntityBold, MessageEntityItalic, MessageEntityCode,
|
||||
MessageEntityPre, MessageEntityTextUrl, MessageEntityMentionName]
|
||||
from telethon.tl.types import (MessageEntityMention, MessageEntityMentionName,
|
||||
MessageEntityEmail, MessageEntityUrl, MessageEntityTextUrl,
|
||||
MessageEntityBold, MessageEntityItalic, MessageEntityCode,
|
||||
MessageEntityPre, MessageEntityBotCommand, Message, PeerChannel,
|
||||
MessageEntityHashtag, TypeMessageEntity)
|
||||
|
||||
from mautrix_appservice import MatrixRequestError
|
||||
from mautrix_appservice.intent_api import IntentAPI
|
||||
|
||||
@@ -25,10 +25,10 @@ import re
|
||||
|
||||
import magic
|
||||
|
||||
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 telethon.tl.functions.messages import *
|
||||
from telethon.tl.functions.channels import *
|
||||
from telethon.errors.rpc_error_list import *
|
||||
from telethon.tl.types import *
|
||||
from mautrix_appservice import MatrixRequestError, IntentError
|
||||
|
||||
from .db import Portal as DBPortal, Message as DBMessage
|
||||
|
||||
@@ -20,7 +20,7 @@ import asyncio
|
||||
import pkg_resources
|
||||
import logging
|
||||
|
||||
from telethon_aio.errors import *
|
||||
from telethon.errors import *
|
||||
|
||||
from ..user import User
|
||||
from ..commands.auth import enter_password
|
||||
|
||||
@@ -18,8 +18,8 @@ from difflib import SequenceMatcher
|
||||
import re
|
||||
import logging
|
||||
|
||||
from telethon_aio.tl.types import UserProfilePhoto
|
||||
from telethon_aio.errors.rpc_error_list import LocationInvalidError
|
||||
from telethon.tl.types import UserProfilePhoto
|
||||
from telethon.errors.rpc_error_list import LocationInvalidError
|
||||
|
||||
from .db import Puppet as DBPuppet
|
||||
from . import util
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from io import BytesIO
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
class MautrixTelegramClient(TelegramClient):
|
||||
|
||||
@@ -18,9 +18,9 @@ import logging
|
||||
import asyncio
|
||||
import re
|
||||
|
||||
from telethon_aio.tl.types import *
|
||||
from telethon_aio.tl.types.contacts import ContactsNotModified
|
||||
from telethon_aio.tl.functions.contacts import GetContactsRequest, SearchRequest
|
||||
from telethon.tl.types import *
|
||||
from telethon.tl.types.contacts import ContactsNotModified
|
||||
from telethon.tl.functions.contacts import GetContactsRequest, SearchRequest
|
||||
from mautrix_appservice import MatrixRequestError
|
||||
|
||||
from .db import User as DBUser, Contact as DBContact
|
||||
|
||||
@@ -21,6 +21,7 @@ import logging
|
||||
import magic
|
||||
from sqlalchemy.exc import IntegrityError, InvalidRequestError
|
||||
from sqlalchemy.orm.exc import FlushError
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
except ImportError:
|
||||
@@ -34,9 +35,9 @@ try:
|
||||
except ImportError:
|
||||
VideoFileClip = random = string = os = mimetypes = None
|
||||
|
||||
from telethon_aio.tl.types import (Document, FileLocation, InputFileLocation,
|
||||
InputDocumentFileLocation, PhotoSize, PhotoCachedSize)
|
||||
from telethon_aio.errors import LocationInvalidError
|
||||
from telethon.tl.types import (Document, FileLocation, InputFileLocation,
|
||||
InputDocumentFileLocation, PhotoSize, PhotoCachedSize)
|
||||
from telethon.errors import LocationInvalidError
|
||||
|
||||
from ..db import TelegramFile as DBTelegramFile
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
-r base.txt
|
||||
git+https://github.com/tulir/telethon-asyncio@asyncio-3.5#egg=telethon_aio
|
||||
git+https://github.com/tulir/telethon-asyncio@asyncio-3.5#egg=telethon
|
||||
|
||||
@@ -6,3 +6,4 @@ SQLAlchemy
|
||||
alembic
|
||||
Markdown
|
||||
future-fstrings
|
||||
telethon-session-sqlalchemy
|
||||
|
||||
@@ -33,10 +33,11 @@ setuptools.setup(
|
||||
"ruamel.yaml>=0.15.35,<0.16",
|
||||
"future-fstrings>=0.4.2",
|
||||
"python-magic>=0.4.15,<0.5",
|
||||
"telethon-aio>=0.18,<0.19" if sys.version_info >= (3, 6) else "telethon-aio-git",
|
||||
"telethon-aio==0.18.1" if sys.version_info >= (3, 6) else "telethon-aio-git",
|
||||
"telethon-session-sqlalchemy>=0.1,<0.2",
|
||||
],
|
||||
dependency_links=[
|
||||
"https://github.com/tulir/telethon-asyncio/tarball/9b389cfb4b6d3876e9661c23507f17e96897e4b0#egg=telethon-aio-git-0.18.0+1"
|
||||
"https://github.com/tulir/telethon-asyncio/tarball/f4fa3278185f823dc1dceb34604529246cb6a4c8#egg=telethon-aio-git-0.18.1+1"
|
||||
],
|
||||
extras_require=extras,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user