mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
make lint happy
This commit is contained in:
parent
f466ca7a72
commit
dae03784cc
@ -13,6 +13,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Mrs4s/MiraiGo/client"
|
"github.com/Mrs4s/MiraiGo/client"
|
||||||
@ -398,10 +399,10 @@ func refreshToken(uin string) error {
|
|||||||
}
|
}
|
||||||
msg := gjson.GetBytes(resp, "msg")
|
msg := gjson.GetBytes(resp, "msg")
|
||||||
if gjson.GetBytes(resp, "code").Int() != 0 {
|
if gjson.GetBytes(resp, "code").Int() != 0 {
|
||||||
return errors.New(msg)
|
return errors.New(msg.String())
|
||||||
}
|
}
|
||||||
go callback(uin, gjson.GetBytes(resp, "data").Array(), "request token")
|
go callback(uin, gjson.GetBytes(resp, "data").Array(), "request token")
|
||||||
return true
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var missTokenCount = uint64(0)
|
var missTokenCount = uint64(0)
|
||||||
@ -423,7 +424,7 @@ func sign(seq uint64, uin string, cmd string, qua string, buff []byte) (sign []b
|
|||||||
defer registerLock.Unlock()
|
defer registerLock.Unlock()
|
||||||
err := destroySignServer(uin)
|
err := destroySignServer(uin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf(err)
|
log.Warnln(err)
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
register(base.Account.Uin, device.AndroidId, device.Guid, device.QImei36, base.Key)
|
register(base.Account.Uin, device.AndroidId, device.Guid, device.QImei36, base.Key)
|
||||||
@ -463,11 +464,7 @@ func destroySignServer(uin string) error {
|
|||||||
Method: http.MethodGet,
|
Method: http.MethodGet,
|
||||||
URL: signServer + "destroy" + fmt.Sprintf("?uin=%v&key=%v", uin, base.Key),
|
URL: signServer + "destroy" + fmt.Sprintf("?uin=%v&key=%v", uin, base.Key),
|
||||||
}.Bytes()
|
}.Bytes()
|
||||||
if err != nil {
|
if err != nil || gjson.GetBytes(resp, "code").Int() != 0 {
|
||||||
return errors.Wrapf(err, "destroy 实例出现错误, server: %v", signServer)
|
|
||||||
}
|
|
||||||
msg := gjson.GetBytes(resp, "msg")
|
|
||||||
if gjson.GetBytes(resp, "code").Int() != 0 {
|
|
||||||
return errors.Wrapf(err, "destroy 实例出现错误, server: %v", signServer)
|
return errors.Wrapf(err, "destroy 实例出现错误, server: %v", signServer)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -502,7 +499,7 @@ func startRefreshTokenTask(interval int64) {
|
|||||||
log.Warn("间隔时间不能超过 60 分钟,已自动设置为 60 分钟")
|
log.Warn("间隔时间不能超过 60 分钟,已自动设置为 60 分钟")
|
||||||
interval = 60
|
interval = 60
|
||||||
}
|
}
|
||||||
t := time.Newticker(time.Duration(interval) * time.Minute)
|
t := time.NewTicker(time.Duration(interval) * time.Minute)
|
||||||
defer t.Stop()
|
defer t.Stop()
|
||||||
for range t.C {
|
for range t.C {
|
||||||
err := refreshToken(strconv.FormatInt(base.Account.Uin, 10))
|
err := refreshToken(strconv.FormatInt(base.Account.Uin, 10))
|
||||||
@ -513,7 +510,7 @@ func startRefreshTokenTask(interval int64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func waitSignServer() bool {
|
func waitSignServer() bool {
|
||||||
t := time.NewTicker(time.Second*5)
|
t := time.NewTicker(time.Second * 5)
|
||||||
defer t.Stop()
|
defer t.Stop()
|
||||||
i := 0
|
i := 0
|
||||||
for range t.C {
|
for range t.C {
|
||||||
|
@ -1149,7 +1149,8 @@ func (bot *CQBot) CQDelGroupMemo(groupID int64, fid string) global.MSG {
|
|||||||
// @rename(msg->message, block->reject_add_request)
|
// @rename(msg->message, block->reject_add_request)
|
||||||
func (bot *CQBot) CQSetGroupKick(groupID int64, userID int64, msg string, block bool) global.MSG {
|
func (bot *CQBot) CQSetGroupKick(groupID int64, userID int64, msg string, block bool) global.MSG {
|
||||||
if g := bot.Client.FindGroup(groupID); g != nil {
|
if g := bot.Client.FindGroup(groupID); g != nil {
|
||||||
if m := g.FindMember(userID); m == nil {
|
m := g.FindMember(userID)
|
||||||
|
if m == nil {
|
||||||
return Failed(100, "MEMBER_IS_NOT_IN_GROUP", "人员不存在")
|
return Failed(100, "MEMBER_IS_NOT_IN_GROUP", "人员不存在")
|
||||||
}
|
}
|
||||||
err := m.Kick(msg, block)
|
err := m.Kick(msg, block)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user