diff --git a/cmd/gocq/main.go b/cmd/gocq/main.go index 38f60b839..c45a71a4d 100644 --- a/cmd/gocq/main.go +++ b/cmd/gocq/main.go @@ -13,7 +13,10 @@ import ( "sync" "time" + "github.com/LagrangeDev/LagrangeGo/client/packets/pb/action" + "github.com/LagrangeDev/LagrangeGo/utils" "github.com/LagrangeDev/LagrangeGo/utils/crypto" + "github.com/Mrs4s/go-cqhttp/internal/selfdiagnosis" "github.com/LagrangeDev/LagrangeGo/client/auth" @@ -325,11 +328,13 @@ func LoginInteract() { global.Check(cli.RefreshAllGroupsInfo(), true) GroupListLen := len(cli.GetCachedAllGroupsInfo()) log.Infof("共加载 %v 个群.", GroupListLen) - // TODO 设置在线状态 暂不支持? - // if uint(base.Account.Status) >= uint(len(allowStatus)) { - // base.Account.Status = 0 - //} - //cli.SetOnlineStatus(allowStatus[base.Account.Status]) + if uint(base.Account.Status) >= 3000 { + base.Account.Status = 10 + } + _ = cli.SetOnlineStatus(utils.Ternary(base.Account.Status >= 1000, action.SetStatus{ + Status: 10, + ExtStatus: uint32(base.Account.Status), + }, action.SetStatus{Status: uint32(base.Account.Status)})) servers.Run(coolq.NewQQBot(cli)) log.Info("资源初始化完成, 开始处理信息.") log.Info("アトリは、高性能ですから!") @@ -342,8 +347,7 @@ func LoginInteract() { func WaitSignal() { go func() { selfupdate.CheckUpdate() - // TODO 服务器连接质量测试 - // selfdiagnosis.NetworkDiagnosis(cli) + selfdiagnosis.NetworkDiagnosis(cli) }() <-global.SetupMainSignalHandler() diff --git a/go.mod b/go.mod index 17c20cfcb..d6c5a2b71 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/FloatTech/sqlite v1.6.3 - github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241128062531-bea32754985f + github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241129090211-e0fdf8ca5390 github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5 diff --git a/go.sum b/go.sum index aece5f857..8df9666ea 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/FloatTech/sqlite v1.6.3 h1:MQkqBNlkPuCoKQQgoNLuTL/2Ci3tBTFAnVYBdD0Wy4 github.com/FloatTech/sqlite v1.6.3/go.mod h1:zFbHzRfB+CJ+VidfjuVbrcin3DAz283F7hF1hIeHzpY= github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 h1:g4pTnDJUW4VbJ9NvoRfUvdjDrHz/6QhfN/LoIIpICbo= github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs= -github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241128062531-bea32754985f h1:arXQxi9PrzbK3d2dw9xvRFkn9jMqqd0dwziwO24dMhg= -github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241128062531-bea32754985f/go.mod h1:m7ydyvA8DKOg5c6iTFDfNtfIK9uhqXVJKRXl4mlGkTA= +github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241129090211-e0fdf8ca5390 h1:NIDdk9Z5ztBhWcLJc8WvXxRSgdSqZlikrFBU5pII78Q= +github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241129090211-e0fdf8ca5390/go.mod h1:m7ydyvA8DKOg5c6iTFDfNtfIK9uhqXVJKRXl4mlGkTA= github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a h1:aU1703IHxupjzipvhu16qYKLMR03e+8WuNR+JMsKfGU= github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a/go.mod h1:OZqLNXdYJHmx7aqq/T6wAdFEdoGm5nmIfC4kU7M8P8o= github.com/RomiChan/protobuf v0.1.1-0.20230204044148-2ed269a2e54d h1:/Xuj3fIiMY2ls1TwvPKmaqQrtJsPY+c9s+0lOScVHd8= diff --git a/internal/selfdiagnosis/diagnoses.go b/internal/selfdiagnosis/diagnoses.go index 35ddfe0e2..44a890c1b 100644 --- a/internal/selfdiagnosis/diagnoses.go +++ b/internal/selfdiagnosis/diagnoses.go @@ -1,15 +1,19 @@ // Package selfdiagnosis 自我诊断相关 package selfdiagnosis -/* +import ( + "github.com/LagrangeDev/LagrangeGo/client" + log "github.com/sirupsen/logrus" +) + // NetworkDiagnosis 诊断网络状态并输出结果 func NetworkDiagnosis(c *client.QQClient) { log.Infof("开始诊断网络情况") qualityInfo := c.ConnectionQualityTest() log.Debugf("聊天服务器连接延迟: %vms", qualityInfo.ChatServerLatency) log.Debugf("聊天服务器丢包率: %v%%", qualityInfo.ChatServerPacketLoss*10) - log.Debugf("长消息服务器连接延迟: %vms", qualityInfo.LongMessageServerLatency) - log.Debugf("长消息服务器响应延迟: %vms", qualityInfo.LongMessageServerResponseLatency) + //log.Debugf("长消息服务器连接延迟: %vms", qualityInfo.LongMessageServerLatency) + //log.Debugf("长消息服务器响应延迟: %vms", qualityInfo.LongMessageServerResponseLatency) log.Debugf("媒体服务器连接延迟: %vms", qualityInfo.SrvServerLatency) log.Debugf("媒体服务器丢包率: %v%%", qualityInfo.SrvServerPacketLoss*10) @@ -31,21 +35,21 @@ func NetworkDiagnosis(c *client.QQClient) { log.Warnf("警告: 本地连接聊天服务器丢包率为 %v%%, %v", qualityInfo.ChatServerPacketLoss*10, chatServerErrorMessage) } - if qualityInfo.LongMessageServerLatency > 1000 { - if qualityInfo.LongMessageServerLatency == 9999 { - log.Errorf("错误: 长消息服务器延迟测试失败, %v 如果您使用的腾讯云服务器, 请修改DNS到114.114.114.114", longMessageServerErrorMessage) - } else { - log.Warnf("警告: 长消息延迟为 %vms, 大于 1000ms, %v", qualityInfo.LongMessageServerLatency, longMessageServerErrorMessage) - } - } - - if qualityInfo.LongMessageServerResponseLatency > 2000 { - if qualityInfo.LongMessageServerResponseLatency == 9999 { - log.Errorf("错误: 长消息服务器响应延迟测试失败, %v 如果您使用的腾讯云服务器, 请修改DNS到114.114.114.114", longMessageServerErrorMessage) - } else { - log.Warnf("警告: 长消息响应延迟为 %vms, 大于 1000ms, %v", qualityInfo.LongMessageServerResponseLatency, longMessageServerErrorMessage) - } - } + //if qualityInfo.LongMessageServerLatency > 1000 { + // if qualityInfo.LongMessageServerLatency == 9999 { + // log.Errorf("错误: 长消息服务器延迟测试失败, %v 如果您使用的腾讯云服务器, 请修改DNS到114.114.114.114", longMessageServerErrorMessage) + // } else { + // log.Warnf("警告: 长消息延迟为 %vms, 大于 1000ms, %v", qualityInfo.LongMessageServerLatency, longMessageServerErrorMessage) + // } + //} + // + //if qualityInfo.LongMessageServerResponseLatency > 2000 { + // if qualityInfo.LongMessageServerResponseLatency == 9999 { + // log.Errorf("错误: 长消息服务器响应延迟测试失败, %v 如果您使用的腾讯云服务器, 请修改DNS到114.114.114.114", longMessageServerErrorMessage) + // } else { + // log.Warnf("警告: 长消息响应延迟为 %vms, 大于 1000ms, %v", qualityInfo.LongMessageServerResponseLatency, longMessageServerErrorMessage) + // } + //} if qualityInfo.SrvServerLatency > 1000 { if qualityInfo.SrvServerPacketLoss == 9999 { @@ -59,7 +63,11 @@ func NetworkDiagnosis(c *client.QQClient) { log.Warnf("警告: 本地连接媒体服务器丢包率为 %v%%, %v", qualityInfo.SrvServerPacketLoss*10, mediaServerErrorMessage) } - if qualityInfo.ChatServerLatency > 1000 || qualityInfo.ChatServerPacketLoss > 0 || qualityInfo.LongMessageServerLatency > 1000 || qualityInfo.SrvServerLatency > 1000 || qualityInfo.SrvServerPacketLoss > 0 { + if qualityInfo.ChatServerLatency > 1000 || + qualityInfo.ChatServerPacketLoss > 0 || + //qualityInfo.LongMessageServerLatency > 1000 || + qualityInfo.SrvServerLatency > 1000 || + qualityInfo.SrvServerPacketLoss > 0 { log.Infof("网络诊断完成. 发现问题, 请检查日志.") } else { log.Infof("网络诊断完成. 未发现问题") @@ -75,4 +83,3 @@ func DNSDiagnosis() { func EnvironmentDiagnosis() { // todo } -*/ diff --git a/modules/config/default_config.yml b/modules/config/default_config.yml index b94cb5000..f9663daa2 100644 --- a/modules/config/default_config.yml +++ b/modules/config/default_config.yml @@ -26,8 +26,8 @@ account: # 账号相关 # # 服务器不提供自建 sign-servers: - - url: 'https://sign.ciallo.site/api/sign' # 主签名服务器地址, 必填 - - url: 'https://sign.lagrangecore.org/api/sign/25765' # 备用 + - url: '-' # 主签名服务器地址, 必填 + - url: '-' # 备用 # 连续寻找可用签名服务器最大尝试次数 # 为 0 时会在连续 3 次没有找到可用签名服务器后保持使用主签名服务器,不再尝试进行切换备用