github.com/Mrs4s/MiraiGo@v0.0.0-20240226124653-54bdd873e3fe/client/internal/network/packet.go (about)

     1  package network
     2  
     3  type Packet struct {
     4  	SequenceId  uint16
     5  	CommandName string
     6  	Payload     []byte
     7  	Params      RequestParams
     8  }
     9  
    10  type RequestParams map[string]any
    11  
    12  func (p RequestParams) Bool(k string) bool {
    13  	if p == nil {
    14  		return false
    15  	}
    16  	i, ok := p[k]
    17  	if !ok {
    18  		return false
    19  	}
    20  	return i.(bool)
    21  }
    22  
    23  func (p RequestParams) Int32(k string) int32 {
    24  	if p == nil {
    25  		return 0
    26  	}
    27  	i, ok := p[k]
    28  	if !ok {
    29  		return 0
    30  	}
    31  	return i.(int32)
    32  }