pluginIO

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageChan chan Message
View Source
var OperatorMap map[string]func(Message)

Functions

func CommandRegister

func CommandRegister(cmdName string, handler func(Message))

func MessageRegister

func MessageRegister(callback func(Message))

func NoticeRegister

func NoticeRegister(noticeType string, handler func(Message))

func RandomString

func RandomString(length int) string

func SendApi

func SendApi(apiName string, data []byte, selfId int64) []byte

func SendApiEcho added in v0.2.1

func SendApiEcho(apiName string, data []byte, echo any, selfId int64) []byte

func SendMessage

func SendMessage[T string | []MessageItem](msg T, userId int64, groupId int64, selfId int64) (messageId []int)

func SendOperator added in v0.1.3

func SendOperator(target, operator string, args []string)

func SendPoke added in v0.1.1

func SendPoke(userId int64, groupId int64, selfId int64)

Types

type Message

type Message struct {
	Time          int64         `json:"time"`
	SelfId        int64         `json:"self_id"`
	PostType      string        `json:"post_type"`
	UserId        int64         `json:"user_id"`
	GroupId       int64         `json:"group_id"`
	GroupName     string        `json:"group_name"`
	Font          int           `json:"font"`
	RealSeq       string        `json:"real_seq"`
	MessageSeq    int           `json:"message_seq"`
	MessageType   string        `json:"message_type"`
	SubType       string        `json:"sub_type"`
	MessageId     int64         `json:"message_id"`
	MessageArray  []MessageItem `json:"message"`
	MessageFormat string        `json:"message_format"`
	RawMessage    string        `json:"raw_message"`
	Sender        struct {
		UserId   int64  `json:"user_id"`
		NickName string `json:"nickname"`
		Sex      string `json:"sex"`
		GroupId  int64  `json:"group_id"`
		Card     string `json:"card"`
		Role     string `json:"role"`
	} `json:"sender"`
	NoticeType    string   `json:"notice_type"`
	TargetId      int64    `json:"target_id"`
	TempSource    string   `json:"temp_source"`
	MetaEventType string   `json:"meta_event_type"`
	RequestType   string   `json:"request_type"`
	Comment       string   `json:"comment"`
	Flag          string   `json:"flag"`
	AtMe          bool     `json:"at_me"`
	CommandArgs   []string `json:"command_args"`
}

type MessageItem

type MessageItem struct {
	Type string         `json:"type"`
	Data map[string]any `json:"data"`
}

func (*MessageItem) GetNumber added in v0.1.1

func (item *MessageItem) GetNumber(name string) int

func (*MessageItem) GetString added in v0.1.1

func (item *MessageItem) GetString(name string) string

func (*MessageItem) Set

func (item *MessageItem) Set(name string, value any)

type SafeMap added in v0.1.1

type SafeMap struct {
	// contains filtered or unexported fields
}

func NewSafeMap added in v0.1.1

func NewSafeMap() *SafeMap

func (*SafeMap) Delete added in v0.1.1

func (sm *SafeMap) Delete(key string)

Delete 删除操作

func (*SafeMap) Get added in v0.1.1

func (sm *SafeMap) Get(key string) (interface{}, bool)

Get 读操作使用读锁

func (*SafeMap) Range added in v0.1.1

func (sm *SafeMap) Range(f func(key string, value interface{}) bool)

Range 遍历操作

func (*SafeMap) Set added in v0.1.1

func (sm *SafeMap) Set(key string, value interface{})

Set 写操作使用写锁

Jump to

Keyboard shortcuts

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