Skip to content

Commit

Permalink
Merge pull request #2 from BoyChai/channel
Browse files Browse the repository at this point in the history
Add Channel
  • Loading branch information
BoyChai committed Aug 25, 2022
2 parents 31dd1b7 + d3f4f2d commit 0bbb333
Show file tree
Hide file tree
Showing 2 changed files with 443 additions and 1 deletion.
39 changes: 38 additions & 1 deletion event.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type Event struct {
Level string `json:"level"`
Role string `json:"role"`
Title string `json:"title"`
//频道
TinyID string `json:"tiny_id"`
} `json:"sender"`
Anonymous struct {
ID int64 `json:"id"`
Expand Down Expand Up @@ -60,11 +62,44 @@ type Event struct {
Comment string `json:"comment"`
Flag string `json:"flag"`
Client struct {
AppId int64 `json:"app_id"`
AppID int64 `json:"app_id"`
DeviceName string `json:"device_name"`
DeviceKind string `json:"device_kind"`
} `json:"client"`
Online bool `json:"online"`
//频道
GuildID string `json:"guild_id"`
ChannelID string `json:"channel_id"`
CurrentReactions []struct {
EmojiID string `json:"emoji_id"`
EmojiIndex int32 `json:"emoji_index"`
EmojiType int32 `json:"emoji_type"`
EmojiName string `json:"emoji_name"`
Count int32 `json:"count"`
Clicked bool `json:"clicked"`
} `json:"current_reactions"`
OldInfo ChannelInfo `json:"old_info"`
NewInfo ChannelInfo `json:"new_info"`
ChannelInfo ChannelInfo `json:"channel_info"`
}

// ChannelInfo 频道信息
type ChannelInfo struct {
OwnerGuildID string `json:"owner_guild_id"`
ChannelID string `json:"channel_id"`
ChannelType int32 `json:"channel_type"`
ChannelName string `json:"channel_name"`
CreateTime int64 `json:"create_time"`
CreatorTinyID string `json:"creator_tiny_id"`
TalkPermission int32 `json:"talk_permission"`
VisibleType int32 `json:"visible_type"`
CurrentSlowMode int32 `json:"current_slow_mode"`
SlowModes []struct {
SlowModeKey int32 `json:"slow_mode_key"`
SlowModeText string `json:"slow_mode_text"`
SpeakFrequency int32 `json:"speak_frequency"`
SlowModeCircle int32 `json:"slow_mode_circle"`
} `json:"slow_modes"`
}

// explain 解析命令函数
Expand Down Expand Up @@ -120,6 +155,8 @@ func (e *Event) typeAsserts(key interface{}) (interface{}, error) {
return *key.(*int64), nil
case *string:
return *key.(*string), nil
case *int32:
return *key.(*int32), nil
default:
return nil, errors.New("the current type is not supported. please feedback through issue")
}
Expand Down
Loading

0 comments on commit 0bbb333

Please sign in to comment.