weixinservice

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoWxUserSubscribe

func DoWxUserSubscribe(appid string, msg *msghandler.MessageEvent) error

Types

type AutoReplyData

type AutoReplyData struct {
	ReplyAll bool                `json:"reply_all"`
	MsgList  []*AutoReplyMessage `json:"msg_list"`
}

type AutoReplyMessage

type AutoReplyMessage struct {
	MsgType      string                     `json:"msg_type"` // text image voice video music news mpnews mpnewsarticle wxcard miniprogrampage
	Content      string                     `json:"content"`
	MediaId      string                     `json:"media_id,omitempty"`
	Title        string                     `json:"title,omitempty"`
	Description  string                     `json:"description,omitempty"`
	ThumbMediaId string                     `json:"thumb_media_id,omitempty"`
	MusicUrl     string                     `json:"music_url,omitempty"`
	HQMusicUrl   string                     `json:"hq_music_url,omitempty"`
	Articles     []*AutoReplyMessageArticle `json:"articles,omitempty"`
	ArticleId    string                     `json:"article_id,omitempty"`
	AppId        string                     `json:"appid,omitempty"`
	PagePath     string                     `json:"pagepath,omitempty"`
	CardId       string                     `json:"card_id,omitempty"`
}

func ConvertReplyDataToMessages

func ConvertReplyDataToMessages(replyData any) ([]*AutoReplyMessage, error)

*

  • 将回复数据转换为消息列表
  • @param replyData { replay_all: true, msg_list: [{}, {}] }

func GetReplyMessages

func GetReplyMessages(appid string, msg msghandler.Message) ([]*AutoReplyMessage, error)

func GetReplyMessagesForCommon

func GetReplyMessagesForCommon(appid string, replyType AutoReplyType, msg msghandler.Message) ([]*AutoReplyMessage, error)

订阅和消息回复,都属于公共的

func GetReplyMessagesForKeyword

func GetReplyMessagesForKeyword(appid string, replyType AutoReplyType, keyword string) ([]*AutoReplyMessage, error)

*

  • 关键词回复
  • 先查出全部的规则,然后在进行匹配
  • @param keyword 关键词

func GetReplyMessagesForMenuClick

func GetReplyMessagesForMenuClick(appid string, replyType AutoReplyType, key string) ([]*AutoReplyMessage, error)

菜单点击回复

type AutoReplyMessageArticle

type AutoReplyMessageArticle struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	PicUrl      string `json:"pic_url"`
	Url         string `json:"url"`
}

type AutoReplyType

type AutoReplyType string
const (
	AutoReplyTypeSubscribe AutoReplyType = "subscribe"
	AutoReplyTypeMessage   AutoReplyType = "message"
	AutoReplyTypeKeyword   AutoReplyType = "keyword"
	AutoReplyTypeMenuClick AutoReplyType = "menu_click"
)

type KeywordDef

type KeywordDef struct {
	Keyword string `json:"keyword"`
	Exact   bool   `json:"exact"`
}

Jump to

Keyboard shortcuts

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