diff --git a/README.md b/README.md index 7369ecbc..13105f05 100644 --- a/README.md +++ b/README.md @@ -79,20 +79,21 @@ - 搜图 `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao"` - [x] 以图搜图|搜索图片|以图识图[图片] - [x] 搜图[P站图片ID] -- 简易随机图片(调用url) `暂时失效` +- 简易随机图片(调用url) `github.com/FloatTech/ZeroBot-Plugin/plugin_rand_image` - [x] 随机图片 - [x] 直接随机(无r18检测,后果自负) - [x] 设置随机图片网址[url] - [x] 太涩了(撤回最近发的图) - [x] 评价图片:发送一张图片进行评分 -- 关注bilibili的DD功能 `暂时失效` - - [x] /查 uid: 通过uid查询成分(与关注了2000uvp小号的共同关注) - - [x] /查 name: 通过名字查询成分(与关注了2000uvp小号的共同关注) - - [x] /粉丝 name:查询粉丝实时数据(例:/粉丝 嘉然) - - [x] /搜索 name:通过名字查询用户uid +- bilibili `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili"` + - [x] >bili info [名字] - 嘉然 `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana"` - [x] @BOT 小作文 - [x] @BOT 发大病 +- AIfalse `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_AIfalse"` + - [x] 查询计算机当前活跃度 [身体检查] + - [ ] 简易语音 + - [ ] 爬图合成 [@xxx] - TODO... ### 使用方法 diff --git a/fensi/cha.go b/fensi/cha.go deleted file mode 100644 index 38bda7e4..00000000 --- a/fensi/cha.go +++ /dev/null @@ -1,107 +0,0 @@ -package fensi - -import ( - "encoding/json" - "fmt" - "github.com/tidwall/gjson" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" - "io/ioutil" - "net/http" - "strconv" -) - - -func init() { - zero.OnRegex(`^/查 (.{1,25})$`). - Handle(func(ctx *zero.Ctx) { - keyword := ctx.State["regex_matched"].([]string)[1] - uid := searchapi(keyword).Data.Result[0].Mid - - if searchapi(keyword).Data.NumResults == 0 { - ctx.Send("名字没搜到") - return - } - - accinfojson := accinfo(strconv.Itoa(uid)) - hanjian := follow(strconv.Itoa(uid)) - ctx.SendChain(message.Text( - "uid: ", accinfojson.Data.Mid, "\n", - "name: ", accinfojson.Data.Name, "\n", - "sex: ", accinfojson.Data.Sex, "\n", - "sign: ", accinfojson.Data.Sign, "\n", - "level: ", accinfojson.Data.Level, "\n", - "birthday: ", accinfojson.Data.Birthday, "\n", - "follow: ", gjson.Get(hanjian, "data.list.#.uname"), - )) - }) -} - -func init() { - zero.OnRegex(`^/查UID:(.{1,25})$`). - Handle(func(ctx *zero.Ctx) { - uid := ctx.State["regex_matched"].([]string)[1] - accinfojson := accinfo(uid) - hanjian := follow(uid) - status := accinfojson.Code - - if status != 0 { - ctx.Send("UID非法") - return - } - - ctx.SendChain(message.Text( - "uid: ", accinfojson.Data.Mid, "\n", - "name: ", accinfojson.Data.Name, "\n", - "sex: ", accinfojson.Data.Sex, "\n", - "sign: ", accinfojson.Data.Sign, "\n", - "level: ", accinfojson.Data.Level, "\n", - "birthday: ", accinfojson.Data.Birthday, "\n", - "follow: ", gjson.Get(hanjian, "data.list.#.uname"), - )) - }) -} - - -func accinfo(uid string) *accInfo { - - url := "http://api.bilibili.com/x/space/acc/info?mid=" + uid - resp, err := http.Get(url) - if err != nil { - panic(err) - } - defer resp.Body.Close() - result := &accInfo{} - if err := json.NewDecoder(resp.Body).Decode(result); err != nil { - panic(err) - } - return result -} - - -func follow(uid string) string { - - url := "https://api.bilibili.com/x/relation/same/followings?vmid=" + uid - method := "GET" - - client := &http.Client { - } - req, err := http.NewRequest(method, url, nil) - - if err != nil { - fmt.Println(err) - } - req.Header.Add("cookie", "CURRENT_FNVAL=80; _uuid=772B88E8-3ED1-D589-29BB-F6CB5214239A06137infoc; blackside_state=1; bfe_id=6f285c892d9d3c1f8f020adad8bed553; rpdid=|(umY~Jkl|kJ0J'uYkR|)lu|); fingerprint=0ec2b1140fb30b56d7b5e415bc3b5fb1; buvid_fp=C91F5265-3DF4-4D5A-9FF3-C546370B14C0143096infoc; buvid_fp_plain=C91F5265-3DF4-4D5A-9FF3-C546370B14C0143096infoc; SESSDATA=9e0266f6%2C1639637127%2Cb0172%2A61; bili_jct=96ddbd7e22d527abdc0501339a12d4d3; DedeUserID=695737880; DedeUserID__ckMd5=0117660e75db7b01; sid=5labuhaf; PVID=1; bfe_id=1e33d9ad1cb29251013800c68af42315") - - res, err := client.Do(req) - if err != nil { - fmt.Println(err) - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - fmt.Println(err) - } - return string(body) -} diff --git a/fensi/follower.go b/fensi/follower.go deleted file mode 100644 index 9694d272..00000000 --- a/fensi/follower.go +++ /dev/null @@ -1,76 +0,0 @@ -package fensi - -import ( - "encoding/json" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" - "net/http" - "strconv" - "time" -) - - - -func init() { - zero.OnRegex(`^/粉丝 (.{1,25})$`). - Handle(func(ctx *zero.Ctx) { - keyword := ctx.State["regex_matched"].([]string)[1] - uid := searchapi(keyword).Data.Result[0].Mid - fensijson := fensiapi(strconv.Itoa(uid)) - ctx.SendChain(message.Text( - "uid: ", fensijson.Mid, "\n", - "名字: ", fensijson.Uname, "\n", - "当前粉丝数: ", fensijson.Follower, "\n", - "24h涨粉数: ", fensijson.Rise, "\n", - "视频投稿数: ", fensijson.Video, "\n", - "直播间id: ", fensijson.Roomid, "\n", - "舰队: ", fensijson.GuardNum, "\n", - "直播总排名: ", fensijson.AreaRank, "\n", - "数据来源: ", "https://vtbs.moe/detail/", uid, "\n", - "数据获取时间: ", timeStamp(), - )) - }) -} - -func init() { - zero.OnRegex(`^/info (.{1,25})$`). - Handle(func(ctx *zero.Ctx) { - keyword := ctx.State["regex_matched"].([]string)[1] - uid := searchapi(keyword).Data.Result[0].Mid - fensijson := fensiapi(strconv.Itoa(uid)) - ctx.SendChain(message.Text( - "uid: ", fensijson.Mid, "\n", - "名字: ", fensijson.Uname, "\n", - "当前粉丝数: ", fensijson.Follower, "\n", - "24h涨粉数: ", fensijson.Rise, "\n", - "视频投稿数: ", fensijson.Video, "\n", - "直播间id: ", fensijson.Roomid, "\n", - "舰队: ", fensijson.GuardNum, "\n", - "直播总排名: ", fensijson.AreaRank, "\n", - "数据来源: ", "https://vtbs.moe/detail/", uid, "\n", - "数据获取时间: ", timeStamp(), - )) - }) -} - -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 -} - - -func timeStamp() string{ - unixtime := time.Now().Unix() - timestamp := time.Unix(unixtime, 0) - return timestamp.Format("2006-01-02 15:04:05") -} diff --git a/fensi/search.go b/fensi/search.go deleted file mode 100644 index d1a6c4a2..00000000 --- a/fensi/search.go +++ /dev/null @@ -1,57 +0,0 @@ -package fensi - -import ( - "encoding/json" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" - "net/http" -) - -func init() { - zero.OnRegex(`^/搜索 (.*)$`). - Handle(func(ctx *zero.Ctx) { - keyword := ctx.State["regex_matched"].([]string)[1] - searchJson := searchapi(keyword) - - if searchapi(keyword).Data.NumResults == 0 { - ctx.Send("名字没搜到") - return - } - - if searchapi(keyword).Data.NumResults < 5 { - ctx.SendChain(message.Text( - "uid: ", searchJson.Data.Result[0].Mid, "\n", - "name: ", searchJson.Data.Result[0].Uname, "\n", - )) - return - } - - ctx.SendChain(message.Text( - "搜索结果很多,请尽量准确关键字,以下为你返回前5条结果", "\n\n", - "uid1: ", searchJson.Data.Result[0].Mid, "\n", - "name1: ", searchJson.Data.Result[0].Uname, "\n\n", - "uid2: ", searchJson.Data.Result[1].Mid, "\n", - "name2: ", searchJson.Data.Result[1].Uname, "\n\n", - "uid3: ", searchJson.Data.Result[2].Mid, "\n", - "name3: ", searchJson.Data.Result[2].Uname, "\n\n", - "uid4: ", searchJson.Data.Result[3].Mid, "\n", - "name4: ", searchJson.Data.Result[3].Uname, "\n\n", - "uid5: ", searchJson.Data.Result[4].Mid, "\n", - "name5: ", searchJson.Data.Result[4].Uname, - )) - }) -} - -func searchapi(keyword string) *search { - url := "http://api.bilibili.com/x/web-interface/search/type?search_type=bili_user&&user_type=1&keyword=" + keyword - resp, err := http.Get(url) - if err != nil { - panic(err) - } - defer resp.Body.Close() - result := &search{} - if err := json.NewDecoder(resp.Body).Decode(result); err != nil { - panic(err) - } - return result -} diff --git a/fensi/structure.go b/fensi/structure.go deleted file mode 100644 index fc38e05e..00000000 --- a/fensi/structure.go +++ /dev/null @@ -1,235 +0,0 @@ -package fensi - -// 搜索api的json结构体 -type search struct { - Code int `json:"code"` - Message string `json:"message"` - TTL int `json:"ttl"` - Data struct { - Seid string `json:"seid"` - Page int `json:"page"` - Pagesize int `json:"pagesize"` - NumResults int `json:"numResults"` - NumPages int `json:"numPages"` - SuggestKeyword string `json:"suggest_keyword"` - RqtType string `json:"rqt_type"` - CostTime struct { - ParamsCheck string `json:"params_check"` - GetUpuserLiveStatus string `json:"get upuser live status"` - IllegalHandler string `json:"illegal_handler"` - AsResponseFormat string `json:"as_response_format"` - AsRequest string `json:"as_request"` - SaveCache string `json:"save_cache"` - DeserializeResponse string `json:"deserialize_response"` - AsRequestFormat string `json:"as_request_format"` - Total string `json:"total"` - MainHandler string `json:"main_handler"` - } `json:"cost_time"` - ExpList interface{} `json:"exp_list"` - EggHit int `json:"egg_hit"` - Result []struct { - Type string `json:"type"` - Mid int `json:"mid"` - Uname string `json:"uname"` - Usign string `json:"usign"` - Fans int `json:"fans"` - Videos int `json:"videos"` - Upic string `json:"upic"` - VerifyInfo string `json:"verify_info"` - Level int `json:"level"` - Gender int `json:"gender"` - IsUpuser int `json:"is_upuser"` - IsLive int `json:"is_live"` - RoomID int `json:"room_id"` - Res []struct { - Aid int `json:"aid"` - Bvid string `json:"bvid"` - Title string `json:"title"` - Pubdate int `json:"pubdate"` - Arcurl string `json:"arcurl"` - Pic string `json:"pic"` - Play string `json:"play"` - Dm int `json:"dm"` - Coin int `json:"coin"` - Fav int `json:"fav"` - Desc string `json:"desc"` - Duration string `json:"duration"` - IsPay int `json:"is_pay"` - IsUnionVideo int `json:"is_union_video"` - } `json:"res"` - OfficialVerify struct { - Type int `json:"type"` - Desc string `json:"desc"` - } `json:"official_verify"` - HitColumns []interface{} `json:"hit_columns"` - } `json:"result"` - ShowColumn int `json:"show_column"` - } `json:"data"` -} - -// 账号信息api的json结构体 -type accInfo struct { - Code int `json:"code"` - Message string `json:"message"` - TTL int `json:"ttl"` - Data struct { - Mid int `json:"mid"` - Name string `json:"name"` - Sex string `json:"sex"` - Face string `json:"face"` - Sign string `json:"sign"` - Rank int `json:"rank"` - Level int `json:"level"` - Jointime int `json:"jointime"` - Moral int `json:"moral"` - Silence int `json:"silence"` - Birthday string `json:"birthday"` - Coins int `json:"coins"` - FansBadge bool `json:"fans_badge"` - Official struct { - Role int `json:"role"` - Title string `json:"title"` - Desc string `json:"desc"` - Type int `json:"type"` - } `json:"official"` - Vip struct { - Type int `json:"type"` - Status int `json:"status"` - DueDate int64 `json:"due_date"` - VipPayType int `json:"vip_pay_type"` - ThemeType int `json:"theme_type"` - Label struct { - Path string `json:"path"` - Text string `json:"text"` - LabelTheme string `json:"label_theme"` - TextColor string `json:"text_color"` - BgStyle int `json:"bg_style"` - BgColor string `json:"bg_color"` - BorderColor string `json:"border_color"` - } `json:"label"` - AvatarSubscript int `json:"avatar_subscript"` - NicknameColor string `json:"nickname_color"` - Role int `json:"role"` - AvatarSubscriptURL string `json:"avatar_subscript_url"` - } `json:"vip"` - Pendant struct { - Pid int `json:"pid"` - Name string `json:"name"` - Image string `json:"image"` - Expire int `json:"expire"` - ImageEnhance string `json:"image_enhance"` - ImageEnhanceFrame string `json:"image_enhance_frame"` - } `json:"pendant"` - Nameplate struct { - Nid int `json:"nid"` - Name string `json:"name"` - Image string `json:"image"` - ImageSmall string `json:"image_small"` - Level string `json:"level"` - Condition string `json:"condition"` - } `json:"nameplate"` - UserHonourInfo struct { - Mid int `json:"mid"` - Colour interface{} `json:"colour"` - Tags interface{} `json:"tags"` - } `json:"user_honour_info"` - IsFollowed bool `json:"is_followed"` - TopPhoto string `json:"top_photo"` - Theme struct { - } `json:"theme"` - SysNotice struct { - } `json:"sys_notice"` - LiveRoom struct { - RoomStatus int `json:"roomStatus"` - LiveStatus int `json:"liveStatus"` - URL string `json:"url"` - Title string `json:"title"` - Cover string `json:"cover"` - Online int `json:"online"` - Roomid int `json:"roomid"` - RoundStatus int `json:"roundStatus"` - BroadcastType int `json:"broadcast_type"` - } `json:"live_room"` - } `json:"data"` -} - -//共同关注api的json结构体 -type followings struct { - Code int `json:"code"` - Message string `json:"message"` - TTL int `json:"ttl"` - Data struct { - List []struct { - Mid int `json:"mid"` - Attribute int `json:"attribute"` - Mtime int `json:"mtime"` - Tag interface{} `json:"tag"` - Special int `json:"special"` - ContractInfo struct { - IsContractor bool `json:"is_contractor"` - Ts int `json:"ts"` - IsContract bool `json:"is_contract"` - } `json:"contract_info"` - Uname string `json:"uname"` - Face string `json:"face"` - Sign string `json:"sign"` - OfficialVerify struct { - Type int `json:"type"` - Desc string `json:"desc"` - } `json:"official_verify"` - Vip struct { - VipType int `json:"vipType"` - VipDueDate int64 `json:"vipDueDate"` - DueRemark string `json:"dueRemark"` - AccessStatus int `json:"accessStatus"` - VipStatus int `json:"vipStatus"` - VipStatusWarn string `json:"vipStatusWarn"` - ThemeType int `json:"themeType"` - Label struct { - Path string `json:"path"` - Text string `json:"text"` - LabelTheme string `json:"label_theme"` - TextColor string `json:"text_color"` - BgStyle int `json:"bg_style"` - BgColor string `json:"bg_color"` - BorderColor string `json:"border_color"` - } `json:"label"` - AvatarSubscript int `json:"avatar_subscript"` - NicknameColor string `json:"nickname_color"` - AvatarSubscriptURL string `json:"avatar_subscript_url"` - } `json:"vip"` - } `json:"list"` - ReVersion int64 `json:"re_version"` - Total int `json:"total"` - } `json:"data"` -} - -// 粉丝信息api的json结构体 -type follower struct { - Mid int `json:"mid"` - UUID string `json:"uuid"` - Uname string `json:"uname"` - Video int `json:"video"` - Roomid int `json:"roomid"` - Sign string `json:"sign"` - Notice string `json:"notice"` - Face string `json:"face"` - Rise int `json:"rise"` - TopPhoto string `json:"topPhoto"` - ArchiveView int `json:"archiveView"` - Follower int `json:"follower"` - LiveStatus int `json:"liveStatus"` - RecordNum int `json:"recordNum"` - GuardNum int `json:"guardNum"` - LastLive struct { - Online int `json:"online"` - Time int64 `json:"time"` - } `json:"lastLive"` - GuardChange int `json:"guardChange"` - GuardType []int `json:"guardType"` - AreaRank int `json:"areaRank"` - Online int `json:"online"` - Title string `json:"title"` - Time int64 `json:"time"` - LiveStartTime int `json:"liveStartTime"` -} diff --git a/go.mod b/go.mod index ac02f9c3..8e344f40 100644 --- a/go.mod +++ b/go.mod @@ -5,15 +5,13 @@ go 1.16 require ( github.com/FloatTech/AnimeAPI v0.0.0-20210619112022-a8fdd4fefc07 github.com/FloatTech/ZeroBot-Plugin-Timer v1.2.2 - github.com/antchfx/xpath v1.2.0 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect + github.com/go-ole/go-ole v1.2.5 // indirect + github.com/shirou/gopsutil v3.21.5+incompatible github.com/sirupsen/logrus v1.8.1 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 github.com/tidwall/gjson v1.8.0 - github.com/tidwall/pretty v1.2.0 // indirect + github.com/tklauser/go-sysconf v0.3.6 // indirect github.com/wdvxdr1123/ZeroBot v1.2.1 - golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect - golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect - modernc.org/sqlite v1.10.8 + modernc.org/sqlite v1.11.1 ) diff --git a/go.sum b/go.sum index f8ee240d..6cb7ec20 100644 --- a/go.sum +++ b/go.sum @@ -2,20 +2,22 @@ github.com/FloatTech/AnimeAPI v0.0.0-20210619112022-a8fdd4fefc07 h1:7fBPLLoZysaa github.com/FloatTech/AnimeAPI v0.0.0-20210619112022-a8fdd4fefc07/go.mod h1:GYrQD70HvBzry1XiZ1tHFNOsOqRkR+ao4XGYZqV4I9c= github.com/FloatTech/ZeroBot-Plugin-Timer v1.2.2 h1:I7RSCsJVT6elehdaSiWB4n96y06fQxMsvAG494S5Od0= github.com/FloatTech/ZeroBot-Plugin-Timer v1.2.2/go.mod h1:femu/wVuqVSN/rg209qksMx8/2OKUF8l1PZCNg4RwVA= +github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 h1:5sXbqlSomvdjlRbWyNqkPsJ3Fg+tQZCbgeX1VGljbQY= +github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/antchfx/htmlquery v1.2.3 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M= github.com/antchfx/htmlquery v1.2.3/go.mod h1:B0ABL+F5irhhMWg54ymEZinzMSi0Kt3I2if0BLYa3V0= +github.com/antchfx/xpath v1.1.6 h1:6sVh6hB5T6phw1pFpHRQ+C4bd8sNI+O58flqtg7h0R0= github.com/antchfx/xpath v1.1.6/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= -github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8= -github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= @@ -37,9 +39,8 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2-0.20210109003243-333559e1834b h1:6Xjqolv/0DDdUqlpnsTomXQvjvvkz7Ux7TcMALvozEw= github.com/modern-go/reflect2 v1.0.2-0.20210109003243-333559e1834b/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -50,6 +51,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/shirou/gopsutil v3.21.5+incompatible h1:OloQyEerMi7JUrXiNzy8wQ5XN+baemxSl12QgIzt0jc= +github.com/shirou/gopsutil v3.21.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -66,26 +69,26 @@ github.com/tidwall/gjson v1.8.0 h1:Qt+orfosKn0rbNTZqHYDqBrmm3UDA4KRkv70fDzG+PQ= github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/Hmo4= +github.com/tklauser/go-sysconf v0.3.6/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/wdvxdr1123/ZeroBot v1.2.1 h1:ougeP+VOAGlQWCAUSB7fjA5trzEvPepU7pujsoYTCq8= github.com/wdvxdr1123/ZeroBot v1.2.1/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -93,21 +96,18 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa h1:ZYxPR6aca/uhfRJyaOAtflSHjJYiktO7QnJC5ut7iY4= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs= @@ -126,32 +126,33 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -modernc.org/cc/v3 v3.32.4/go.mod h1:0R6jl1aZlIl2avnYfbfHBS1QB6/f+16mihBObaBC878= -modernc.org/cc/v3 v3.33.5 h1:gfsIOmcv80EelyQyOHn/Xhlzex8xunhQxWiJRMYmPrI= -modernc.org/cc/v3 v3.33.5/go.mod h1:0R6jl1aZlIl2avnYfbfHBS1QB6/f+16mihBObaBC878= -modernc.org/ccgo/v3 v3.9.2/go.mod h1:gnJpy6NIVqkETT+L5zPsQFj7L2kkhfPMzOghRNv/CFo= -modernc.org/ccgo/v3 v3.9.4 h1:mt2+HyTZKxva27O6T4C9//0xiNQ/MornL3i8itM5cCs= -modernc.org/ccgo/v3 v3.9.4/go.mod h1:19XAY9uOrYnDhOgfHwCABasBvK69jgC4I8+rizbk3Bc= +lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU= +lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= +modernc.org/cc/v3 v3.33.6 h1:r63dgSzVzRxUpAJFPQWHy1QeZeY1ydNENUDaBx1GqYc= +modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/ccgo/v3 v3.9.5 h1:dEuUSf8WN51rDkprFuAqjfchKEzN0WttP/Py3enBwjk= +modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= -modernc.org/libc v1.9.5 h1:zv111ldxmP7DJ5mOIqzRbza7ZDl3kh4ncKfASB2jIYY= -modernc.org/libc v1.9.5/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= +modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= +modernc.org/libc v1.9.11 h1:QUxZMs48Ahg2F7SN41aERvMfGLY2HU/ADnB9DC4Yts8= +modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q= modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.2.2 h1:+yFk8hBprV+4c0U9GjFtL+dV3N8hOJ8JCituQcMShFY= modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/mathutil v1.4.0 h1:GCjoRaBew8ECCKINQA2nYjzvufFW9YiEuuB+rQ9bn2E= +modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/memory v1.0.4 h1:utMBrFcpnQDdNsmM6asmyH/FM9TqLPS7XF7otpJmrwM= modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A= modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.10.8 h1:tZzV+/FwlSBddiJAHLR+qxsw2nx7jpLMKOCVu6NTjxI= -modernc.org/sqlite v1.10.8/go.mod h1:k45BYY2DU82vbS/dJ24OzHCtjPeMEcZ1DV2POiE8nRs= -modernc.org/strutil v1.1.0 h1:+1/yCzZxY2pZwwrsbH+4T7BQMoLQ9QiBshRC9eicYsc= -modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= -modernc.org/tcl v1.5.2 h1:sYNjGr4zK6cDH74USl8wVJRrvDX6UOLpG0j4lFvR0W0= -modernc.org/tcl v1.5.2/go.mod h1:pmJYOLgpiys3oI4AeAafkcUfE+TKKilminxNyU/+Zlo= +modernc.org/sqlite v1.11.1 h1:SSLaty1rFr9JhVH/Usm2BxzlzaCtf0GhTJ/MJ32GU3Y= +modernc.org/sqlite v1.11.1/go.mod h1:+mhs/P1ONd+6G7hcAs6irwDi/bjTQ7nLW6LHRBsEa3A= +modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs= +modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= +modernc.org/tcl v1.5.5 h1:N03RwthgTR/l/eQvz3UjfYnvVVj1G2sZqzFGfoD4HE4= +modernc.org/tcl v1.5.5/go.mod h1:ADkaTUuwukkrlhqwERyq0SM8OvyXo7+TjFz7yAF56EI= modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= modernc.org/z v1.0.1 h1:WyIDpEpAIx4Hel6q/Pcgj/VhaQV5XPJ2I6ryIYbjnpc= modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= diff --git a/main.go b/main.go index 6825c5fe..69ed8aaa 100644 --- a/main.go +++ b/main.go @@ -15,18 +15,22 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode" // 在线运行代码 // 娱乐类 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定 //_ "github.com/FloatTech/ZeroBot-ACGImage" //简易随机图片 - // 嘉然相关 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana" // 嘉心糖发病 + // b站相关 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili" // 查询b站用户信息 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana" // 嘉心糖发病 // 二次元图片 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon" // lolicon 随机图片 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao" // 以图搜图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_image_finder" // 关键字搜图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon" // lolicon 随机图片 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_rand_image" // 随机图片 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao" // 以图搜图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图 // 以下为内置依赖,勿动 zero "github.com/wdvxdr1123/ZeroBot" diff --git a/plugin_ai_false/ai_false.go b/plugin_ai_false/ai_false.go new file mode 100644 index 00000000..b0421852 --- /dev/null +++ b/plugin_ai_false/ai_false.go @@ -0,0 +1,44 @@ +/* +暂时只有服务器监控 +*/ +package plugin_ai_false + +import ( + "math" + "time" + + "github.com/shirou/gopsutil/cpu" + "github.com/shirou/gopsutil/disk" + "github.com/shirou/gopsutil/mem" + + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) + +func init() { // 插件主体 + zero.OnFullMatchGroup([]string{"检查身体", "自检", "启动自检", "系统状态"}, zero.AdminPermission). + Handle(func(ctx *zero.Ctx) { + ctx.SendChain(message.Text( + "* CPU占用率: ", getCpuPercent(), "%\n", + "* RAM占用率: ", getMemPercent(), "%\n", + "* 硬盘活动率: ", getDiskPercent(), "%", + ), + ) + }) +} + +func getCpuPercent() float64 { + percent, _ := cpu.Percent(time.Second, false) + return math.Round(percent[0]) +} + +func getMemPercent() float64 { + memInfo, _ := mem.VirtualMemory() + return math.Round(memInfo.UsedPercent) +} + +func getDiskPercent() float64 { + parts, _ := disk.Partitions(true) + diskInfo, _ := disk.Usage(parts[0].Mountpoint) + return math.Round(diskInfo.UsedPercent) +} diff --git a/plugin_bilibili/info.go b/plugin_bilibili/info.go new file mode 100644 index 00000000..b132f486 --- /dev/null +++ b/plugin_bilibili/info.go @@ -0,0 +1,52 @@ +package fensi + +import ( + "fmt" + "io/ioutil" + "net/http" + + "github.com/tidwall/gjson" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) + +func init() { + zero.OnRegex(`^>bili info\s(.{1,25})$`). + Handle(func(ctx *zero.Ctx) { + keyword := ctx.State["regex_matched"].([]string)[1] + res, err := uid(keyword) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + id := res.Get("data.result.0.mid").Int() + url := fmt.Sprintf("https://api.bilibili.com/x/relation/same/followings?vmid=%d", id) + client := &http.Client{} + req, err := http.NewRequest("GET", url, nil) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + req.Header.Add("cookie", "CURRENT_FNVAL=80; _uuid=772B88E8-3ED1-D589-29BB-F6CB5214239A06137infoc; blackside_state=1; bfe_id=6f285c892d9d3c1f8f020adad8bed553; rpdid=|(umY~Jkl|kJ0J'uYkR|)lu|); fingerprint=0ec2b1140fb30b56d7b5e415bc3b5fb1; buvid_fp=C91F5265-3DF4-4D5A-9FF3-C546370B14C0143096infoc; buvid_fp_plain=C91F5265-3DF4-4D5A-9FF3-C546370B14C0143096infoc; SESSDATA=9e0266f6%2C1639637127%2Cb0172%2A61; bili_jct=96ddbd7e22d527abdc0501339a12d4d3; DedeUserID=695737880; DedeUserID__ckMd5=0117660e75db7b01; sid=5labuhaf; PVID=1; bfe_id=1e33d9ad1cb29251013800c68af42315") + resp, err := client.Do(req) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + resp.Body.Close() + if resp.StatusCode != http.StatusOK { + ctx.SendChain(message.Text("ERROR: code ", resp.StatusCode)) + return + } + data, _ := ioutil.ReadAll(resp.Body) + json := gjson.ParseBytes(data) + ctx.SendChain(message.Text( + "uid: ", res.Get("data.result.0.mid").Int(), "\n", + "name: ", res.Get("data.result.0.uname").Str, "\n", + "sex: ", []string{"", "", "女", "男"}[res.Get("data.result.0.gender").Int()], "\n", + "sign: ", res.Get("data.result.0.usign").Str, "\n", + "level: ", res.Get("data.result.0.level").Int(), "\n", + "follow: ", json.Get("data.list.#.uname"), + )) + }) +} diff --git a/plugin_bilibili/live_info.go b/plugin_bilibili/live_info.go new file mode 100644 index 00000000..2158dc7a --- /dev/null +++ b/plugin_bilibili/live_info.go @@ -0,0 +1,70 @@ +package fensi + +import ( + "errors" + "fmt" + "io/ioutil" + "net/http" + "time" + + "github.com/tidwall/gjson" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) + +func init() { + zero.OnRegex(`^>bili info\s?(.{1,25})$`). + Handle(func(ctx *zero.Ctx) { + keyword := ctx.State["regex_matched"].([]string)[1] + res, err := uid(keyword) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + id := res.Get("data.result.0.mid").Int() + // 获取详情 + api := fmt.Sprintf("https://api.vtbs.moe/v1/detail/%d", id) + resp, err := http.Get(api) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + resp.Body.Close() + if resp.StatusCode != http.StatusOK { + ctx.SendChain(message.Text("ERROR: code ", resp.StatusCode)) + return + } + data, _ := ioutil.ReadAll(resp.Body) + json := gjson.ParseBytes(data) + ctx.SendChain(message.Text( + "uid: ", json.Get("mid").Int(), "\n", + "名字: ", json.Get("uname").Str, "\n", + "当前粉丝数: ", json.Get("follower").Int(), "\n", + "24h涨粉数: ", json.Get("rise").Int(), "\n", + "视频投稿数: ", json.Get("video").Int(), "\n", + "直播间id: ", json.Get("roomid").Int(), "\n", + "舰队: ", json.Get("guardNum").Int(), "\n", + "直播总排名: ", json.Get("areaRank").Int(), "\n", + "数据来源: ", "https://vtbs.moe/detail/", uid, "\n", + "数据获取时间: ", time.Now().Format("2006-01-02 15:04:05"), + )) + }) +} + +func uid(keyword string) (gjson.Result, error) { + api := "http://api.bilibili.com/x/web-interface/search/type?search_type=bili_user&&user_type=1&keyword=" + keyword + resp, err := http.Get(api) + if err != nil { + return gjson.Result{}, err + } + if resp.StatusCode != http.StatusOK { + return gjson.Result{}, errors.New("code not 200") + } + data, _ := ioutil.ReadAll(resp.Body) + resp.Body.Close() + json := gjson.ParseBytes(data) + if json.Get("data.numResults").Int() == 0 { + return gjson.Result{}, errors.New("查无此人") + } + return json, nil +} diff --git a/setutime/keyword.go b/plugin_image_finder/keyword.go similarity index 97% rename from setutime/keyword.go rename to plugin_image_finder/keyword.go index 1744f41d..ae7f93b5 100644 --- a/setutime/keyword.go +++ b/plugin_image_finder/keyword.go @@ -1,15 +1,15 @@ -package setutime +package plugin_image_finder import ( "encoding/json" "fmt" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" "math/rand" "net/http" "time" -) + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) type AutoGenerated struct { Illusts []struct { @@ -57,7 +57,6 @@ type AutoGenerated struct { SearchSpanLimit int `json:"search_span_limit"` } - func init() { zero.OnRegex(`^来张 (.*)$`, zero.AdminPermission). Handle(func(ctx *zero.Ctx) { @@ -67,19 +66,17 @@ func init() { rannum := Suiji() pom2 := soutujson.Illusts[rannum].ImageUrls.Large[19:] ctx.SendChain(message.Image(pom1 + pom2)) - }) + }) } - // 请求api func soutuapi(keyword string) *AutoGenerated { url := "https://api.pixivel.moe/pixiv?type=search&page=0&mode=partial_match_for_tags&word=" + keyword method := "GET" - client := &http.Client { - } + client := &http.Client{} req, err := http.NewRequest(method, url, nil) if err != nil { diff --git a/plugin_lolicon/lolicon.go b/plugin_lolicon/lolicon.go index ad3d9ef7..8330ba55 100644 --- a/plugin_lolicon/lolicon.go +++ b/plugin_lolicon/lolicon.go @@ -37,15 +37,18 @@ func init() { resp, err := http.Get(API) if err != nil { ctx.SendChain(message.Text("ERROR: ", err)) + continue } if resp.StatusCode != http.StatusOK { ctx.SendChain(message.Text("ERROR: code ", resp.StatusCode)) + continue } data, _ := ioutil.ReadAll(resp.Body) resp.Body.Close() json := gjson.ParseBytes(data) if e := json.Get("error").Str; e != "" { ctx.SendChain(message.Text("ERROR: ", e)) + continue } url := json.Get("data.0.urls.original").Str ctx.SendGroupMessage(0, message.Image(url)) diff --git a/setutime/classify.go b/plugin_rand_image/classify.go similarity index 99% rename from setutime/classify.go rename to plugin_rand_image/classify.go index 2a8e269c..9351a169 100644 --- a/setutime/classify.go +++ b/plugin_rand_image/classify.go @@ -1,4 +1,4 @@ -package setutime +package plugin_rand_image import ( "fmt" diff --git a/setutime/rand_image.go b/plugin_rand_image/rand_image.go similarity index 57% rename from setutime/rand_image.go rename to plugin_rand_image/rand_image.go index a46d14bc..ce38e597 100644 --- a/setutime/rand_image.go +++ b/plugin_rand_image/rand_image.go @@ -1,7 +1,9 @@ -package setutime +package plugin_rand_image import ( + "fmt" "strings" + "time" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" @@ -39,7 +41,7 @@ func init() { // 插件主体 ctx.Send("请稍后再试哦") } else { BLOCK_REQUEST = true - last_message_id := ctx.SendChain(message.Image(RANDOM_API_URL).Add("no_cache", "0")) + last_message_id := ctx.SendChain(message.Image(RANDOM_API_URL).Add("cache", "0")) last_group_id := ctx.Event.GroupID MsgofGrp[last_group_id] = last_message_id BLOCK_REQUEST = false @@ -57,18 +59,47 @@ func init() { // 插件主体 Handle(func(ctx *zero.Ctx) { Vote(ctx, 6) }) - /* - // 上传一张图进行评价 - zero.OnFullMatch("评价图片", MustHasPicture()).SetBlock(true).SetPriority(24). - Handle(func(ctx *zero.Ctx) { - if ctx.Event.GroupID > 0 { - ctx.Send("少女祈祷中......") - for _, pic := range ctx.State["image_url"].([]string) { - fmt.Println(pic) - Classify(ctx, pic, true) + // 上传一张图进行评价 + zero.OnFullMatch("评价图片").SetBlock(true).SetPriority(24). + Handle(func(ctx *zero.Ctx) { + // 匹配图片 + rule := func() zero.Rule { + return func(ctx *zero.Ctx) bool { + var urls = []string{} + for _, elem := range ctx.Event.Message { + if elem.Type == "image" { + urls = append(urls, elem.Data["url"]) + } } + if len(urls) > 0 { + ctx.State["image_url"] = urls + return true + } + return false } + } + // 索取图片 + ctx.SendChain(message.Text("请发送一张图片")) + next := zero.NewFutureEvent("message", 999, false, zero.CheckUser(ctx.Event.UserID), rule()) + recv, cancel := next.Repeat() + select { + case <-time.After(time.Second * 120): return - }) - */ + case e := <-recv: + cancel() + newCtx := &zero.Ctx{Event: e, State: zero.State{}} + if rule()(newCtx) { + ctx.State["image_url"] = newCtx.State["image_url"] + } + } + if ctx.Event.GroupID > 0 { + ctx.Send("少女祈祷中......") + for _, pic := range ctx.State["image_url"].([]string) { + fmt.Println(pic) + Classify(ctx, pic, true) + } + } + return + }) + }