github.com/fumiama/NanoBot@v0.0.0-20231122134259-c22d8183efca/opcode.go (about)

     1  package nano
     2  
     3  import "encoding/json"
     4  
     5  // OpCode https://bot.q.qq.com/wiki/develop/api/gateway/opcode.html
     6  type OpCode int
     7  
     8  const (
     9  	OpCodeDispatch  OpCode = iota // Receive
    10  	OpCodeHeartbeat               // Send/Receive
    11  	OpCodeIdentify                // Send
    12  	OpCodeEmpty1
    13  	OpCodeEmpty2
    14  	OpCodeEmpty3
    15  	OpCodeResume    // Send
    16  	OpCodeReconnect // Receive
    17  	OpCodeEmpty4
    18  	OpCodeInvalidSession  // Receive
    19  	OpCodeHello           // Receive
    20  	OpCodeHeartbeatACK    // Receive/Reply
    21  	OpCodeHTTPCallbackACK // Reply
    22  )
    23  
    24  // OpCodeIdentifyMessage https://bot.q.qq.com/wiki/develop/api/gateway/reference.html#_2-%E9%89%B4%E6%9D%83%E8%BF%9E%E6%8E%A5
    25  type OpCodeIdentifyMessage struct {
    26  	Token      string          `json:"token"`
    27  	Intents    uint32          `json:"intents"`
    28  	Shard      [2]byte         `json:"shard"`
    29  	Properties json.RawMessage `json:"properties"`
    30  }