From 6623dd46c0aed3961c001a9abc2896d1e3f1a880 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 2 May 2022 03:13:18 -0400 Subject: [PATCH] Assorted minor fixes --- matrix_appservice_kakaotalk/commands/auth.py | 2 +- matrix_appservice_kakaotalk/commands/conn.py | 4 ++-- matrix_appservice_kakaotalk/db/__init__.py | 1 - matrix_appservice_kakaotalk/example-config.yaml | 4 +--- matrix_appservice_kakaotalk/user.py | 7 ++++--- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/matrix_appservice_kakaotalk/commands/auth.py b/matrix_appservice_kakaotalk/commands/auth.py index 1909859..9ed7759 100644 --- a/matrix_appservice_kakaotalk/commands/auth.py +++ b/matrix_appservice_kakaotalk/commands/auth.py @@ -66,7 +66,7 @@ async def login(evt: CommandEvent) -> None: "action": "Login", "room_id": evt.room_id, "next": enter_password, - "email": evt.args[0], + "email": email, } """ TODO Implement web login diff --git a/matrix_appservice_kakaotalk/commands/conn.py b/matrix_appservice_kakaotalk/commands/conn.py index 9cda0f0..c1fb034 100644 --- a/matrix_appservice_kakaotalk/commands/conn.py +++ b/matrix_appservice_kakaotalk/commands/conn.py @@ -96,7 +96,7 @@ async def ping(evt: CommandEvent) -> None: management_only=True, help_section=SECTION_CONNECTION, help_text="(Re)connect to KakaoTalk chats & sync any missed chat updates", - help_args="[number_of_channels_to_sync]", + help_args="[_number of channels to sync_]", ) async def sync(evt: CommandEvent) -> None: try: @@ -104,7 +104,7 @@ async def sync(evt: CommandEvent) -> None: except IndexError: sync_count = None except ValueError: - await evt.reply("**Usage:** `sync [number_of_channels_to_sync]`") + await evt.reply("The number of channels to sync must either be an integer, or be left unspecified.") return await evt.mark_read() diff --git a/matrix_appservice_kakaotalk/db/__init__.py b/matrix_appservice_kakaotalk/db/__init__.py index 3dc2b44..eabf900 100644 --- a/matrix_appservice_kakaotalk/db/__init__.py +++ b/matrix_appservice_kakaotalk/db/__init__.py @@ -32,7 +32,6 @@ __all__ = [ "init", "Message", "Portal", - "ThreadType", "Puppet", "User", ] diff --git a/matrix_appservice_kakaotalk/example-config.yaml b/matrix_appservice_kakaotalk/example-config.yaml index ddc5835..75d86dc 100644 --- a/matrix_appservice_kakaotalk/example-config.yaml +++ b/matrix_appservice_kakaotalk/example-config.yaml @@ -93,9 +93,7 @@ bridge: # {userid} is replaced with the user ID of the KakaoTalk user. username_template: "kakaotalk_{userid}" # Displayname template for KakaoTalk users. - # {displayname} is replaced with the display name of the KakaoTalk user - # as defined below in displayname_preference. - # Keys available for displayname_preference are also available here. + # {displayname} is replaced with the display name of the KakaoTalk user. displayname_template: "{displayname} (KT)" # The prefix for commands. Only required in non-management rooms. diff --git a/matrix_appservice_kakaotalk/user.py b/matrix_appservice_kakaotalk/user.py index fd0e01f..ed5e092 100644 --- a/matrix_appservice_kakaotalk/user.py +++ b/matrix_appservice_kakaotalk/user.py @@ -135,7 +135,7 @@ class User(DBUser, BaseUser): self._is_connected = None self._connection_time = time.monotonic() self._sync_lock = SimpleLock( - "Waiting for thread sync to finish before handling %s", log=self.log + "Waiting for channel sync to finish before handling %s", log=self.log ) self._is_rpc_reconnecting = False self._logged_in_info = None @@ -348,7 +348,7 @@ class User(DBUser, BaseUser): state_event=BridgeStateEvent.TRANSIENT_DISCONNECT, ) await asyncio.sleep(60) - await self.reload_session(event_id, retries - 1, is_startup) + await self.reload_session(event_id, retries - 1) else: await self.send_bridge_notice( notice, @@ -685,8 +685,9 @@ class User(DBUser, BaseUser): if self.temp_disconnect_notices: await self.send_bridge_notice( "Disconnected from KakaoTalk: backend helper module exited. " - "Will reconnect once module resumes." + "Will reconnect once the module resumes." ) + await self.push_bridge_state(BridgeStateEvent.TRANSIENT_DISCONNECT) self._is_rpc_reconnecting = True asyncio.create_task(self.reload_session())