Skip to content

Commit

Permalink
✏️ 美化 log & 更新 banner
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Sep 27, 2021
1 parent 3623a88 commit 4844233
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import (
var (
contents = []string{
"* 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",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}
Expand Down
35 changes: 20 additions & 15 deletions plugin_reborn/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package reborn
import (
"encoding/json"
"io"
"log"
"net/http"
"os"
"time"

wr "github.com/mroth/weightedrand"
log "github.com/sirupsen/logrus"
)

const (
Expand All @@ -26,20 +27,24 @@ var (
)

func init() {
area := make(rate, 226)
err := load(&area)
if err != nil {
panic(err)
}
choices := make([]wr.Choice, len(area))
for i, a := range area {
choices[i].Item = a.Name
choices[i].Weight = uint(a.Weight * 1e9)
}
areac, err = wr.NewChooser(choices...)
if err != nil {
panic(err)
}
go func() {
time.Sleep(time.Second)
area := make(rate, 226)
err := load(&area)
if err != nil {
panic(err)
}
choices := make([]wr.Choice, len(area))
for i, a := range area {
choices[i].Item = a.Name
choices[i].Weight = uint(a.Weight * 1e9)
}
areac, err = wr.NewChooser(choices...)
if err != nil {
panic(err)
}
log.Printf("[Reborn] 读取%d个国家/地区", len(area))
}()
}

// load 加载rate数据
Expand Down

0 comments on commit 4844233

Please sign in to comment.