Explorar el Código

Preview type and item username for reel shares (#134)

* Preview type and item username for reel shares

* Formatter

* Get item username from either item caption or user
vurpo hace 1 año
padre
commit
54b3166d73
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      mautrix_instagram/portal.py

+ 5 - 0
mautrix_instagram/portal.py

@@ -1195,8 +1195,13 @@ class Portal(DBPortal, BasePortal):
                 combined["com.beeper.raw_caption_text"] = share_item.caption.text
                 combined["com.beeper.instagram_item_username"] = share_item.caption.user.username
 
+            if share_item.user:
+                combined["com.beeper.instagram_item_username"] = share_item.user.username
+
             if item.direct_media_share and item.direct_media_share.media_share_type == "tag":
                 combined["com.beeper.relation_preview_type"] = "post_mention"
+            elif item_type_name == "clip":
+                combined["com.beeper.relation_preview_type"] = "reel"
 
             return [(EventType.ROOM_MESSAGE, combined)]
         else: