diff --git a/pkg/bot/bot.go b/pkg/bot/bot.go index 80677d1..3e2b4f7 100644 --- a/pkg/bot/bot.go +++ b/pkg/bot/bot.go @@ -11,8 +11,9 @@ import ( //go:generate go run github.com/a8m/syncmap -o "gen_client_map.go" -pkg bot -name ClientMap "map[int64]*client.QQClient" //go:generate go run github.com/a8m/syncmap -o "gen_token_map.go" -pkg bot -name TokenMap "map[int64][]byte" var ( - Clients ClientMap - LoginTokens TokenMap + Clients ClientMap + LoginTokens TokenMap + FrozenClient = make(map[int64]bool) ) func InitLog(cli *client.QQClient) { @@ -56,7 +57,7 @@ func SetRelogin(cli *client.QQClient, retryInterval int, retryCount int) { } bot.Disconnect() var times = 1 - for IsClientExist(bot.Uin) { + for IsClientExist(bot.Uin) && !FrozenClient[bot.Uin] { if bot.Online.Load() { log.Warn("Bot已登录") return diff --git a/pkg/bot/captcha.go b/pkg/bot/captcha.go index c2dc206..6b68b6d 100644 --- a/pkg/bot/captcha.go +++ b/pkg/bot/captcha.go @@ -128,6 +128,7 @@ func ProcessLoginRsp(cli *client.QQClient, rsp *client.LoginResponse) (bool, err } return ProcessLoginRsp(cli, rsp) case client.OtherLoginError, client.UnknownLoginError: + FrozenClient[cli.Uin] = true log.Errorf(rsp.ErrorMessage) log.Warnf("登陆失败,建议开启/关闭设备锁后重试,或删除device-.json文件后再次尝试") msg := rsp.ErrorMessage