1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 11:33:48 +08:00

修复机器人已登录但继续尝试登录的缺陷

This commit is contained in:
千橘雫霞 2020-10-01 09:23:55 +08:00
parent 83ce4e58a5
commit f5f3a314eb

View File

@ -303,10 +303,14 @@ func main() {
var times uint = 1
for {
if conf.ReLogin.MaxReloginTimes == 0 {
} else if times > conf.ReLogin.MaxReloginTimes {
if cli.Online {
log.Warn("Bot已登录")
return
}
if conf.ReLogin.MaxReloginTimes != 0 && times > conf.ReLogin.MaxReloginTimes {
break
}
log.Warnf("Bot已离线 (%v),将在 %v 秒后尝试重连. 重连次数:%v",
e.Message, conf.ReLogin.ReLoginDelay, times)
times++