message

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PushIncomingMsg added in v1.2.0

func PushIncomingMsg(newMsg Message)

Push a new message to plugins.

func PushResultMsg added in v1.2.0

func PushResultMsg(resultMsg Message)

Push a result message to adapter.

Types

type Message

type Message struct {
	// UID of sender.
	SenderID string
	// UID of the receiver. If IsGroup, ReceiverID is bot's ID
	ReceiverID string

	// Whether it is a group message.
	IsGroup bool
	// If the message contains @at_bot
	IsToMe bool
	// Group ID
	GroupID string

	// Message segments
	Segments []MessageSegment

	// Raw message if you want to decode yourself.
	RawMessage string
}

Gonebot Universal message struct.

func GetIncomingMsg added in v1.2.0

func GetIncomingMsg() Message

Pop a new message for plugins to handle.

func GetResultMsg added in v1.2.0

func GetResultMsg() Message

Pop a result message to send.

func (*Message) AddImageSegment added in v1.2.0

func (m *Message) AddImageSegment(img string)

func (*Message) AddSoundSegment added in v1.2.0

func (m *Message) AddSoundSegment(sound string)

func (*Message) AddTextSegment added in v1.2.0

func (m *Message) AddTextSegment(text string)

func (*Message) AddVideoSegment added in v1.2.0

func (m *Message) AddVideoSegment(video string)

func (*Message) GetText added in v1.2.0

func (m *Message) GetText() string

func (*Message) HasPrefix added in v1.2.2

func (m *Message) HasPrefix(prefix string) bool

type MessageSegment

type MessageSegment struct {
	// Type: text,image,video,sound,action.
	Type string
	// Content of the message.
	Content string
}

Jump to

Keyboard shortcuts

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