[feat]: 添加最近联系人和公众号文章列表 (#230)

This commit is contained in:
多吃点苹果 2023-02-04 11:59:17 +08:00 committed by GitHub
parent 66c4bebd1f
commit 35a348f0af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 10 deletions

3
bot.go
View File

@ -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
// 通知手机客户端已经登录

View File

@ -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 {

10
user.go
View File

@ -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