✏️ 美化 log & 更新 banner

This commit is contained in:
fumiama 2021-09-27 21:31:38 +08:00
parent 3623a88b16
commit 48442330c1
2 changed files with 21 additions and 16 deletions

View File

@ -53,7 +53,7 @@ import (
var ( var (
contents = []string{ contents = []string{
"* OneBot + ZeroBot + Golang", "* OneBot + ZeroBot + Golang",
"* Version 1.1.5 - 2021-09-09 20:52:33 +0800 CST", "* Version 1.1.6 - 2021-09-27 21:30:33 +0800 CST",
"* Copyright © 2020 - 2021 Kanri, DawnNights, Fumiama, Suika", "* Copyright © 2020 - 2021 Kanri, DawnNights, Fumiama, Suika",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin", "* Project: https://github.com/FloatTech/ZeroBot-Plugin",
} }

View File

@ -3,11 +3,12 @@ package reborn
import ( import (
"encoding/json" "encoding/json"
"io" "io"
"log"
"net/http" "net/http"
"os" "os"
"time"
wr "github.com/mroth/weightedrand" wr "github.com/mroth/weightedrand"
log "github.com/sirupsen/logrus"
) )
const ( const (
@ -26,20 +27,24 @@ var (
) )
func init() { func init() {
area := make(rate, 226) go func() {
err := load(&area) time.Sleep(time.Second)
if err != nil { area := make(rate, 226)
panic(err) err := load(&area)
} if err != nil {
choices := make([]wr.Choice, len(area)) panic(err)
for i, a := range area { }
choices[i].Item = a.Name choices := make([]wr.Choice, len(area))
choices[i].Weight = uint(a.Weight * 1e9) for i, a := range area {
} choices[i].Item = a.Name
areac, err = wr.NewChooser(choices...) choices[i].Weight = uint(a.Weight * 1e9)
if err != nil { }
panic(err) areac, err = wr.NewChooser(choices...)
} if err != nil {
panic(err)
}
log.Printf("[Reborn] 读取%d个国家/地区", len(area))
}()
} }
// load 加载rate数据 // load 加载rate数据