@@ -1496,6 +1496,114 @@ def full_message(self) -> str:
1496
1496
return " " .join (fragment .text for fragment in self .fragments if fragment .type == "text" )
1497
1497
1498
1498
1499
+ class BaseSharedChatSession (BaseEvent ):
1500
+ __slots__ = (
1501
+ "session_id" ,
1502
+ "broadcaster" ,
1503
+ "host" ,
1504
+ )
1505
+
1506
+ def __init__ (
1507
+ self ,
1508
+ payload : ChannelSharedChatSessionBeginEvent | ChannelSharedChatSessionUpdateEvent | ChannelSharedChatSessionEndEvent ,
1509
+ * ,
1510
+ http : HTTPClient ,
1511
+ ) -> None :
1512
+ self .session_id : str = payload ["session_id" ]
1513
+ self .broadcaster : PartialUser = PartialUser (
1514
+ payload ["broadcaster_user_id" ], payload ["broadcaster_user_login" ], http = http
1515
+ )
1516
+ self .host : PartialUser = PartialUser (
1517
+ payload ["host_broadcaster_user_id" ], payload ["host_broadcaster_user_login" ], http = http
1518
+ )
1519
+
1520
+ def __repr__ (self ) -> str :
1521
+ return f"<BaseSharedChatSession session_id={ self .session_id } broadcaster={ self .broadcaster } host={ self .host } >"
1522
+
1523
+
1524
+ class SharedChatSessionBegin (BaseSharedChatSession ):
1525
+ """
1526
+ Represents a shared chat session begin event.
1527
+
1528
+ Attributes
1529
+ ----------
1530
+ session_id: PartialUser
1531
+ The unique identifier for the shared chat session.
1532
+ broadcaster: PartialUser
1533
+ The user of the channel in the subscription condition which is now active in the shared chat session.
1534
+ host: PartialUser
1535
+ The user of the host channel.
1536
+ participants: str
1537
+ List of participants in the session.
1538
+ """
1539
+
1540
+ subscription_type = "channel.shared_chat.begin"
1541
+
1542
+ __slots__ = ("participants" ,)
1543
+
1544
+ def __init__ (self , payload : ChannelSharedChatSessionBeginEvent , * , http : HTTPClient ) -> None :
1545
+ super ().__init__ (payload , http = http )
1546
+ self .participants : list [PartialUser ] = [
1547
+ PartialUser (p ["broadcaster_user_id" ], p ["broadcaster_user_login" ], http = http ) for p in payload ["participants" ]
1548
+ ]
1549
+
1550
+ def __repr__ (self ) -> str :
1551
+ return f"<BaseSharedChatSession session_id={ self .session_id } broadcaster={ self .broadcaster } host={ self .host } >"
1552
+
1553
+
1554
+ class SharedChatSessionUpdate (BaseSharedChatSession ):
1555
+ """
1556
+ Represents a shared chat session begin event.
1557
+
1558
+ Attributes
1559
+ ----------
1560
+ session_id: PartialUser
1561
+ The unique identifier for the shared chat session.
1562
+ broadcaster: PartialUser
1563
+ The user of the channel in the subscription condition which is now active in the shared chat session.
1564
+ host: PartialUser
1565
+ The user of the host channel.
1566
+ participants: str
1567
+ List of participants in the session.
1568
+ """
1569
+
1570
+ subscription_type = "channel.shared_chat.update"
1571
+
1572
+ __slots__ = ("participants" ,)
1573
+
1574
+ def __init__ (self , payload : ChannelSharedChatSessionUpdateEvent , * , http : HTTPClient ) -> None :
1575
+ super ().__init__ (payload , http = http )
1576
+ self .participants : list [PartialUser ] = [
1577
+ PartialUser (p ["broadcaster_user_id" ], p ["broadcaster_user_login" ], http = http ) for p in payload ["participants" ]
1578
+ ]
1579
+
1580
+ def __repr__ (self ) -> str :
1581
+ return f"<SharedChatSessionUpdate session_id={ self .session_id } broadcaster={ self .broadcaster } host={ self .host } >"
1582
+
1583
+
1584
+ class SharedChatSessionEnd (BaseSharedChatSession ):
1585
+ """
1586
+ Represents a shared chat session end event.
1587
+
1588
+ Attributes
1589
+ ----------
1590
+ session_id: PartialUser
1591
+ The unique identifier for the shared chat session.
1592
+ broadcaster: PartialUser
1593
+ The user of the channel in the subscription condition which is no longer active in the shared chat session.
1594
+ host: PartialUser
1595
+ The user of the host channel.
1596
+ """
1597
+
1598
+ subscription_type = "channel.shared_chat.end"
1599
+
1600
+ def __init__ (self , payload : ChannelSharedChatSessionUpdateEvent , * , http : HTTPClient ) -> None :
1601
+ super ().__init__ (payload , http = http )
1602
+
1603
+ def __repr__ (self ) -> str :
1604
+ return f"<SharedChatSessionEnd session_id={ self .session_id } broadcaster={ self .broadcaster } host={ self .host } >"
1605
+
1606
+
1499
1607
class ChannelSubscribe (BaseEvent ):
1500
1608
"""
1501
1609
Represents a channel subscribe event.
0 commit comments