ソースを参照

Fix handling of KeysUploadError

Kumi 11 ヶ月 前
コミット
d4cf70b273
1 ファイル変更2 行追加3 行削除
  1. 2 3
      src/gptbot/callbacks/roommember.py

+ 2 - 3
src/gptbot/callbacks/roommember.py

@@ -1,9 +1,8 @@
 from nio import RoomMemberEvent, MatrixRoom, KeysUploadError
 
 async def roommember_callback(room: MatrixRoom, event: RoomMemberEvent, bot):
-    try:
-        await bot.matrix_client.keys_upload()
-    except KeysUploadError as e:
+    upload = await bot.matrix_client.keys_upload()
+    if isinstance(upload, KeysUploadError):
         bot.logger.log(f"Failed to upload keys: {e.message}")
 
     if event.membership == "leave":