Skip to content

Commit

Permalink
feat: message source
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Apr 20, 2024
1 parent 725e7fc commit 8475ae7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions message/source.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package message

type SourceType byte

// MessageSourceType 常量
const (
SourcePrivate SourceType = 1 << iota
SourceGroup SourceType = 1 << iota
SourceGuildChannel SourceType = 1 << iota
SourceGuildDirect SourceType = 1 << iota
)

func (t SourceType) String() string {
switch t {
case SourcePrivate:
return "私聊"
case SourceGroup:
return "群聊"
case SourceGuildChannel:
return "频道"
case SourceGuildDirect:
return "频道私聊"
default:
return "unknown"
}
}

// Source 消息来源
type Source struct {
SourceType SourceType
PrimaryID int64 // 群号/QQ号/guild_id
SecondaryID int64 // channel_id
}

0 comments on commit 8475ae7

Please sign in to comment.