1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00
This commit is contained in:
wdvxdr 2020-10-03 22:18:38 +08:00
parent a7a1874ae5
commit 143177e68d
2 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ import (
"github.com/golang/protobuf/proto"
)
func (c *QQClient)buildTranslatePacket(src, dst, text string) (uint16, []byte) {
func (c *QQClient) buildTranslatePacket(src, dst, text string) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.TranslateReqBody{
BatchTranslateReq: &oidb.BatchTranslateReq{
@ -27,13 +27,13 @@ func (c *QQClient)buildTranslatePacket(src, dst, text string) (uint16, []byte) {
return seq, packet
}
func (c *QQClient)Translate(src, dst, text string) (string, error) {
func (c *QQClient) Translate(src, dst, text string) (string, error) {
rsp, err := c.sendAndWait(c.buildTranslatePacket(src, dst, text))
if err != nil {
return "",err
return "", err
}
if data, ok := rsp.(*oidb.BatchTranslateRsp); ok {
if data.ErrorCode != 0{
if data.ErrorCode != 0 {
return "", errors.New(string(data.ErrorMsg))
}
return data.DstTextList[0], nil