events

package
v2.0.0-...-2f972be Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventCallbackFunc

type EventCallbackFunc func(ctx context.Context, event IEvent)

type EventName

type EventName string
const (
	EventNameGroupMsg             EventName = "ON_EVENT_GROUP_NEW_MSG"
	EventNameFriendMsg            EventName = "ON_EVENT_FRIEND_NEW_MSG"
	EventNameGroupJoin            EventName = "ON_EVENT_GROUP_JOIN"
	EventNameGroupExit            EventName = "ON_EVENT_GROUP_EXIT"
	EventNameGroupInvite          EventName = "ON_EVENT_GROUP_INVITE"
	EventNameGroupSystemMsgNotify EventName = "ON_EVENT_GROUP_SYSTEM_MSG_NOTIFY"
	EventNameLoginSuccess         EventName = "ON_EVENT_LOGIN_SUCCESS"
	EventNameNetworkChange        EventName = "ON_EVENT_NETWORK_CHANGE"
)

type EventStruct

type EventStruct struct {
	CurrentPacket struct {
		EventData struct {
			Nick    *string `json:"Nick,omitempty"`
			Uin     *int64  `json:"Uin,omitempty"`
			Content *string `json:"Content,omitempty"`
			MsgHead *struct {
				FromUin    int64  `json:"FromUin"`
				ToUin      int64  `json:"ToUin"`
				FromType   int    `json:"FromType"`
				SenderUin  int64  `json:"SenderUin"`
				SenderNick string `json:"SenderNick"`
				MsgType    int    `json:"MsgType"`
				C2CCmd     int    `json:"C2cCmd"`
				MsgSeq     int64  `json:"MsgSeq"`
				MsgTime    int64  `json:"MsgTime"`
				MsgRandom  int64  `json:"MsgRandom"`
				MsgUid     int64  `json:"MsgUid"`
				GroupInfo  struct {
					GroupCard    string `json:"GroupCard"`
					GroupCode    int    `json:"GroupCode"`
					GroupInfoSeq int    `json:"GroupInfoSeq"`
					GroupLevel   int    `json:"GroupLevel"`
					GroupRank    int    `json:"GroupRank"`
					GroupType    int    `json:"GroupType"`
					GroupName    string `json:"GroupName"`
				} `json:"GroupInfo"`
				C2CTempMessageHead interface{} `json:"C2CTempMessageHead"`
			} `json:"MsgHead,omitempty"`
			MsgBody *struct {
				SubMsgType int    `json:"SubMsgType"`
				Content    string `json:"Content"`
				Images     []struct {
					FileId   int64  `json:"FileId"`
					FileMd5  string `json:"FileMd5"`
					FileSize int    `json:"FileSize"`
					Url      string `json:"Url"`
				} `json:"Images"`
				AtUinLists []struct {
					Nick string `json:"Nick"`
					Uin  int64  `json:"Uin"`
				} `json:"AtUinLists"`
				Video interface{} `json:"Video"`
				Voice interface{} `json:"Voice"`
			} `json:"MsgBody,omitempty"`
		} `json:"EventData"`
		EventName string `json:"EventName"`
	} `json:"CurrentPacket"`
	CurrentQQ int64 `json:"CurrentQQ"`
	// contains filtered or unexported fields
}

func (*EventStruct) AtBot

func (e *EventStruct) AtBot() (at bool)

func (*EventStruct) ContainedAt

func (e *EventStruct) ContainedAt() bool

func (*EventStruct) ContainedPic

func (e *EventStruct) ContainedPic() bool

func (*EventStruct) ExcludeAtInfo

func (e *EventStruct) ExcludeAtInfo() IGroupMsg

func (*EventStruct) ExcludeBot

func (e *EventStruct) ExcludeBot() IEvent

func (*EventStruct) GetApiBuilder

func (e *EventStruct) GetApiBuilder() apiBuilder.IMainFunc

func (*EventStruct) GetAtList

func (e *EventStruct) GetAtList() (list []int64)

func (*EventStruct) GetCurrentQQ

func (e *EventStruct) GetCurrentQQ() int64

func (*EventStruct) GetEventName

func (e *EventStruct) GetEventName() EventName

func (*EventStruct) GetGroupUin

func (e *EventStruct) GetGroupUin() int64

func (*EventStruct) GetLoginSuccessBot

func (e *EventStruct) GetLoginSuccessBot() (nick string, uin int64)

func (*EventStruct) GetMsgTime

func (e *EventStruct) GetMsgTime() int64

func (*EventStruct) GetMsgType

func (e *EventStruct) GetMsgType() MsgType

func (*EventStruct) GetMsgUid

func (e *EventStruct) GetMsgUid() int64

func (*EventStruct) GetNetworkChangeBot

func (e *EventStruct) GetNetworkChangeBot() (nick string, uin int64, content string)

func (*EventStruct) GetRawBytes

func (e *EventStruct) GetRawBytes() []byte

func (*EventStruct) GetSenderNick

func (e *EventStruct) GetSenderNick() string

func (*EventStruct) GetSenderUin

func (e *EventStruct) GetSenderUin() int64

func (*EventStruct) GetTextContent

func (e *EventStruct) GetTextContent() string

func (*EventStruct) ParseGroupMsg

func (e *EventStruct) ParseGroupMsg() IGroupMsg

func (*EventStruct) ParseLoginSuccessEvent

func (e *EventStruct) ParseLoginSuccessEvent() ILoginSuccess

func (*EventStruct) ParseNetworkChangeEvent

func (e *EventStruct) ParseNetworkChangeEvent() INetworkChange

func (*EventStruct) ParseTextMsg

func (e *EventStruct) ParseTextMsg() ITextMsg

type ICommonMsg

type ICommonMsg interface {
	GetMsgUid() int64
	GetMsgType() MsgType
	GetMsgTime() int64
}

type IEvent

type IEvent interface {
	ICommonMsg
	GetCurrentQQ() int64
	GetRawBytes() []byte
	GetEventName() EventName
	ParseGroupMsg() IGroupMsg
	ParseLoginSuccessEvent() ILoginSuccess
	ParseNetworkChangeEvent() INetworkChange
	GetApiBuilder() apiBuilder.IMainFunc
	ExcludeBot() IEvent
}

func New

func New(apiUrl string, data []byte, middleCallFunc ...func(*apiBuilder.Builder) bool) (IEvent, error)

type IGroupMsg

type IGroupMsg interface {
	ICommonMsg
	ExcludeAtInfo() IGroupMsg
	AtBot() bool
	GetGroupUin() int64
	GetSenderUin() int64
	GetSenderNick() string
	ParseTextMsg() ITextMsg
	ContainedPic() bool
	ContainedAt() bool
}

type ILoginSuccess

type ILoginSuccess interface {
	GetLoginSuccessBot() (nick string, uin int64)
}

type INetworkChange

type INetworkChange interface {
	GetNetworkChangeBot() (nick string, uin int64, content string)
}

type ITextMsg

type ITextMsg interface {
	GetTextContent() string
}

type MsgType

type MsgType int
const (
	// MsgTypeGroupMsg 	收到群消息
	MsgTypeGroupMsg MsgType = 82
	// MsgTypeFriendsMsg 	收到好友私聊消息
	MsgTypeFriendsMsg MsgType = 166
	// MsgTypeGroupJoin 有人进群了
	MsgTypeGroupJoin MsgType = 33
	// MsgTypeGroupExit 有人退群了
	MsgTypeGroupExit MsgType = 34
	/*
	  1. 发出去消息的回应
	  2. 有人撤回消息
	  3. 自己被邀请入群
	*/
	MsgTypeMsgSent MsgType = 732
	// MsgTypeGroupChange 自己的群名片被改了
	MsgTypeGroupChange MsgType = 528
)

Jump to

Keyboard shortcuts

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