diff --git a/cmd/gocq/login.go b/cmd/gocq/login.go index d0d9a33..244965a 100644 --- a/cmd/gocq/login.go +++ b/cmd/gocq/login.go @@ -29,7 +29,7 @@ func readLine() (str string) { return } -func readLineTimeout(t time.Duration, de string) (str string) { +func readLineTimeout(t time.Duration) { r := make(chan string) go func() { select { @@ -37,12 +37,10 @@ func readLineTimeout(t time.Duration, de string) (str string) { case <-time.After(t): } }() - str = de select { - case str = <-r: + case <-r: case <-time.After(t): } - return } func readIfTTY(de string) (str string) { @@ -210,7 +208,7 @@ func loginResponseProcessor(res *client.LoginResponse) error { case client.UnsafeDeviceError: log.Warnf("账号已开启设备锁,请前往 -> %v <- 验证后重启Bot.", res.VerifyUrl) log.Infof("按 Enter 或等待 5s 后继续....") - readLineTimeout(time.Second*5, "") + readLineTimeout(time.Second * 5) os.Exit(0) case client.OtherLoginError, client.UnknownLoginError, client.TooManySMSRequestError: msg := res.ErrorMessage @@ -221,7 +219,7 @@ func loginResponseProcessor(res *client.LoginResponse) error { } log.Warnf("登录失败: %v", msg) log.Infof("按 Enter 或等待 5s 后继续....") - readLineTimeout(time.Second*5, "") + readLineTimeout(time.Second * 5) os.Exit(0) } } diff --git a/coolq/api.go b/coolq/api.go index 9941fe1..1794cc6 100644 --- a/coolq/api.go +++ b/coolq/api.go @@ -14,12 +14,11 @@ import ( "strings" "time" - "github.com/segmentio/asm/base64" - "github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/client" "github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/utils" + "github.com/segmentio/asm/base64" log "github.com/sirupsen/logrus" "github.com/tidwall/gjson" diff --git a/coolq/bot.go b/coolq/bot.go index 388c781..8c8ade2 100644 --- a/coolq/bot.go +++ b/coolq/bot.go @@ -20,13 +20,12 @@ import ( "github.com/pkg/errors" "github.com/segmentio/asm/base64" log "github.com/sirupsen/logrus" + "golang.org/x/image/webp" "github.com/Mrs4s/go-cqhttp/db" "github.com/Mrs4s/go-cqhttp/global" "github.com/Mrs4s/go-cqhttp/internal/base" "github.com/Mrs4s/go-cqhttp/internal/mime" - - "golang.org/x/image/webp" ) // CQBot CQBot结构体,存储Bot实例相关配置 diff --git a/coolq/converter.go b/coolq/converter.go index e105357..30720e2 100644 --- a/coolq/converter.go +++ b/coolq/converter.go @@ -4,10 +4,9 @@ import ( "strconv" "strings" - "github.com/Mrs4s/MiraiGo/topic" - "github.com/Mrs4s/MiraiGo/client" "github.com/Mrs4s/MiraiGo/message" + "github.com/Mrs4s/MiraiGo/topic" log "github.com/sirupsen/logrus" "github.com/Mrs4s/go-cqhttp/global" diff --git a/coolq/cqcode/element.go b/coolq/cqcode/element.go index 2788ba2..87c057b 100644 --- a/coolq/cqcode/element.go +++ b/coolq/cqcode/element.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/Mrs4s/MiraiGo/binary" + "github.com/Mrs4s/go-cqhttp/global" ) diff --git a/modules/config/config.go b/modules/config/config.go index 24562e9..22d9879 100644 --- a/modules/config/config.go +++ b/modules/config/config.go @@ -55,7 +55,7 @@ type Config struct { RemoveReplyAt bool `yaml:"remove-reply-at"` ExtraReplyData bool `yaml:"extra-reply-data"` SkipMimeScan bool `yaml:"skip-mime-scan"` - ConvertWebpImage bool `yaml:"convert-webp-image"` + ConvertWebpImage bool `yaml:"convert-webp-image"` } `yaml:"message"` Output struct {