Documentation
¶
Index ¶
- Constants
- func PackElements(msgElems []IMessageElement) []*message.Elem
- func PackElementsToBody(msgElems []IMessageElement) (msgBody *message.MessageBody)
- func ToReadableString(m []IMessageElement) string
- type AnonymousInfo
- type AtElement
- type AtType
- type Config
- type Detail
- type ElementBuilder
- type ElementType
- type FaceElement
- type ForwardMessage
- type ForwardNode
- type FriendImageElement
- type GroupImageElement
- type GroupMessage
- type IMessage
- type IMessageElement
- type ImageElement
- type LightAppElement
- type Meta
- type MultiItem
- type MultiMessage
- type MultiMsgLightApp
- type MultiMsgLightAppExtra
- type MultiSource
- type MultiSummary
- type MultiTitle
- type News
- type PrivateMessage
- type ReplyElement
- type Sender
- type SendingMessage
- type ShortVideoElement
- type Source
- type SourceType
- type TempMessage
- type TextElement
- type VoiceElement
Constants ¶
View Source
const (
AtTypeGroupMember = 0 // At群成员
)
Variables ¶
This section is empty.
Functions ¶
func PackElements ¶ added in v0.0.11
func PackElements(msgElems []IMessageElement) []*message.Elem
func PackElementsToBody ¶ added in v0.0.9
func PackElementsToBody(msgElems []IMessageElement) (msgBody *message.MessageBody)
func ToReadableString ¶
func ToReadableString(m []IMessageElement) string
Types ¶
type AnonymousInfo ¶
type AtElement ¶
func (*AtElement) BuildElement ¶
func (*AtElement) Type ¶
func (e *AtElement) Type() ElementType
type ElementBuilder ¶ added in v0.0.9
type ElementType ¶
type ElementType int
const ( Text ElementType = iota // 文本 Image // 图片 Face // 表情 At // 艾特 Reply // 回复 Service // 服务 Forward // 转发 File // 文件 Voice // 语音 Video // 视频 LightApp // 轻应用 RedBag // 红包 )
type FaceElement ¶
type FaceElement struct {
FaceID uint16
// contains filtered or unexported fields
}
func (*FaceElement) BuildElement ¶
func (e *FaceElement) BuildElement() []*message.Elem
func (*FaceElement) Type ¶
func (e *FaceElement) Type() ElementType
type ForwardMessage ¶ added in v0.0.11
type ForwardMessage struct {
ResID string
Nodes []*ForwardNode
}
func NewFoward ¶ added in v0.0.11
func NewFoward(resid string) *ForwardMessage
func NewNodeFoward ¶ added in v0.0.11
func NewNodeFoward(nodes []*ForwardNode) *ForwardMessage
func (*ForwardMessage) BuildElement ¶ added in v0.0.11
func (e *ForwardMessage) BuildElement() []*message.Elem
func (*ForwardMessage) Type ¶ added in v0.0.11
func (e *ForwardMessage) Type() ElementType
type ForwardNode ¶ added in v0.0.11
type ForwardNode struct {
GroupId int64
SenderId int64
SenderName string
Time int32
Message []IMessageElement
}
type FriendImageElement ¶
type GroupImageElement ¶
type GroupMessage ¶
type GroupMessage struct {
Id int32
InternalId int32
GroupUin uint32
GroupName string
Sender *Sender
Time uint64
Elements []IMessageElement
OriginalObject *message.PushMsgBody
}
func ParseGroupMessage ¶
func ParseGroupMessage(msg *message.PushMsg) *GroupMessage
func (*GroupMessage) ToString ¶
func (msg *GroupMessage) ToString() string
type IMessage ¶
type IMessage interface {
GetElements() []IMessageElement
Chat() int64
ToString() string
Texts() []string
}
type IMessageElement ¶
type IMessageElement interface {
Type() ElementType
}
func ParseMessageBody ¶ added in v0.0.11
func ParseMessageBody(body *message.MessageBody, isGroup bool) []IMessageElement
type ImageElement ¶ added in v0.0.11
type ImageElement struct {
ImageId string
FileId int64
ImageType int32
Size uint32
Width uint32
Height uint32
Url string
// EffectID show pic effect id.
EffectID int32
Flash bool
// send
Summary string
Ext string
Md5 []byte
Sha1 []byte
MsgInfo *oidb.MsgInfo
Stream io.ReadSeeker
CompatFace *message.CustomFace // GroupImage
CompatImage *message.NotOnlineImage // FriendImage
}
func NewFileImage ¶ added in v0.0.11
func NewFileImage(path string, Summary ...string) (*ImageElement, error)
func NewFileRecord ¶ added in v0.0.11
func NewFileRecord(path string, Summary ...string) (*ImageElement, error)
func NewImage ¶ added in v0.0.11
func NewImage(data []byte, Summary ...string) *ImageElement
func NewStreamImage ¶ added in v0.0.11
func NewStreamImage(r io.ReadSeeker, Summary ...string) *ImageElement
func (*ImageElement) BuildElement ¶ added in v0.0.11
func (e *ImageElement) BuildElement() []*message.Elem
func (*ImageElement) Type ¶ added in v0.0.11
func (e *ImageElement) Type() ElementType
type LightAppElement ¶ added in v0.0.11
func NewLightApp ¶ added in v0.0.11
func NewLightApp(content string) *LightAppElement
func (*LightAppElement) BuildElement ¶ added in v0.0.11
func (e *LightAppElement) BuildElement() []*message.Elem
func (*LightAppElement) Type ¶ added in v0.0.11
func (e *LightAppElement) Type() ElementType
type MultiItem ¶ added in v0.0.11
type MultiItem struct {
Layout int `xml:"layout,attr"`
Title []MultiTitle `xml:"title"`
Summary MultiSummary `xml:"summary"`
}
type MultiMessage ¶ added in v0.0.11
type MultiMessage struct {
XMLName xml.Name `xml:"msg"`
ServiceID uint `xml:"serviceID,attr"`
TemplateID int `xml:"templateID,attr"`
Action string `xml:"action,attr"`
Brief string `xml:"brief,attr"`
FileName string `xml:"m_fileName,attr"`
ResId string `xml:"m_resid,attr"`
Total int `xml:"tSum,attr"`
Flag int `xml:"flag,attr"`
Item MultiItem `xml:"item"`
Source MultiSource `xml:"source"`
}
type MultiMsgLightApp ¶ added in v0.0.11
type MultiMsgLightAppExtra ¶ added in v0.0.11
type MultiSource ¶ added in v0.0.11
type MultiSource struct {
Name string `xml:"name,attr"`
}
type MultiSummary ¶ added in v0.0.11
type MultiTitle ¶ added in v0.0.11
type PrivateMessage ¶
type PrivateMessage struct {
Id int32
InternalId int32
Self int64
Target int64
Time int32
Sender *Sender
Elements []IMessageElement
}
func ParsePrivateMessage ¶
func ParsePrivateMessage(msg *message.PushMsg) *PrivateMessage
func (*PrivateMessage) ToString ¶ added in v0.0.11
func (msg *PrivateMessage) ToString() string
type ReplyElement ¶
type ReplyElement struct {
ReplySeq uint32
SenderUin uint32
SenderUid string
GroupUin uint32 // 私聊回复群聊时
Time uint32
Elements []IMessageElement
}
func NewGroupReply ¶ added in v0.0.11
func NewGroupReply(m *GroupMessage) *ReplyElement
func NewPrivateReply ¶ added in v0.0.11
func NewPrivateReply(m *PrivateMessage) *ReplyElement
func (*ReplyElement) BuildElement ¶
func (e *ReplyElement) BuildElement() []*message.Elem
func (*ReplyElement) Type ¶
func (e *ReplyElement) Type() ElementType
type Sender ¶
type Sender struct {
Uin uint32
Uid string
Nickname string
CardName string
AnonymousInfo *AnonymousInfo
IsFriend bool
}
func (*Sender) IsAnonymous ¶
type SendingMessage ¶
type SendingMessage struct {
Elements []IMessageElement
}
func NewSendingMessage ¶
func NewSendingMessage() *SendingMessage
func (*SendingMessage) Append ¶
func (msg *SendingMessage) Append(e IMessageElement) *SendingMessage
Append 要传入msg的引用
func (*SendingMessage) FirstOrNil ¶
func (msg *SendingMessage) FirstOrNil(f func(element IMessageElement) bool) IMessageElement
func (*SendingMessage) GetElems ¶
func (msg *SendingMessage) GetElems() []IMessageElement
type ShortVideoElement ¶
type ShortVideoElement struct {
Name string
Uuid []byte
Size int32
ThumbSize int32
Md5 []byte
ThumbMd5 []byte
Url string
}
func (*ShortVideoElement) BuildElement ¶
func (e *ShortVideoElement) BuildElement() []*message.Elem
func (*ShortVideoElement) Type ¶
func (e *ShortVideoElement) Type() ElementType
type Source ¶
type Source struct {
SourceType SourceType
PrimaryID int64 // 群号/QQ号/guild_id
SecondaryID int64 // channel_id
}
Source 消息来源
type SourceType ¶
type SourceType byte
const ( SourcePrivate SourceType = 1 << iota SourceGroup SourceType = 1 << iota SourceGuildChannel SourceType = 1 << iota SourceGuildDirect SourceType = 1 << iota )
MessageSourceType 常量
func (SourceType) String ¶
func (t SourceType) String() string
type TempMessage ¶
type TempMessage struct {
Id int32
GroupUin uint32
GroupName string
Self uint32
Sender *Sender
Elements []IMessageElement
}
func ParseTempMessage ¶
func ParseTempMessage(msg *message.PushMsg) *TempMessage
type TextElement ¶
type TextElement struct {
Content string
}
func NewText ¶
func NewText(s string) *TextElement
func (*TextElement) BuildElement ¶
func (e *TextElement) BuildElement() []*message.Elem
func (*TextElement) Type ¶
func (e *TextElement) Type() ElementType
type VoiceElement ¶
type VoiceElement struct {
Name string
Size uint32
Url string
Md5 []byte
Sha1 []byte
Node *oidb.IndexNode
// --- sending ---
MsgInfo *oidb.MsgInfo
Compat []byte
Duration uint32
Stream io.ReadSeeker
Summary string
}
func NewRecord ¶ added in v0.0.11
func NewRecord(data []byte, Summary ...string) *VoiceElement
func NewStreamRecord ¶ added in v0.0.11
func NewStreamRecord(r io.ReadSeeker, Summary ...string) *VoiceElement
func (*VoiceElement) BuildElement ¶
func (e *VoiceElement) BuildElement() []*message.Elem
func (*VoiceElement) Type ¶
func (e *VoiceElement) Type() ElementType
Click to show internal directories.
Click to hide internal directories.