1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

fix device

This commit is contained in:
wdvxdr 2023-02-20 14:06:08 +08:00
parent edfcd41ed6
commit 0c9f7a1f8f
2 changed files with 3 additions and 1 deletions

View File

@ -52,6 +52,7 @@ func readIfTTY(de string) (str string) {
}
var cli *client.QQClient
var device *client.DeviceInfo
// ErrSMSRequestError SMS请求出错
var ErrSMSRequestError = errors.New("sms request error")
@ -168,6 +169,7 @@ func loginResponseProcessor(res *client.LoginResponse) error {
cli.Disconnect()
cli.Release()
cli = client.NewClientEmpty()
cli.UseDevice(device)
return qrcodeLogin()
case client.NeedCaptcha:
log.Warnf("登录需要验证码.")

View File

@ -136,7 +136,6 @@ func Main() {
log.SetLevel(log.DebugLevel)
log.Warnf("已开启Debug模式.")
}
var device *client.DeviceInfo
if !global.PathExists("device.json") {
log.Warn("虚拟设备信息不存在, 将自动生成随机设备.")
device = client.GenRandomDevice()
@ -242,6 +241,7 @@ func Main() {
cli.Disconnect()
cli.Release()
cli = newClient()
cli.UseDevice(device)
} else {
isTokenLogin = true
}