Skip to content

Commit

Permalink
chore: make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan04 committed Nov 11, 2024
1 parent 0c4067d commit e6d4af8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/gocq/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func printQRCode(imgData []byte) {

padding := 0
lastColor := img.At(padding, padding).(color.Gray).Y
for padding += 1; padding < bound; padding++ {
for padding++; padding < bound; padding++ {
if img.At(padding, padding).(color.Gray).Y != lastColor {
break
}
Expand Down
13 changes: 4 additions & 9 deletions coolq/cqcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func replyID(r *message.ReplyElement, source message.Source) int32 {
if source.SourceType == message.SourcePrivate && (r.SenderUin == uint32(source.PrimaryID) || r.GroupUin == uint32(source.PrimaryID) || r.GroupUin == 0) {
// 私聊似乎腾讯服务器有bug?
// ?
seq = seq
id = int64(r.SenderUin)
}
return db.ToGlobalID(id, int32(seq))
Expand Down Expand Up @@ -100,7 +99,7 @@ func toElements(e []message.IMessageElement, source message.Source) (r []msg.Ele
case *message.ReplyElement:
if base.RemoveReplyAt && i+1 < len(e) {
elem, ok := e[i+1].(*message.AtElement)
if ok && elem.TargetUin == uint32(o.SenderUin) {
if ok && elem.TargetUin == o.SenderUin {
e[i+1] = nil
}
}
Expand Down Expand Up @@ -187,10 +186,6 @@ func toElements(e []message.IMessageElement, source message.Source) (r []msg.Ele
Type: "image",
Data: data,
}
m = msg.Element{
Type: "image",
Data: data,
}
//case *message.FriendImageElement:
// data := pairs{
// {K: "file", V: hex.EncodeToString(o.Md5) + ".image"},
Expand Down Expand Up @@ -1005,13 +1000,13 @@ func (bot *CQBot) readImageCache(b []byte, sourceType message.SourceType) (messa
}
r := binary.NewReader(b)
hash := r.ReadBytes(16)
fileUuid := r.ReadStringWithLength("u32", true)
fileUUID := r.ReadStringWithLength("u32", true)
var rsp *message.ImageElement
switch sourceType { // nolint:exhaustive
case message.SourceGroup:
rsp, err = bot.Client.QueryGroupImage(hash, fileUuid)
rsp, err = bot.Client.QueryGroupImage(hash, fileUUID)
default:
rsp, err = bot.Client.QueryFriendImage(hash, fileUuid)
rsp, err = bot.Client.QueryFriendImage(hash, fileUUID)
}
if err != nil || rsp.URL == "" {
return nil, errors.New("unsuport error")
Expand Down
8 changes: 4 additions & 4 deletions coolq/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,17 @@ func (bot *CQBot) groupMutedEvent(c *client.QQClient, e *event2.GroupMute) {
if e.Duration == 0 {
typ = "notice/group_ban/lift_ban"
}
var userId uint32
var userID uint32
if target != nil {
userId = target.Uin
userID = target.Uin
} else {
userId = 0
userID = 0
}
bot.dispatchEvent(typ, global.MSG{
"duration": e.Duration,
"group_id": e.GroupUin,
"operator_id": operator.Uin,
"user_id": userId,
"user_id": userID,
})
}

Expand Down

0 comments on commit e6d4af8

Please sign in to comment.