github.com/Mrs4s/go-cqhttp@v1.2.0/pkg/onebot/onebot.go (about) 1 package onebot 2 3 // Self 机器人自身标识 4 // 5 // https://12.onebot.dev/connect/data-protocol/basic-types/#_10 6 type Self struct { 7 Platform string `json:"platform"` 8 UserID string `json:"user_id"` 9 } 10 11 // Request 动作请求是应用端为了主动向 OneBot 实现请求服务而发送的数据 12 // 13 // https://12.onebot.dev/connect/data-protocol/action-request/ 14 type Request struct { 15 Action string // 动作名称 16 Params any // 动作参数 17 Echo any // 每次请求的唯一标识 18 } 19 20 // Response 动作响应是 OneBot 实现收到应用端的动作请求并处理完毕后,发回应用端的数据 21 // 22 // https://12.onebot.dev/connect/data-protocol/action-response/ 23 type Response struct { 24 Status string `json:"status"` // 执行状态,必须是 ok、failed 中的一个 25 Code int64 `json:"retcode"` // 返回码 26 Data any `json:"data"` // 响应数据 27 Message string `json:"message"` // 错误信息 28 Echo any `json:"echo"` // 动作请求中的 echo 字段值 29 } 30 31 // Event 事件 32 // 33 // https://12.onebot.dev/connect/data-protocol/event/ 34 type Event struct { 35 ID string 36 Time int64 37 Type string 38 DetailType string 39 SubType string 40 Self *Self 41 }