Coverage for venv\Lib\site-packages\rid_lib\types\slack_message.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-20 16:40 +0800

1from rid_lib.core import RID, ORN 

2 

3class SlackMessage(ORN): 

4 namespace = "slack.message" 

5 

6 def __init__( 

7 self, 

8 team_id: str, 

9 channel_id: str, 

10 ts: str, 

11 ): 

12 self.team_id = team_id 

13 self.channel_id = channel_id 

14 self.ts = ts 

15 

16 @property 

17 def reference(self): 

18 return f"{self.team_id}/{self.channel_id}/{self.ts}" 

19 

20 @classmethod 

21 def from_reference(cls, reference): 

22 components = reference.split("/") 

23 if len(components) in (3, 4): 

24 return cls(*components) 

25 

26RID.register_context(SlackMessage)