message

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Text ElementType = iota
	Image
	Face
	At
	Reply
	Service
	Forward
	File
	Voice
	Video
	LightApp
	RedBag

	SweetWink      GroupGift = 285
	HappyCola      GroupGift = 289
	LuckyBracelet  GroupGift = 290
	Cappuccino     GroupGift = 299
	CatWatch       GroupGift = 302
	FleeceGloves   GroupGift = 307
	RainbowCandy   GroupGift = 308
	Stronger       GroupGift = 313
	LoveMicrophone GroupGift = 367
)

Variables

This section is empty.

Functions

func EstimateLength

func EstimateLength(elems []IMessageElement, limit int) int

func ToProtoElems

func ToProtoElems(elems []IMessageElement, generalFlags bool) (r []*msg.Elem)

func ToReadableString

func ToReadableString(m []IMessageElement) (r string)

func ToSrcProtoElems

func ToSrcProtoElems(elems []IMessageElement) (r []*msg.Elem)

Types

type AtElement

type AtElement struct {
	Target  int64
	Display string
}

func AtAll

func AtAll() *AtElement

func NewAt

func NewAt(target int64, display ...string) *AtElement

func (*AtElement) Pack added in v0.1.0

func (e *AtElement) Pack() (r []*msg.Elem)

func (*AtElement) Type

func (e *AtElement) Type() ElementType

type ElementType

type ElementType int

type FaceElement

type FaceElement struct {
	Index int32
	Name  string
}

func NewFace

func NewFace(index int32) *FaceElement

func (*FaceElement) Pack added in v0.1.0

func (e *FaceElement) Pack() (r []*msg.Elem)

func (*FaceElement) Type

func (e *FaceElement) Type() ElementType

type ForwardElement

type ForwardElement struct {
	ResId string
}

func (*ForwardElement) Type

func (e *ForwardElement) Type() ElementType

type ForwardMessage

type ForwardMessage struct {
	Nodes []*ForwardNode
}

func (*ForwardMessage) CalculateValidationData

func (forMsg *ForwardMessage) CalculateValidationData(seq, random int32, groupCode int64) ([]byte, []byte)

type ForwardNode

type ForwardNode struct {
	SenderId   int64
	SenderName string
	Time       int32
	Message    []IMessageElement
}

type FriendFlashPicElement added in v0.1.0

type FriendFlashPicElement struct {
	FriendImageElement
}

func (*FriendFlashPicElement) Pack added in v0.1.0

func (e *FriendFlashPicElement) Pack() (r []*msg.Elem)

type FriendImageElement

type FriendImageElement struct {
	ImageId string
	Md5     []byte
	Url     string
}

func (*FriendImageElement) Pack added in v0.1.0

func (e *FriendImageElement) Pack() (r []*msg.Elem)

func (*FriendImageElement) Type

func (e *FriendImageElement) Type() ElementType

type GroupFileElement

type GroupFileElement struct {
	Name  string
	Size  int64
	Path  string
	Busid int32
}

func (*GroupFileElement) Type

func (e *GroupFileElement) Type() ElementType

type GroupFlashPicElement added in v0.1.0

type GroupFlashPicElement struct {
	GroupImageElement
}

func (*GroupFlashPicElement) Pack added in v0.1.0

func (e *GroupFlashPicElement) Pack() (r []*msg.Elem)

type GroupGift added in v0.1.0

type GroupGift int

type GroupImageElement

type GroupImageElement struct {
	ImageId string
	FileId  int64
	Size    int32
	Width   int32
	Height  int32
	Md5     []byte
	Url     string
}

func NewGroupImage

func NewGroupImage(id string, md5 []byte, fid int64, size, width, height int32) *GroupImageElement

func (*GroupImageElement) Pack added in v0.1.0

func (e *GroupImageElement) Pack() (r []*msg.Elem)

func (*GroupImageElement) Type

func (e *GroupImageElement) Type() ElementType

type GroupMessage

type GroupMessage struct {
	Id         int32
	InternalId int32
	GroupCode  int64
	GroupName  string
	Sender     *Sender
	Time       int32
	Elements   []IMessageElement
}

func (*GroupMessage) ToString

func (msg *GroupMessage) ToString() (res string)

type GroupShowPicElement added in v0.1.0

type GroupShowPicElement struct {
	GroupImageElement
	EffectId int32
}

func (*GroupShowPicElement) Pack added in v0.1.0

func (e *GroupShowPicElement) Pack() (r []*msg.Elem)

type GroupVoiceElement

type GroupVoiceElement struct {
	Data []byte
	Ptt  *msg.Ptt
}

func (*GroupVoiceElement) Type

func (e *GroupVoiceElement) Type() ElementType

type IMessageElement

type IMessageElement interface {
	Type() ElementType
}

func ParseMessageElems

func ParseMessageElems(elems []*msg.Elem) []IMessageElement

type IRichMessageElement added in v0.1.0

type IRichMessageElement interface {
	Pack() []*msg.Elem
}

type ImageElement

type ImageElement struct {
	Filename string
	Size     int32
	Width    int32
	Height   int32
	Url      string
	Md5      []byte
	Data     []byte
}

func NewImage

func NewImage(data []byte) *ImageElement

func (*ImageElement) Pack added in v0.1.0

func (e *ImageElement) Pack() (r []*msg.Elem)

func (*ImageElement) Type

func (e *ImageElement) Type() ElementType

type LightAppElement added in v0.1.0

type LightAppElement struct {
	Content string
}

func NewLightApp added in v0.1.0

func NewLightApp(content string) *LightAppElement

func (*LightAppElement) Pack added in v0.1.0

func (e *LightAppElement) Pack() (r []*msg.Elem)

func (*LightAppElement) Type added in v0.1.0

func (e *LightAppElement) Type() ElementType

type PrivateMessage

type PrivateMessage struct {
	Id         int32
	InternalId int32
	Target     int64
	Time       int32
	Sender     *Sender
	Elements   []IMessageElement
}

func (*PrivateMessage) ToString

func (msg *PrivateMessage) ToString() (res string)

type PrivateVoiceElement added in v0.1.0

type PrivateVoiceElement struct {
	Data []byte
	Ptt  *msg.Ptt
}

func (*PrivateVoiceElement) Type added in v0.1.0

func (e *PrivateVoiceElement) Type() ElementType

type RedBagElement added in v0.1.0

type RedBagElement struct {
	MsgType RedBagMessageType
	Title   string
}

func (*RedBagElement) Type added in v0.1.0

func (e *RedBagElement) Type() ElementType

type RedBagMessageType added in v0.1.0

type RedBagMessageType int
const (
	Simple RedBagMessageType = 2
	Lucky  RedBagMessageType = 3
	World  RedBagMessageType = 6
)

type ReplyElement

type ReplyElement struct {
	ReplySeq int32
	Sender   int64
	Time     int32
	Elements []IMessageElement
}

func NewReply

func NewReply(m *GroupMessage) *ReplyElement

func (*ReplyElement) Type

func (e *ReplyElement) Type() ElementType

type RichMessage added in v0.1.0

type RichMessage struct {
	Title      string
	Summary    string
	Brief      string
	Url        string
	PictureUrl string
	MusicUrl   string
}

type Sender

type Sender struct {
	Uin      int64
	Nickname string
	CardName string
	IsFriend bool
}

func (*Sender) DisplayName

func (s *Sender) DisplayName() string

func (*Sender) IsAnonymous

func (s *Sender) IsAnonymous() bool

type SendingMessage

type SendingMessage struct {
	Elements []IMessageElement
}

func NewSendingMessage

func NewSendingMessage() *SendingMessage

func (*SendingMessage) Any

func (msg *SendingMessage) Any(filter func(e IMessageElement) bool) bool

func (*SendingMessage) Append

func (*SendingMessage) Count

func (msg *SendingMessage) Count(filter func(e IMessageElement) bool) (c int)

func (*SendingMessage) FirstOrNil

func (msg *SendingMessage) FirstOrNil(filter func(e IMessageElement) bool) IMessageElement

func (*SendingMessage) ToFragmented added in v0.1.0

func (msg *SendingMessage) ToFragmented() [][]IMessageElement

type ServiceElement

type ServiceElement struct {
	Id      int32
	Content string
	ResId   string
	SubType string
}

func NewRichJson added in v0.1.0

func NewRichJson(template string) *ServiceElement

func NewRichXml added in v0.1.0

func NewRichXml(template string, ResId int64) *ServiceElement

func NewUrlShare

func NewUrlShare(url, title, content, image string) *ServiceElement

func (*ServiceElement) Pack added in v0.1.0

func (e *ServiceElement) Pack() (r []*msg.Elem)

func (*ServiceElement) Type

func (e *ServiceElement) Type() ElementType

type ShortVideoElement

type ShortVideoElement struct {
	Name string
	Uuid []byte
	Size int32
	Md5  []byte
	Url  string
}

func (*ShortVideoElement) Type

func (e *ShortVideoElement) Type() ElementType

type TempMessage

type TempMessage struct {
	Id        int32
	GroupCode int64
	GroupName string
	Sender    *Sender
	Elements  []IMessageElement
}

func (*TempMessage) ToString

func (msg *TempMessage) ToString() (res string)

type TextElement

type TextElement struct {
	Content string
}

func NewText

func NewText(s string) *TextElement

func (*TextElement) Pack added in v0.1.0

func (e *TextElement) Pack() (r []*msg.Elem)

func (*TextElement) Type

func (e *TextElement) Type() ElementType

type VoiceElement

type VoiceElement struct {
	Name string
	Md5  []byte
	Size int32
	Url  string

	// --- sending ---
	Data []byte
}

func (*VoiceElement) Type

func (e *VoiceElement) Type() ElementType

Jump to

Keyboard shortcuts

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