Documentation
¶
Index ¶
- Constants
- type ActionSendGroupMsg
- type ActionSendPrivateMsg
- type CommonActionFields
- type CommonPostFields
- type CommonResponseFields
- type DataSendGroupMsg
- type DataSendPrivateMsg
- type MessageType
- type ParamsSendGroupMsg
- type ParamsSendPrivateMsg
- type PostMessage
- type PostMessageSent
- type PostMetaEvent
- type PostNotice
- type PostRequest
- type PostType
- type ResponseSendGroupMsg
- type ResponseSendPrivateMsg
- type WSClientHandler
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 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 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 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
Click to show internal directories.
Click to hide internal directories.