From 32181e3257b4c5b1b26d289579716f9fa5900748 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 28 Apr 2022 03:23:52 -0400 Subject: [PATCH] Actually connect channel add listener Also be less strict about needing channel_info on portal creation --- matrix_appservice_kakaotalk/kt/client/client.py | 1 + matrix_appservice_kakaotalk/portal.py | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/matrix_appservice_kakaotalk/kt/client/client.py b/matrix_appservice_kakaotalk/kt/client/client.py index ee5c446..ce2e820 100644 --- a/matrix_appservice_kakaotalk/kt/client/client.py +++ b/matrix_appservice_kakaotalk/kt/client/client.py @@ -626,6 +626,7 @@ class Client: self._add_event_handler("chat_read", self._on_chat_read) self._add_event_handler("profile_changed", self._on_profile_changed) self._add_event_handler("perm_changed", self._on_perm_changed) + self._add_event_handler("channel_added", self._on_channel_added) self._add_event_handler("channel_join", self._on_channel_join) self._add_event_handler("channel_left", self._on_channel_left) self._add_event_handler("channel_kicked", self._on_channel_kicked) diff --git a/matrix_appservice_kakaotalk/portal.py b/matrix_appservice_kakaotalk/portal.py index 40d2c99..0d74e0a 100644 --- a/matrix_appservice_kakaotalk/portal.py +++ b/matrix_appservice_kakaotalk/portal.py @@ -944,12 +944,11 @@ class Portal(DBPortal, BasePortal): # NOTE Calling this after room creation to invite participants await self._update_participants(source, info.participantInfo) - try: - # TODO Think of better typing for this - assert info.channel_info - await self.backfill(source, is_initial=True, channel_info=info.channel_info) - except Exception: - self.log.exception("Failed to backfill new portal") + if info.channel_info: + try: + await self.backfill(source, is_initial=True, channel_info=info.channel_info) + except Exception: + self.log.exception("Failed to backfill new portal") # TODO Sync read receipts?