diff --git a/bot.go b/bot.go index 39438c6..3c974ec 100644 --- a/bot.go +++ b/bot.go @@ -169,9 +169,10 @@ func (b *Bot) WebInit() error { return err } // 设置当前的用户 - b.self = &Self{bot: b, User: &resp.User} + b.self = &Self{bot: b, User: resp.User} b.self.formatEmoji() b.self.self = b.self + resp.ContactList.init(b.self) b.Storage.Response = resp // 通知手机客户端已经登录 diff --git a/entity.go b/entity.go index f9ce0d6..f150866 100644 --- a/entity.go +++ b/entity.go @@ -57,9 +57,9 @@ type WebInitResponse struct { SKey string BaseResponse BaseResponse SyncKey SyncKey - User User - MPSubscribeMsgList []MPSubscribeMsg - ContactList []User + User *User + MPSubscribeMsgList []*MPSubscribeMsg + ContactList Members } // MPSubscribeMsg 公众号的订阅信息 @@ -68,12 +68,14 @@ type MPSubscribeMsg struct { Time int64 UserName string NickName string - MPArticleList []struct { - Title string - Cover string - Digest string - Url string - } + MPArticleList []*MPArticle +} + +type MPArticle struct { + Title string + Cover string + Digest string + Url string } type UserDetailItem struct { diff --git a/user.go b/user.go index 05fbf42..4d50c3d 100644 --- a/user.go +++ b/user.go @@ -668,6 +668,16 @@ func (s *Self) SendVideoToGroups(video io.Reader, delay time.Duration, groups .. return s.sendVideoToMembers(video, delay, members...) } +// ContactList 获取最近的联系人列表 +func (s *Self) ContactList() Members { + return s.Bot().Storage.Response.ContactList +} + +// MPSubscribeList 获取部分公众号文章列表 +func (s *Self) MPSubscribeList() []*MPSubscribeMsg { + return s.Bot().Storage.Response.MPSubscribeMsgList +} + // Members 抽象的用户组 type Members []*User