1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

fmt & fix do_restart

This commit is contained in:
wdvxdr 2020-11-09 23:17:36 +08:00
parent c2c7b96f1b
commit f59ce1480e
4 changed files with 5 additions and 4 deletions

View File

@ -42,7 +42,7 @@ func NewQQBot(cli *client.QQClient, conf *global.JsonConfig) *CQBot {
p := path.Join("data", "leveldb") p := path.Join("data", "leveldb")
db, err := leveldb.OpenFile(p, nil) db, err := leveldb.OpenFile(p, nil)
if err != nil { if err != nil {
log.Fatalf("打开数据库失败, 如果频繁遇到此问题请清理 data/db 文件夹或关闭数据库功能。") log.Fatalf("打开数据库失败, 如果频繁遇到此问题请清理 data/leveldb 文件夹或关闭数据库功能。")
} }
bot.db = db bot.db = db
gob.Register(message.Sender{}) gob.Register(message.Sender{})

View File

@ -124,4 +124,4 @@ func (wc *WriteCounter) Write(p []byte) (int, error) {
func (wc WriteCounter) PrintProgress() { func (wc WriteCounter) PrintProgress() {
fmt.Printf("\r%s", strings.Repeat(" ", 35)) fmt.Printf("\r%s", strings.Repeat(" ", 35))
fmt.Printf("\rDownloading... %s complete", humanize.Bytes(wc.Total)) fmt.Printf("\rDownloading... %s complete", humanize.Bytes(wc.Total))
} }

View File

@ -95,7 +95,7 @@ func main() {
console := bufio.NewReader(os.Stdin) console := bufio.NewReader(os.Stdin)
arg := os.Args arg := os.Args
if len(arg) >1 && arg[1] == "update"{ if len(arg) > 1 && arg[1] == "update" {
if len(arg) > 2 { if len(arg) > 2 {
selfUpdate(arg[2]) selfUpdate(arg[2])
} else { } else {
@ -390,4 +390,4 @@ func selfUpdate(imageUrl string) {
log.Info("按 Enter 继续....") log.Info("按 Enter 继续....")
readLine() readLine()
os.Exit(0) os.Exit(0)
} }

View File

@ -406,6 +406,7 @@ func (s *webServer) ReloadServer() {
// 热重启 // 热重启
func AdminDoRestart(s *webServer, c *gin.Context) { func AdminDoRestart(s *webServer, c *gin.Context) {
s.bot.Release()
s.bot = nil s.bot = nil
s.Cli = nil s.Cli = nil
s.DoReLogin() s.DoReLogin()