event

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(args ...interface{})

type Context

type Context struct {
	Self   *entity.User
	Sender *entity.Sender
	Group  *entity.Group
	Time   time.Time
	Type   Type
	Event  any

	// 如果是消息事件这里是消息预览,其他事件则为事件名称
	Content string
}

type Handler

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

type Registry

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

func NewRegistry

func NewRegistry() *Registry

type System

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

func NewEventSystem

func NewEventSystem() *System

func (*System) Emit

func (sys *System) Emit(event string, args ...interface{}) error

func (*System) On

func (sys *System) On(event string, callback Callback) (func(), error)

func (*System) Register

func (sys *System) Register(event string)

func (*System) Unregister

func (sys *System) Unregister(event string)

type Type

type Type int
const (
	MessageEvent Type = iota
	NotificationEvent
	RequestEvent
)

Jump to

Keyboard shortcuts

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