@@ -10,15 +10,12 @@ import (
10
10
"github.com/Coloured-glaze/gg"
11
11
"github.com/golang/freetype"
12
12
log "github.com/sirupsen/logrus"
13
- "github.com/tidwall/gjson"
14
13
"github.com/wcharczuk/go-chart/v2"
15
14
zero "github.com/wdvxdr1123/ZeroBot"
16
15
"github.com/wdvxdr1123/ZeroBot/message"
17
16
18
- "github.com/FloatTech/floatbox/binary"
19
17
"github.com/FloatTech/floatbox/file"
20
18
"github.com/FloatTech/floatbox/img/writer"
21
- "github.com/FloatTech/floatbox/web"
22
19
ctrl "github.com/FloatTech/zbpctrl"
23
20
"github.com/FloatTech/zbputils/control"
24
21
"github.com/FloatTech/zbputils/ctxext"
@@ -27,22 +24,22 @@ import (
27
24
)
28
25
29
26
const (
30
- backgroundURL = "https://mirlkoi.ifast3.vipnps.vip/api.php?sort=pc&type=json"
31
- referer = "https://iw233.cn/main.html"
32
- ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
27
+ backgroundURL = "https://img.moehu.org/pic.php?id=pc"
33
28
signinMax = 1
34
29
// SCOREMAX 分数上限定为120
35
30
SCOREMAX = 120
36
31
)
37
32
38
- var levelArray = [... ]int {0 , 1 , 2 , 5 , 10 , 20 , 35 , 55 , 75 , 100 , 120 }
39
-
40
- func init () {
41
- engine := control .Register ("score" , & ctrl.Options [* zero.Ctx ]{
33
+ var (
34
+ levelArray = [... ]int {0 , 1 , 2 , 5 , 10 , 20 , 35 , 55 , 75 , 100 , 120 }
35
+ engine = control .Register ("score" , & ctrl.Options [* zero.Ctx ]{
42
36
DisableOnDefault : false ,
43
37
Help : "签到得分\n - 签到\n - 获得签到背景[@xxx] | 获得签到背景\n - 查看分数排名" ,
44
38
PrivateDataFolder : "score" ,
45
39
})
40
+ )
41
+
42
+ func init () {
46
43
cachePath := engine .DataFolder () + "cache/"
47
44
go func () {
48
45
_ = os .RemoveAll (cachePath )
@@ -274,14 +271,5 @@ func initPic(picFile string) error {
274
271
if file .IsExist (picFile ) {
275
272
return nil
276
273
}
277
- data , err := web .RequestDataWith (web .NewDefaultClient (), backgroundURL , "GET" , referer , ua )
278
- if err != nil {
279
- return err
280
- }
281
- picURL := gjson .Get (binary .BytesToString (data ), "pic.0" ).Str
282
- data , err = web .RequestDataWith (web .NewDefaultClient (), picURL , "GET" , "" , ua )
283
- if err != nil {
284
- return err
285
- }
286
- return os .WriteFile (picFile , data , 0644 )
274
+ return file .DownloadTo (backgroundURL , picFile , true )
287
275
}
0 commit comments