diff --git a/.github/workflows/golint.yml b/.github/workflows/golint.yml index 61e4438..206a42c 100644 --- a/.github/workflows/golint.yml +++ b/.github/workflows/golint.yml @@ -14,15 +14,15 @@ jobs: with: go-version: 1.16 - - name: Tests - run: | - go test $(go list ./...) - - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: version: latest + - name: Tests + run: | + go test $(go list ./...) + - name: Commit back if: github.repository_owner == 'Mrs4s' continue-on-error: true diff --git a/coolq/bot.go b/coolq/bot.go index 4eb7a79..f37a6a7 100644 --- a/coolq/bot.go +++ b/coolq/bot.go @@ -343,9 +343,6 @@ func (bot *CQBot) SendPrivateMessage(target int64, groupID int64, m *message.Sen } log.Errorf("错误: 请先添加 %v(%v) 为好友", nickname, target) } - if id == -1 { - return -1 - } return id } diff --git a/login.go b/login.go index 845b448..94dfd27 100644 --- a/login.go +++ b/login.go @@ -83,16 +83,14 @@ func qrcodeLogin() error { continue } prevState = s.State - if s.State == client.QRCodeCanceled { + switch s.State { + case client.QRCodeCanceled: log.Fatalf("扫码被用户取消.") - } - if s.State == client.QRCodeTimeout { + case client.QRCodeTimeout: log.Fatalf("二维码过期") - } - if s.State == client.QRCodeWaitingForConfirm { + case client.QRCodeWaitingForConfirm: log.Infof("扫码成功, 请在手机端确认登录.") - } - if s.State == client.QRCodeConfirmed { + case client.QRCodeConfirmed: res, err := cli.QRCodeLogin(s.LoginInfo) if err != nil { return err