github.com/LagrangeDev/LagrangeGo@v0.0.0-20240512064304-ad4a85e10cb4/message/source.go (about) 1 package message 2 3 // from https://github.com/Mrs4s/MiraiGo/blob/master/message/source.go 4 5 type SourceType byte 6 7 // MessageSourceType 常量 8 const ( 9 SourcePrivate SourceType = 1 << iota 10 SourceGroup SourceType = 1 << iota 11 SourceGuildChannel SourceType = 1 << iota 12 SourceGuildDirect SourceType = 1 << iota 13 ) 14 15 func (t SourceType) String() string { 16 switch t { 17 case SourcePrivate: 18 return "私聊" 19 case SourceGroup: 20 return "群聊" 21 case SourceGuildChannel: 22 return "频道" 23 case SourceGuildDirect: 24 return "频道私聊" 25 default: 26 return "unknown" 27 } 28 } 29 30 // Source 消息来源 31 type Source struct { 32 SourceType SourceType 33 PrimaryID int64 // 群号/QQ号/guild_id 34 SecondaryID int64 // channel_id 35 }