فهرست منبع

video call: handle by showing a notice

Signed-off-by: Sumner Evans <sumner@beeper.com>
Sumner Evans 2 سال پیش
والد
کامیت
af6315778b
2فایلهای تغییر یافته به همراه20 افزوده شده و 0 حذف شده
  1. 7 0
      mauigpapi/types/thread_item.py
  2. 13 0
      mautrix_instagram/portal.py

+ 7 - 0
mauigpapi/types/thread_item.py

@@ -543,6 +543,12 @@ class ProfileItem(BaseResponseUser, SerializableAttrs):
     pass
 
 
+@dataclass
+class VideoCallEvent(SerializableAttrs):
+    action: str
+    description: str
+
+
 @dataclass(kw_only=True)
 class ThreadItem(SerializableAttrs):
     item_id: Optional[str] = None
@@ -583,6 +589,7 @@ class ThreadItem(SerializableAttrs):
     clip: Optional[ClipItem] = None
     felix_share: Optional[FelixShareItem] = None
     profile: Optional[ProfileItem] = None
+    video_call_event: Optional[VideoCallEvent] = None
 
     @property
     def timestamp_ms(self) -> int:

+ 13 - 0
mautrix_instagram/portal.py

@@ -1651,6 +1651,19 @@ class Portal(DBPortal, BasePortal):
                 converted.append((msg_type, combined))
             else:
                 converted.append((msg_type, expired))
+        elif item.video_call_event:
+            msg_type = (
+                MessageType.NOTICE
+                if item.video_call_event.action == "video_call_ended"
+                else MessageType.TEXT
+            )
+            video_call_notification = TextMessageEventContent(
+                msgtype=msg_type,
+                body=item.video_call_event.description,
+                formatted_body=f"<b>{item.video_call_event.description}</b>",
+                format=Format.HTML,
+            )
+            converted.append((EventType.ROOM_MESSAGE, video_call_notification))
         elif item.action_log:
             # These probably don't need to be bridged
             self.log.debug(f"Ignoring action log message {item.item_id}")