mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
client: use %x
placeholder
This commit is contained in:
parent
436482c7db
commit
714961d68f
@ -2,7 +2,7 @@ package client
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
@ -903,7 +903,7 @@ func (c *QQClient) buildOffPicUpPacket(target int64, md5 []byte, size int32) (ui
|
||||
DstUin: proto.Uint64(uint64(target)),
|
||||
FileMd5: md5,
|
||||
FileSize: proto.Uint64(uint64(size)),
|
||||
FileName: []byte(hex.EncodeToString(md5) + ".jpg"),
|
||||
FileName: []byte(fmt.Sprintf("%x.jpg", md5)),
|
||||
SrcTerm: proto.Uint32(5),
|
||||
PlatformType: proto.Uint32(9),
|
||||
BuType: proto.Uint32(1),
|
||||
|
@ -2,7 +2,6 @@ package client
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -173,7 +172,7 @@ func decodeLoginResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []b
|
||||
}
|
||||
c.debug("unknown login response: %v", t)
|
||||
for k, v := range m {
|
||||
c.debug("Type: %v Value: %v", strconv.FormatInt(int64(k), 16), hex.EncodeToString(v))
|
||||
c.debug("Type: %d Value: %x", k, v)
|
||||
}
|
||||
return nil, errors.Errorf("unknown login response: %v", t) // ?
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ func (c *QQClient) GetGroupFileUrl(groupCode int64, fileId string, busId int32)
|
||||
return ""
|
||||
}
|
||||
url := i.(string)
|
||||
url += "?fname=" + hex.EncodeToString([]byte(fileId))
|
||||
url += fmt.Sprintf("?fname=%x", fileId)
|
||||
return url
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
@ -88,7 +88,7 @@ func (s *GuildService) QueryImage(guildId, channelId uint64, hash []byte, size u
|
||||
if body.IsExists {
|
||||
return &message.GuildImageElement{
|
||||
FileId: body.FileId,
|
||||
FilePath: hex.EncodeToString(hash) + ".jpg",
|
||||
FilePath: fmt.Sprintf("%x.jpg", hash),
|
||||
Size: int32(size),
|
||||
DownloadIndex: body.DownloadIndex,
|
||||
Width: body.Width,
|
||||
@ -177,7 +177,7 @@ func (c *QQClient) buildGuildImageStorePacket(guildId, channelId uint64, hash []
|
||||
FileId: proto.Uint64(0),
|
||||
FileMd5: hash,
|
||||
FileSize: &size,
|
||||
FileName: []byte(hex.EncodeToString(hash) + ".jpg"),
|
||||
FileName: []byte(fmt.Sprintf("%x.jpg", hash)),
|
||||
SrcTerm: proto.Uint32(5),
|
||||
PlatformType: proto.Uint32(9),
|
||||
BuType: proto.Uint32(211),
|
||||
|
@ -1,7 +1,7 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"strings"
|
||||
@ -154,7 +154,7 @@ ok:
|
||||
}
|
||||
return &message.GuildImageElement{
|
||||
FileId: rsp.FileId,
|
||||
FilePath: hex.EncodeToString(fh) + ".jpg",
|
||||
FilePath: fmt.Sprintf("%x.jpg", fh),
|
||||
Size: int32(length),
|
||||
DownloadIndex: rsp.DownloadIndex,
|
||||
Width: width,
|
||||
@ -214,7 +214,7 @@ func (c *QQClient) ImageOcr(img any) (*OcrResponse, error) {
|
||||
}
|
||||
_ = b.Close()
|
||||
}
|
||||
rsp, err := c.sendAndWait(c.buildImageOcrRequestPacket(url, strings.ToUpper(hex.EncodeToString(e.Md5)), e.Size, e.Width, e.Height))
|
||||
rsp, err := c.sendAndWait(c.buildImageOcrRequestPacket(url, fmt.Sprintf("%X", e.Md5), e.Size, e.Width, e.Height))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -399,7 +399,7 @@ func decodeGroupImageDownloadResponse(_ *QQClient, _ *network.IncomingPacketInfo
|
||||
if len(pkt.GetimgUrlRsp[0].FailMsg) != 0 {
|
||||
return nil, errors.New(utils.B2S(pkt.GetimgUrlRsp[0].FailMsg))
|
||||
}
|
||||
return "https://" + utils.B2S(pkt.GetimgUrlRsp[0].DownDomain) + utils.B2S(pkt.GetimgUrlRsp[0].BigDownPara), nil
|
||||
return fmt.Sprintf("https://%s%s", pkt.GetimgUrlRsp[0].DownDomain, pkt.GetimgUrlRsp[0].BigDownPara), nil
|
||||
}
|
||||
|
||||
// OidbSvc.0xe07_0
|
||||
|
@ -3,6 +3,7 @@ package client
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@ -90,7 +91,7 @@ func (c *QQClient) UploadVoice(target message.Source, voice io.ReadSeeker) (*mes
|
||||
FileType: proto.Int32(4),
|
||||
SrcUin: &c.Uin,
|
||||
FileMd5: fh,
|
||||
FileName: proto.String(hex.EncodeToString(fh) + ".amr"),
|
||||
FileName: proto.String(fmt.Sprintf("%x.amr", fh)),
|
||||
FileSize: proto.Int32(int32(length)),
|
||||
BoolValid: proto.Bool(true),
|
||||
}
|
||||
@ -259,7 +260,7 @@ func (c *QQClient) buildPttShortVideoProto(target message.Source, videoHash, thu
|
||||
ChatType: chatType,
|
||||
ClientType: 2,
|
||||
Info: &pttcenter.ShortVideoFileInfo{
|
||||
FileName: hex.EncodeToString(videoHash) + ".mp4",
|
||||
FileName: fmt.Sprintf("%x.mp4", videoHash),
|
||||
FileMd5: videoHash,
|
||||
ThumbFileMd5: thumbHash,
|
||||
FileSize: videoSize,
|
||||
|
@ -1,7 +1,6 @@
|
||||
package message
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
@ -126,7 +125,7 @@ func (e *ShortVideoElement) Pack() (r []*msg.Elem) {
|
||||
video := &msg.VideoFile{
|
||||
FileUuid: e.Uuid,
|
||||
FileMd5: e.Md5,
|
||||
FileName: []byte(hex.EncodeToString(e.Md5) + ".mp4"),
|
||||
FileName: []byte(fmt.Sprintf("%x.mp4", e.Md5)),
|
||||
FileFormat: proto.Int32(3),
|
||||
FileTime: proto.Int32(10),
|
||||
FileSize: proto.Int32(e.Size),
|
||||
|
Loading…
x
Reference in New Issue
Block a user