github.com/LagrangeDev/LagrangeGo@v0.0.0-20240512064304-ad4a85e10cb4/client/packet.go (about)

     1  package client
     2  
     3  // from https://github.com/Mrs4s/MiraiGo/blob/master/client/packet.go
     4  
     5  import (
     6  	"github.com/LagrangeDev/LagrangeGo/client/internal/network"
     7  )
     8  
     9  func (c *QQClient) uniPacket(command string, body []byte) (uint32, []byte) {
    10  	seq := c.getAndIncreaseSequence()
    11  	var sign map[string]string
    12  	if c.signProvider != nil {
    13  		sign = c.signProvider(command, seq, body)
    14  	}
    15  	req := network.Request{
    16  		SequenceID:  seq,
    17  		Uin:         int64(c.Uin),
    18  		Sign:        sign,
    19  		CommandName: command,
    20  		Body:        body,
    21  	}
    22  	return seq, c.transport.PackPacket(&req)
    23  }