From 722f32d2ed9224f2c0a92f708026c1adf782d3d4 Mon Sep 17 00:00:00 2001
From: Tulir Asokan <tulir@maunium.net>
Date: Mon, 8 Jun 2020 13:01:00 +0300
Subject: [PATCH] Fix some bugs and update fbchat-asyncio

---
 mautrix_facebook/commands/facebook.py | 2 +-
 mautrix_facebook/portal.py            | 2 +-
 mautrix_facebook/user.py              | 3 ++-
 requirements.txt                      | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/mautrix_facebook/commands/facebook.py b/mautrix_facebook/commands/facebook.py
index 215a630..b8c8937 100644
--- a/mautrix_facebook/commands/facebook.py
+++ b/mautrix_facebook/commands/facebook.py
@@ -33,7 +33,7 @@ async def search(evt: CommandEvent) -> None:
 
 @command_handler(needs_auth=True, management_only=False)
 async def search_by_id(evt: CommandEvent) -> None:
-    res = [item async for item in evt.sender.client.fetch_thread_info(*evt.args)]
+    res = [item async for item in evt.sender.client.fetch_thread_info(evt.args)]
     await evt.reply(await _handle_search_result(evt.sender, res))
 
 
diff --git a/mautrix_facebook/portal.py b/mautrix_facebook/portal.py
index 90a06b5..7b7da17 100644
--- a/mautrix_facebook/portal.py
+++ b/mautrix_facebook/portal.py
@@ -198,7 +198,7 @@ class Portal(BasePortal):
                           info: Optional[ThreadClass] = None) -> Optional[ThreadClass]:
         if not info:
             self.log.debug("Called update_info with no info, fetching thread info...")
-            info = await source.client.fetch_thread_info(self.fbid).__anext__()
+            info = await source.client.fetch_thread_info([self.fbid]).__anext__()
         self.log.trace("Thread info for %s: %s", self.fbid, info)
         if not isinstance(info, (fbchat.UserData, fbchat.GroupData, fbchat.PageData)):
             self.log.warning("Got weird info for %s of type %s, cancelling update",
diff --git a/mautrix_facebook/user.py b/mautrix_facebook/user.py
index f50a6f7..c502172 100644
--- a/mautrix_facebook/user.py
+++ b/mautrix_facebook/user.py
@@ -451,7 +451,8 @@ class User(BaseUser):
         await self.send_bridge_notice("Facebook Messenger connection closed without error")
 
     async def _handle_event(self, event: Any) -> None:
-        self.log.debug("Handling facebook event %s", event)
+        self.log.debug("Handling facebook event of type %s", type(event))
+        self.log.trace("Facebook event content: %s", event)
         try:
             handler = self._handlers[type(event)]
         except KeyError:
diff --git a/requirements.txt b/requirements.txt
index f94eb38..07c99a1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,4 +5,4 @@ ruamel.yaml>=0.15.94,<0.17
 commonmark>=0.8,<0.10
 python-magic>=0.4,<0.5
 mautrix>=0.5.2,<0.6
-fbchat-asyncio==0.6.0
+fbchat-asyncio>=0.6.1,<0.7
-- 
GitLab