github.com/tada-team/tdproto@v1.51.57/chat_type.go (about) 1 package tdproto 2 3 import ( 4 "log" 5 ) 6 7 // Chat type 8 type ChatType string 9 10 const ( 11 // Direct chat 12 DirectChatType ChatType = "direct" 13 14 // Group chat 15 GroupChatType ChatType = "group" 16 17 // Task 18 TaskChatType ChatType = "task" 19 20 //Meeting 21 MeetingChatType ChatType = "meeting" 22 23 // Thread chat 24 ThreadChatType ChatType = "thread" 25 ) 26 27 func (ct ChatType) JidPrefix() string { 28 switch ct { 29 case DirectChatType: 30 return ContactPrefix 31 case GroupChatType: 32 return GroupPrefix 33 case TaskChatType: 34 return TaskPrefix 35 case MeetingChatType: 36 return MeetingPrefix 37 case ThreadChatType: 38 return ThreadPrefix 39 default: 40 log.Panicf("JidPrefix(): incorrect chat type: %s", ct) 41 return "" 42 } 43 } 44 45 func (ct ChatType) String() string { return string(ct) } 46 47 func (ct ChatType) IsDirect() bool { return ct == DirectChatType } 48 func (ct ChatType) IsGroup() bool { return ct == GroupChatType } 49 func (ct ChatType) IsTask() bool { return ct == TaskChatType } 50 func (ct ChatType) IsMeeting() bool { return ct == MeetingChatType } 51 func (ct ChatType) IsThread() bool { return ct == ThreadChatType }