1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-08 12:10:23 +08:00

finish bot 框架

This commit is contained in:
源文雨
2023-10-15 15:23:18 +09:00
parent d7168b679b
commit 6a42e70f55
3 changed files with 91 additions and 43 deletions

View File

@@ -12,10 +12,15 @@ import (
type WebsocketPayload struct {
Op OpCode `json:"op"`
D json.RawMessage `json:"d,omitempty"`
S int `json:"s,omitempty"`
S uint32 `json:"s,omitempty"`
T string `json:"t,omitempty"`
}
// Reset 恢复到 0 值
func (wp *WebsocketPayload) Reset() {
*wp = WebsocketPayload{}
}
// GetHeartbeatInterval OpCodeHello 获得心跳周期 单位毫秒
func (wp *WebsocketPayload) GetHeartbeatInterval() (uint32, error) {
if wp.Op != OpCodeHello {