event

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVENT_MESSAGE = "message"
	EVENT_NOTICE  = "notice"
	EVENT_REQUEST = "request"
	EVENT_META    = "meta_event"
)

Variables

View Source
var (
	ErrNoAvailable = errors.New("no replyer available")
	ErrNotFound    = errors.New("not found")
)

Functions

This section is empty.

Types

type Admin

type Admin struct {
	SubType string `json:"sub_type"` // set/unset
	GroupId int64  `json:"group_id"`
	UserId  int64  `json:"user_id"`
}

func (Admin) Type

func (en Admin) Type() string

type AllMessage

type AllMessage struct {
	CommonMessage
	GroupId   int64     `json:"group_id"`
	Anonymous Anonymous `json:"anonymous"`
}

func (AllMessage) SessionKey

func (am AllMessage) SessionKey() string

func (AllMessage) Type

func (am AllMessage) Type() string

type Anonymous

type Anonymous struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
	Flag string `json:"flag"`
}

type CommonMessage

type CommonMessage struct {
	SubType    string           `json:"sub_type"`
	MessageId  int              `json:"message_id"`
	UserId     int64            `json:"user_id"`
	Messages   []schema.Message `json:"message"`
	RawMessage string           `json:"raw_message"`
	Font       int              `json:"font"`
	Sender     schema.Sender    `json:"sender"`
}

func (CommonMessage) All added in v0.2.3

yield all messages use type and raw

func (CommonMessage) AtFirst

func (cm CommonMessage) AtFirst() (*schema.At, error)

func (CommonMessage) Ats

func (cm CommonMessage) Ats() ([]schema.At, int)

func (CommonMessage) FaceFirst

func (cm CommonMessage) FaceFirst() (*schema.Face, error)

func (CommonMessage) Faces

func (cm CommonMessage) Faces() ([]schema.Face, int)

func (CommonMessage) File

func (cm CommonMessage) File() (*schema.CommonFile, error)

func (CommonMessage) FilterType added in v0.3.0

func (cm CommonMessage) FilterType(Type string) iter.Seq[json.RawMessage]

yield the rawMessage by type

func (CommonMessage) Id

func (cm CommonMessage) Id() int

func (CommonMessage) ImageFirst

func (cm CommonMessage) ImageFirst() (*schema.Image, error)

func (CommonMessage) Images

func (cm CommonMessage) Images() ([]schema.Image, int)

func (CommonMessage) Record

func (em CommonMessage) Record() (*schema.Record, error)

func (CommonMessage) Reply

func (cm CommonMessage) Reply(replyer Replyer, text string) error

func (CommonMessage) TextFirst

func (cm CommonMessage) TextFirst() (*schema.Text, error)

func (CommonMessage) Texts

func (cm CommonMessage) Texts() ([]schema.Text, int)

type Event

type Event struct {
	Types   []string
	Time    int64
	SelfId  int64
	RawData []byte
	Replyer Replyer
}

type Eventer

type Eventer interface {
	Type() string
}

type File

type File struct {
	Id    string `json:"id"`
	Name  string `json:"name"`
	Size  int64  `json:"size"`
	Busid int64  `json:"busid"`
}

type FriendRequest

type FriendRequest struct {
	UserId  int64  `json:"user_id"`
	Comment string `json:"comment"`
	Flag    string `json:"flag"`
}

func (*FriendRequest) Reply

func (fr *FriendRequest) Reply(replyer Replyer, approve bool, remark string) error

func (FriendRequest) Type

func (fr FriendRequest) Type() string

type GroupBan

type GroupBan struct {
	SubType    string `json:"sub_type"` // ban/lift_ban
	GroupId    int64  `json:"group_id"`
	UserId     int64  `json:"user_id"`
	Duration   int64  `json:"duration"` // s
	OperatorId int64  `json:"operator_id"`
}

func (GroupBan) Type

func (en GroupBan) Type() string

type GroupDecrease

type GroupDecrease struct {
	SubType    string `json:"sub_type"` // leave/kick/kick_me
	GroupId    int64  `json:"group_id"`
	UserId     int64  `json:"user_id"`
	OperatorId int64  `json:"operator_id"`
}

func (GroupDecrease) Type

func (en GroupDecrease) Type() string

type GroupFile

type GroupFile struct {
	GroupId int64 `json:"group_id"`
	UserId  int64 `json:"user_id"`
	File    File  `json:"file"`
}

func (GroupFile) Type

func (en GroupFile) Type() string

type GroupIncrease

type GroupIncrease struct {
	SubType    string `json:"sub_type"` // approve/invite
	GroupId    int64  `json:"group_id"`
	UserId     int64  `json:"user_id"`
	OperatorId int64  `json:"operator_id"`
}

func (GroupIncrease) Type

func (en GroupIncrease) Type() string

type GroupMessage

type GroupMessage struct {
	CommonMessage
	GroupId   int64     `json:"group_id"`
	Anonymous Anonymous `json:"anonymous"`
}

func (GroupMessage) SessionKey

func (gm GroupMessage) SessionKey() string

func (GroupMessage) Type

func (gm GroupMessage) Type() string

type GroupRecall

type GroupRecall struct {
	GroupId    int64 `json:"group_id"`
	UserId     int64 `json:"user_id"`
	OperatorId int64 `json:"operator_id"`
	MessageId  int64 `json:"message_id"`
}

func (GroupRecall) Type

func (en GroupRecall) Type() string

type GroupRequest

type GroupRequest struct {
	SubType string `json:"sub_type"` // add invite
	GroupId int64  `json:"group_id"`
	UserId  int64  `json:"user_id"`
	Comment string `json:"comment"`
	Flag    string `json:"flag"`
}

func (*GroupRequest) Reply

func (gr *GroupRequest) Reply(replyer Replyer, approve bool, reason string) error

func (GroupRequest) Type

func (gr GroupRequest) Type() string

type HeartMeta

type HeartMeta struct {
	Status   types.Status `json:"status"`
	Interval int64        `json:"interval"`
}

func (HeartMeta) Type

func (e HeartMeta) Type() string

type LifeMeta

type LifeMeta struct {
	SubType string `json:"sub_type"` //enable disable connect
}

func (LifeMeta) Type

func (e LifeMeta) Type() string

type Messager

type Messager interface {
	Eventer
	TextFirst() (*schema.Text, error)
	Texts() ([]schema.Text, int)
	FaceFirst() (*schema.Face, error)
	Faces() ([]schema.Face, int)
	AtFirst() (*schema.At, error)
	Ats() ([]schema.At, int)
	ImageFirst() (*schema.Image, error)
	Images() ([]schema.Image, int)
}

type Notify

type Notify struct {
	SubType  string `json:"sub_type"`
	TargetId int64  `json:"target_id"`
	UserId   int64  `json:"user_id"`
	GroupId  int64  `json:"group_id"`
}

func (Notify) Type

func (en Notify) Type() string

type PrivateAdd

type PrivateAdd struct {
	UserId int64 `json:"user_id"`
}

func (PrivateAdd) Type

func (en PrivateAdd) Type() string

type PrivateMessage

type PrivateMessage struct {
	CommonMessage
}

func (PrivateMessage) SessionKey

func (pm PrivateMessage) SessionKey() string

func (PrivateMessage) Type

func (pm PrivateMessage) Type() string

type PrivateRecall

type PrivateRecall struct {
	UserId    int64 `json:"user_id"`
	MessageId int64 `json:"message_id"`
}

func (PrivateRecall) Type

func (en PrivateRecall) Type() string

type Replyer

type Replyer interface {
	Reply(data any) error
}

Jump to

Keyboard shortcuts

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