cqhttp

package
v0.0.0-...-d539b93 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_SEND_PRIVATE_MSG = "send_private_msg"
	API_SNED_GROUP_MSG   = "send_group_msg"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionSendGroupMsg

type ActionSendGroupMsg struct {
	CommonActionFields
	Params ParamsSendGroupMsg `json:"params"`
}

type ActionSendPrivateMsg

type ActionSendPrivateMsg struct {
	CommonActionFields
	Params ParamsSendPrivateMsg `json:"params"`
}

type CommonActionFields

type CommonActionFields struct {
	Action string `json:"action"`
	Echo   string `json:"echo,omitempty"`
}

type CommonPostFields

type CommonPostFields struct {
	// event
	Time int64 `json:"time"`
	// qq number of the robot
	SelfID int64 `json:"self_id"`
	// posted event type
	PostType PostType `json:"post_type"`
}

common fileds for posted event json

type CommonResponseFields

type CommonResponseFields struct {
	Status  string `json:"status"`
	RetCode int    `json:"retcode"`
	Msg     string `json:"msg"`
	Wording string `json:"wording"`
	Echo    string `json:"echo"`
}

type DataSendGroupMsg

type DataSendGroupMsg struct {
	MessageID int32 `json:"message_id"`
}

type DataSendPrivateMsg

type DataSendPrivateMsg struct {
	MessageID int32 `json:"message_id"`
}

type MessageType

type MessageType string
const (
	MESSAGE_TYPE_PRIVATE MessageType = "private"
	MESSAGE_TYPE_GROUP   MessageType = "group"
)

type ParamsSendGroupMsg

type ParamsSendGroupMsg struct {
	GroupID    int64  `json:"group_id"`
	Message    string `json:"message"`
	AutoEscape bool   `json:"auto_escape"`
}

api: send_group_msg

type ParamsSendPrivateMsg

type ParamsSendPrivateMsg struct {
	UserID     int64  `json:"user_id"`
	GroupID    int64  `json:"group_id,omitempty"`
	Message    string `json:"message"`
	AutoEscape bool   `json:"auto_escape"`
}

api: send_private_msg

type PostMessage

type PostMessage struct {
	CommonPostFields
	MessageType MessageType `json:"message_type"`
	SubType     string      `json:"sub_type"`
	MessageID   int32       `json:"message_id"`
	// the sender's qq number
	UserID int64 `json:"user_id"`
	// the group's qq number
	GroupID int64 `json:"group_id"`
	// the json structured message array
	Message []map[string]any `json:"message"`
	// the raw message string in cq code format
	RawMessage string `json:"raw_message"`
	Font       int    `json:"font"`
}

Message events are for things like group and private chat message

type PostMessageSent

type PostMessageSent PostMessage

The same as Message, but it's sent from bot.

type PostMetaEvent

type PostMetaEvent struct {
	CommonPostFields
	MetaEventType string `json:"meta_event_type"`
}

Meta Event events are for things like cqhttp heartbeat

type PostNotice

type PostNotice struct {
	CommonPostFields
	NoticeType string `json:"notice_type"`
}

Notice events are for things like group member notification

type PostRequest

type PostRequest struct {
	CommonPostFields
	RequestType string `json:"request_type"`
}

Request events are for things like making-friend request

type PostType

type PostType string

the posted event type

const (
	POST_TYPE_MESSAGE      PostType = "message"
	POST_TYPE_MESSAGE_SENT PostType = "message_sent"
	POST_TYPE_REQUEST      PostType = "request"
	POST_TYPE_NOTICE       PostType = "notice"
	POST_TYPE_META_EVENT   PostType = "meta_event"
)

type ResponseSendGroupMsg

type ResponseSendGroupMsg struct {
	CommonResponseFields
	Data DataSendGroupMsg `json:"data"`
}

type ResponseSendPrivateMsg

type ResponseSendPrivateMsg struct {
	CommonResponseFields
	Data DataSendPrivateMsg `json:"data"`
}

type WSClientHandler

type WSClientHandler struct {
}

func NewWSClientHandler

func NewWSClientHandler() *WSClientHandler

func (*WSClientHandler) HandleRead

func (h *WSClientHandler) HandleRead(c *ws.Conn) ([]byte, error)

func (*WSClientHandler) HandleWrite

func (h *WSClientHandler) HandleWrite(c *ws.Conn, msg []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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