reply

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 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 Body

type Body struct {
	XMLName      xml.Name          `xml:"xml"`
	ToUserName   message.CDATAText `xml:"ToUserName"`
	FromUserName message.CDATAText `xml:"FromUserName"`
	CreateTime   string            `xml:"CreateTime"`
	MsgType      message.CDATAText `xml:"MsgType"`

	Content *message.CDATAText `xml:"Content,omitempty"` // 文本消息
	Image   *Media             `xml:"Image,omitempty"`   // 图片消息
	Voice   *Media             `xml:"Voice,omitempty"`   // 音频消息
	Video   *Video             `xml:"Video,omitempty"`   // 视频消息
	Music   *Music             `xml:"Music,omitempty"`   // 音乐消息
}

Body 回复消息体

func NewImage

func NewImage(mediaId string) *Body

NewImage 图片消息

func NewMusic

func NewMusic(title, description, musicUrl, HQMusicUrl, thumbMediaId string) *Body

NewMusic 音乐消息

func NewText

func NewText(content string) *Body

NewText 文本消息

func NewVideo

func NewVideo(mediaId, title, description string) *Body

NewVideo 视频消息

func NewVoice

func NewVoice(mediaId string) *Body

NewVoice 音频消息

func (*Body) BuildXml

func (reply *Body) BuildXml(fromUserName, toUserName string) []byte

func (*Body) ContentType

func (reply *Body) ContentType() string

type Media

type Media struct {
	MediaId message.CDATAText `xml:"MediaId,omitempty"`
}

Media 媒体消息

type Music

type Music struct {
	Title        message.CDATAText `xml:"Title"`
	Description  message.CDATAText `xml:"Description"`
	MusicUrl     message.CDATAText `xml:"MusicUrl"`
	HQMusicUrl   message.CDATAText `xml:"HQMusicUrl"`
	ThumbMediaId message.CDATAText `xml:"ThumbMediaId"`
}

Music 音乐消息

type News

type News struct {
	XMLName      xml.Name          `xml:"xml"`
	ToUserName   message.CDATAText `xml:"ToUserName"`
	FromUserName message.CDATAText `xml:"FromUserName"`
	CreateTime   string            `xml:"CreateTime"`
	MsgType      message.CDATAText `xml:"MsgType"`
	ArticleCount int               `xml:"ArticleCount"`
	Articles     []NewsArticle     `xml:"Articles"`
}

News 图文消息

func NewNews

func NewNews(articles []map[string]string) *News

NewNews 图文消息

func (*News) BuildXml

func (reply *News) BuildXml(fromUserName, toUserName string) []byte

func (*News) ContentType

func (reply *News) ContentType() string

type NewsArticle

type NewsArticle struct {
	Item struct {
		Title       message.CDATAText `xml:"Title"`
		Description message.CDATAText `xml:"Description"`
		PicUrl      message.CDATAText `xml:"PicUrl"`
		Url         message.CDATAText `xml:"Url"`
	} `xml:"item"`
}

NewsArticle 图文消息文章

type Replier

type Replier interface {
	// BuildXml 构建消息XML
	BuildXml(fromUserName, toUserName string) []byte
	// ContentType 消息类型
	ContentType() string
}

Replier 消息回复接口

type Reply

type Reply struct {
	// contains filtered or unexported fields
}

Reply 消息回复

func NewReply

func NewReply(replier Replier) *Reply

func (*Reply) Replier

func (reply *Reply) Replier() Replier

type Video

type Video struct {
	MediaId     message.CDATAText `xml:"MediaId"`
	Title       message.CDATAText `xml:"Title"`
	Description message.CDATAText `xml:"Description"`
}

Video 视频消息

Jump to

Keyboard shortcuts

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