From c8803bc8ccbabdcb32a12d810edce7dcde48f6fc Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Fri, 1 Apr 2022 05:09:31 -0400 Subject: [PATCH] Minor cleanups --- matrix_appservice_kakaotalk/commands/handler.py | 2 +- matrix_appservice_kakaotalk/config.py | 3 --- matrix_appservice_kakaotalk/kt/client/errors.py | 2 -- .../kt/types/chat/attachment/__init__.py | 2 +- matrix_appservice_kakaotalk/kt/types/chat/chat.py | 2 ++ matrix_appservice_kakaotalk/matrix.py | 4 +--- matrix_appservice_kakaotalk/rpc/rpc.py | 4 ++-- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/matrix_appservice_kakaotalk/commands/handler.py b/matrix_appservice_kakaotalk/commands/handler.py index a79d5fc..d5fc91f 100644 --- a/matrix_appservice_kakaotalk/commands/handler.py +++ b/matrix_appservice_kakaotalk/commands/handler.py @@ -17,7 +17,7 @@ from typing import NamedTuple from mautrix.bridge.commands import HelpSection -HelpCacheKey = NamedTuple("FBHelpCacheKey", is_management=bool, is_admin=bool, is_logged_in=bool) +HelpCacheKey = NamedTuple("KTHelpCacheKey", is_management=bool, is_admin=bool, is_logged_in=bool) SECTION_AUTH = HelpSection("Authentication", 10, "") SECTION_CONNECTION = HelpSection("Connection management", 15, "") diff --git a/matrix_appservice_kakaotalk/config.py b/matrix_appservice_kakaotalk/config.py index d98b852..d844471 100644 --- a/matrix_appservice_kakaotalk/config.py +++ b/matrix_appservice_kakaotalk/config.py @@ -51,9 +51,6 @@ class Config(BaseBridgeConfig): copy("homeserver.asmux") - if self["appservice.bot_avatar"] == "mxc://maunium.net/ddtNPZSKMNqaUzqrHuWvUADv": - base["appservice.bot_avatar"] = "mxc://maunium.net/ygtkteZsXnGJLJHRchUwYWak" - copy("appservice.public.enabled") copy("appservice.public.prefix") copy("appservice.public.external") diff --git a/matrix_appservice_kakaotalk/kt/client/errors.py b/matrix_appservice_kakaotalk/kt/client/errors.py index 90a6989..5acebbf 100644 --- a/matrix_appservice_kakaotalk/kt/client/errors.py +++ b/matrix_appservice_kakaotalk/kt/client/errors.py @@ -17,8 +17,6 @@ from __future__ import annotations -from typing import Type - from ..types.api.auth_api_client import KnownAuthStatusCode from ..types.request import KnownDataStatusCode, RootCommandResult diff --git a/matrix_appservice_kakaotalk/kt/types/chat/attachment/__init__.py b/matrix_appservice_kakaotalk/kt/types/chat/attachment/__init__.py index a6e38d0..10ee920 100644 --- a/matrix_appservice_kakaotalk/kt/types/chat/attachment/__init__.py +++ b/matrix_appservice_kakaotalk/kt/types/chat/attachment/__init__.py @@ -35,8 +35,8 @@ class PathAttachment(Attachment): s: int -from .media import * from .reply import * +from .mention import * from .media import * from .emoticon import * #from .voip import * diff --git a/matrix_appservice_kakaotalk/kt/types/chat/chat.py b/matrix_appservice_kakaotalk/kt/types/chat/chat.py index 4561a0f..ebe38f3 100644 --- a/matrix_appservice_kakaotalk/kt/types/chat/chat.py +++ b/matrix_appservice_kakaotalk/kt/types/chat/chat.py @@ -68,6 +68,8 @@ _attachment_type_map: dict[KnownChatType, Type[Attachment]] = { KnownChatType.CONTACT: ContactAttachment, KnownChatType.AUDIO: AudioAttachment, KnownChatType.DITEMEMOTICON: EmoticonAttachment, + KnownChatType.STICKER: EmoticonAttachment, + KnownChatType.STICKERANI: EmoticonAttachment, KnownChatType.SCHEDULE: OpenScheduleAttachment, KnownChatType.VOTE: VoteAttachment, KnownChatType.MAP: MapAttachment, diff --git a/matrix_appservice_kakaotalk/matrix.py b/matrix_appservice_kakaotalk/matrix.py index a17df0c..f9938c7 100644 --- a/matrix_appservice_kakaotalk/matrix.py +++ b/matrix_appservice_kakaotalk/matrix.py @@ -16,7 +16,6 @@ from __future__ import annotations from typing import TYPE_CHECKING, Union -import time from mautrix.bridge import BaseMatrixHandler from mautrix.errors import MatrixError @@ -39,7 +38,6 @@ from mautrix.types import ( ) from . import portal as po, puppet as pu, user as u -from .db import Message as DBMessage if TYPE_CHECKING: from .__main__ import KakaoTalkBridge @@ -238,7 +236,7 @@ class MatrixHandler(BaseMatrixHandler): event_id: EventID, data: SingleReceiptEventContent, ) -> None: - self.log.info("TODO") + self.log.info("TODO: handle_read_receipt") """ if not user.mqtt: return diff --git a/matrix_appservice_kakaotalk/rpc/rpc.py b/matrix_appservice_kakaotalk/rpc/rpc.py index ef48b99..80d6bb5 100644 --- a/matrix_appservice_kakaotalk/rpc/rpc.py +++ b/matrix_appservice_kakaotalk/rpc/rpc.py @@ -63,7 +63,7 @@ class RPCClient: r, w = await asyncio.open_unix_connection(self.config["rpc.connection.path"]) break except: - self.log.warn(f'No unix socket available at {self.config["rpc.connection.path"]}, wait for it to exist...') + self.log.warning(f'No unix socket available at {self.config["rpc.connection.path"]}, wait for it to exist...') await asyncio.sleep(10) elif self.config["rpc.connection.type"] == "tcp": while True: @@ -72,7 +72,7 @@ class RPCClient: self.config["rpc.connection.port"]) break except: - self.log.warn(f'No TCP connection open at {self.config["rpc.connection.host"]}:{self.config["rpc.connection.path"]}, wait for it to become available...') + self.log.warning(f'No TCP connection open at {self.config["rpc.connection.host"]}:{self.config["rpc.connection.path"]}, wait for it to become available...') await asyncio.sleep(10) else: raise RuntimeError("invalid rpc connection type")