Documentation
¶
Overview ¶
Package protocol (context.go): plugin context interface. Plugins use Context for all sending and protocol operations; the implementation is provided by each protocol (e.g. onebotv11, zerobot).
Package protocol defines protocol-agnostic unified message types (Segment, Message) and the plugin context interface. Protocol-specific implementations live in subpackages (e.g. onebotv11, zerobot).
Index ¶
Constants ¶
View Source
const ( SegmentTypeText = "text" SegmentTypeFace = "face" SegmentTypeImage = "image" SegmentTypeRecord = "record" SegmentTypeVideo = "video" SegmentTypeAt = "at" SegmentTypeRps = "rps" SegmentTypeDice = "dice" SegmentTypeShake = "shake" SegmentTypePoke = "poke" SegmentTypeAnonymous = "anonymous" SegmentTypeContact = "contact" SegmentTypeLocation = "location" SegmentTypeMusic = "music" SegmentTypeReply = "reply" SegmentTypeForward = "forward" SegmentTypeNode = "node" SegmentTypeXML = "xml" SegmentTypeJSON = "json" )
Segment type constants (aligned with OneBot v11; used as canonical segment kinds).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface {
// Send sends a unified message. The implementation translates it to the protocol format and performs the send.
Send(msg Message) error
// Reply sends a reply to the current message (e.g. prepends reply segment or uses reply API).
Reply(msg Message) error
// UserID returns the sender user ID of the current event.
UserID() string
// GroupID returns the group ID when in a group chat, or empty/"0" for private chat.
GroupID() string
// IncomingMessage returns the current event message as unified Message.
IncomingMessage() Message
// PlainText returns the plain text of the current message (no CQ/media).
PlainText() string
// MessageID returns the current event message_id (for reply/recall).
MessageID() string
// RawMessage returns the original raw_message string from the event.
RawMessage() string
// SenderNickname returns the sender display name (nickname or card per OneBot sender).
SenderNickname() string
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package onebotv11 provides OneBot v11 protocol compatibility: builders, CQ code, JSON, and Context implementation.
|
Package onebotv11 provides OneBot v11 protocol compatibility: builders, CQ code, JSON, and Context implementation. |
|
Package zerobot provides protocol.Context implementation by wrapping ZeroBot's *zero.Ctx.
|
Package zerobot provides protocol.Context implementation by wrapping ZeroBot's *zero.Ctx. |
Click to show internal directories.
Click to hide internal directories.