wsclient

package
v0.0.0-...-91ab160 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TruncateMessage

func TruncateMessage(message callapi.ActionMessage, maxLength int) string

截断信息

func WaitForActionMessage

func WaitForActionMessage(echo string, timeout time.Duration) (*callapi.ActionMessage, error)

WaitForActionMessage 等待特定echo值的消息或超时

func WaitForGeneralMessage

func WaitForGeneralMessage(timeout time.Duration) (*callapi.ActionMessage, error)

Types

type WebSocketClient

type WebSocketClient struct {
	Context *core.Context
	// contains filtered or unexported fields
}

func NewWebSocketClient

func NewWebSocketClient(urlStr string, botID string, maxRetryAttempts int) (*WebSocketClient, error)

NewWebSocketClient 创建 WebSocketClient 实例,接受 WebSocket URL、botID 和 core.Context 指针

func (*WebSocketClient) Close

func (ws *WebSocketClient) Close() error

func (*WebSocketClient) Reconnect

func (client *WebSocketClient) Reconnect()

断线重连

func (*WebSocketClient) SendMessage

func (client *WebSocketClient) SendMessage(message map[string]interface{}) error

发送json信息给onebot应用端

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL