events

package
v2.0.0-...-ff540d0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 6 Imported by: 2

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"`
				FromUid            string      `json:"FromUid"`
				ToUin              int64       `json:"ToUin"`
				FromType           int         `json:"FromType"`
				SenderUin          int64       `json:"SenderUin"`
				SenderUid          string      `json:"SenderUid"`
				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          GroupInfo   `json:"GroupInfo"`
				C2CTempMessageHead interface{} `json:"C2CTempMessageHead"`
			} `json:"MsgHead,omitempty"`
			MsgBody *struct {
				SubMsgType int         `json:"SubMsgType"`
				Content    string      `json:"Content"`
				Images     []Image     `json:"Images"`
				AtUinLists []UserInfo  `json:"AtUinLists"`
				Video      interface{} `json:"Video"`
				Voice      interface{} `json:"Voice"`
			} `json:"MsgBody,omitempty"`
			Event *struct {
				Invitee string `json:"Invitee"`
				Invitor string `json:"Invitor"`
				Tips    string `json:"Tips"`
			} `json:"Event,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) GetAtInfo

func (e *EventStruct) GetAtInfo() []UserInfo

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) GetFriendUid

func (e *EventStruct) GetFriendUid() string

func (*EventStruct) GetFriendUin

func (e *EventStruct) GetFriendUin() int64

func (*EventStruct) GetGroupInfo

func (e *EventStruct) GetGroupInfo() GroupInfo

func (*EventStruct) GetGroupJoinEvent

func (e *EventStruct) GetGroupJoinEvent() (Invitee string, Invitor string, tips string)

func (*EventStruct) GetGroupUId

func (e *EventStruct) GetGroupUId() (uin int64)

func (*EventStruct) GetGroupUin

func (e *EventStruct) GetGroupUin() int64

func (*EventStruct) GetLoginSuccessBot

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

func (*EventStruct) GetMsgRandom

func (e *EventStruct) GetMsgRandom() int64

func (*EventStruct) GetMsgSeq

func (e *EventStruct) GetMsgSeq() 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) GetPics

func (e *EventStruct) GetPics() []Image

func (*EventStruct) GetRawBytes

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

func (*EventStruct) GetSenderNick

func (e *EventStruct) GetSenderNick() string

func (*EventStruct) GetSenderUid

func (e *EventStruct) GetSenderUid() string

func (*EventStruct) GetSenderUin

func (e *EventStruct) GetSenderUin() int64

func (*EventStruct) GetTextContent

func (e *EventStruct) GetTextContent() string

func (*EventStruct) IsFromBot

func (e *EventStruct) IsFromBot() bool

func (EventStruct) MarshalEasyJSON

func (v EventStruct) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (EventStruct) MarshalJSON

func (v EventStruct) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*EventStruct) ParseFriendMsg

func (e *EventStruct) ParseFriendMsg() IFriendMsg

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) ParsePicMsg

func (e *EventStruct) ParsePicMsg() IPicMsg

func (*EventStruct) ParseTextMsg

func (e *EventStruct) ParseTextMsg() ITextMsg

func (*EventStruct) PraseGroupJoinEvent

func (e *EventStruct) PraseGroupJoinEvent() IGroupJoinEvent

func (*EventStruct) UnmarshalEasyJSON

func (v *EventStruct) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*EventStruct) UnmarshalJSON

func (v *EventStruct) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type GroupInfo

type 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"`
}

type ICommonMsg

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

type IEvent

type IEvent interface {
	ICommonMsg
	GetCurrentQQ() int64
	GetRawBytes() []byte
	GetEventName() EventName
	ParseGroupMsg() IGroupMsg
	ParseFriendMsg() IFriendMsg
	ParseLoginSuccessEvent() ILoginSuccess
	ParseNetworkChangeEvent() INetworkChange
	PraseGroupJoinEvent() IGroupJoinEvent
	ExcludeBot() IEvent
}

func New

func New(data []byte) (IEvent, error)

type IFriendMsg

type IFriendMsg interface {
	ICommonMsg
	GetFriendUin() int64
	GetFriendUid() string
	GetSenderUin() int64
	ParseTextMsg() ITextMsg
	ParsePicMsg() IPicMsg
}

type IGroupJoinEvent

type IGroupJoinEvent interface {
	GetGroupJoinEvent() (Invitee string, Invitor string, tips string)
	GetGroupUId() int64
}

type IGroupMsg

type IGroupMsg interface {
	ICommonMsg
	ExcludeAtInfo() IGroupMsg
	AtBot() bool
	GetAtInfo() []UserInfo
	GetGroupUin() int64
	GetGroupInfo() GroupInfo
	GetSenderNick() string
	GetSenderUin() int64
	GetSenderUid() string
	ParseTextMsg() ITextMsg
	ParsePicMsg() IPicMsg
	ContainedPic() bool
	ContainedAt() bool
	IsFromBot() bool
}

type ILoginSuccess

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

type INetworkChange

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

type IPicMsg

type IPicMsg interface {
	GetPics() []Image
	GetTextContent() string
}

type ITextMsg

type ITextMsg interface {
	GetTextContent() string
}

type Image

type Image struct {
	FileId   int64  `json:"FileId"`
	FileMd5  string `json:"FileMd5"`
	FileSize int    `json:"FileSize"`
	Url      string `json:"Url"`
}

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
)

type UserInfo

type UserInfo struct {
	Nick string `json:"Nick"`
	Uin  int64  `json:"Uin"`
}

Jump to

Keyboard shortcuts

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