Merge pull request #39 from Suika99/patch-1

把缺失的函数和结构体声明加上
This commit is contained in:
Kanri 2021-07-01 07:53:34 -05:00 committed by GitHub
commit 18a96027f0

View File

@ -6,6 +6,18 @@ import (
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
) )
type follower struct {
Mid int `json:"mid"`
Uname string `json:"uname"`
Video int `json:"video"`
Roomid int `json:"roomid"`
Rise int `json:"rise"`
Follower int `json:"follower"`
GuardNum int `json:"guardNum"`
AreaRank int `json:"areaRank"`
}
// 开启日报推送 // 开启日报推送
func init() { func init() {
zero.OnFullMatch("/开启粉丝日报", zero.AdminPermission). zero.OnFullMatch("/开启粉丝日报", zero.AdminPermission).
@ -88,3 +100,19 @@ func fansData(groupID int64) {
return true return true
}) })
} }
// 请求api
func fensiapi(uid string) *follower {
url := "https://api.vtbs.moe/v1/detail/" + uid
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result := &follower{}
if err := json.NewDecoder(resp.Body).Decode(result); err != nil {
panic(err)
}
return result
}