-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |