message

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

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

Chat 群聊会话

func (*Chat) Create

func (c *Chat) Create(req CreateChatRequest) (string, error)

Create 创建群聊会话

func (*Chat) Get

func (c *Chat) Get(chatId string) (*ChatInfo, error)

Get 获取群聊会话

func (*Chat) Send

func (c *Chat) Send(chatId string, msg Messenger, safe ...int) error

Send 应用推送消息到群聊会话

func (*Chat) Update

func (c *Chat) Update(req UpdateChatRequest) error

Update 修改群聊会话

type ChatInfo

type ChatInfo struct {
	ChatId   string   `json:"chatid"`
	Name     string   `json:"name"`
	Owner    string   `json:"owner"`
	UserList []string `json:"userlist"`
}

ChatInfo 群聊会话信息

type CreateChatRequest

type CreateChatRequest struct {
	Name     string   `json:"name,omitempty"`
	Owner    string   `json:"owner,omitempty"`
	UserList []string `json:"userlist"`
	ChatId   string   `json:"chatid,omitempty"`
}

CreateChatRequest 创建群聊会话请求

type File

type File struct {
	MediaId string `json:"media_id"`
}

File 文件消息

func (*File) MsgType

func (f *File) MsgType() string

type Image

type Image struct {
	MediaId string `json:"media_id"`
}

Image 图片消息

func (*Image) MsgType

func (i *Image) MsgType() string

type Markdown

type Markdown struct {
	Content string `json:"content"`
}

Markdown markdown消息

func (*Markdown) MsgType

func (md *Markdown) MsgType() string

type Message

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

Message 应用消息

func NewMessage

func NewMessage(account contracts.AccountInterface) *Message

func (*Message) Chat

func (m *Message) Chat() *Chat

Chat 群聊会话

func (*Message) Recall

func (m *Message) Recall(msgId string) error

Recall 撤回应用消息

func (*Message) Send

func (m *Message) Send(opt SendOption, msg Messenger) (*SendResult, error)

Send 发送应用消息

func (*Message) UpdateTemplateCard

func (m *Message) UpdateTemplateCard(req UpdateTemplateCardRequest) (*UpdateTemplateCardResult, error)

UpdateTemplateCard 更新模版卡片消息

type Messenger

type Messenger interface {
	MsgType() string
}

Messenger 消息接口

type MiniProgramNotice

type MiniProgramNotice struct {
	AppId             string                  `json:"appid"`
	Page              string                  `json:"page,omitempty"`
	Title             string                  `json:"title"`
	Description       string                  `json:"description,omitempty"`
	EmphasisFirstItem bool                    `json:"emphasis_first_item,omitempty"`
	ContentItem       []MiniProgramNoticeItem `json:"content_item,omitempty"`
}

MiniProgramNotice 小程序通知消息

func (*MiniProgramNotice) MsgType

func (mp *MiniProgramNotice) MsgType() string

type MiniProgramNoticeItem

type MiniProgramNoticeItem struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

MiniProgramNoticeItem 小程序通知消息-内容项

type MpNews

type MpNews struct {
	Articles []MpNewsArticle `json:"articles"`
}

MpNews mpnews图文消息

func (*MpNews) MsgType

func (m *MpNews) MsgType() string

type MpNewsArticle

type MpNewsArticle struct {
	Title            string `json:"title"`
	ThumbMediaId     string `json:"thumb_media_id"`
	Author           string `json:"author,omitempty"`
	ContentSourceUrl string `json:"content_source_url,omitempty"`
	Content          string `json:"content"`
	Digest           string `json:"digest,omitempty"`
}

MpNewsArticle mpnews图文消息-文章

type News

type News struct {
	Articles []NewsArticle `json:"articles"`
}

News 图文消息

func (*News) MsgType

func (n *News) MsgType() string

type NewsArticle

type NewsArticle struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Url         string `json:"url,omitempty"`
	PicUrl      string `json:"picurl,omitempty"`
	AppId       string `json:"appid,omitempty"`
	PagePath    string `json:"pagepath,omitempty"`
}

NewsArticle 图文消息-文章

type RecallRequest

type RecallRequest struct {
	MsgId string `json:"msgid"`
}

RecallRequest 撤回应用消息请求

type SendOption

type SendOption struct {
	ToUser                 string `json:"touser,omitempty"`
	ToParty                string `json:"toparty,omitempty"`
	ToTag                  string `json:"totag,omitempty"`
	AgentId                int64  `json:"agentid"`
	Safe                   int    `json:"safe,omitempty"`
	EnableIdTrans          int    `json:"enable_id_trans,omitempty"`
	EnableDuplicateCheck   int    `json:"enable_duplicate_check,omitempty"`
	DuplicateCheckInterval int    `json:"duplicate_check_interval,omitempty"`
}

SendOption 发送应用消息选项

type SendResult

type SendResult struct {
	InvalidUser    string `json:"invaliduser"`
	InvalidParty   string `json:"invalidparty"`
	InvalidTag     string `json:"invalidtag"`
	UnlicensedUser string `json:"unlicenseduser"`
	MsgId          string `json:"msgid"`
	ResponseCode   string `json:"response_code"`
}

SendResult 发送应用消息结果

type TemplateCard

type TemplateCard struct {
	CardType              string                          `json:"card_type"`
	Source                *TemplateCardSource             `json:"source,omitempty"`
	ActionMenu            *TemplateCardActionMenu         `json:"action_menu,omitempty"`
	TaskId                string                          `json:"task_id,omitempty"`
	MainTitle             *TemplateCardTitle              `json:"main_title,omitempty"`
	QuoteArea             *TemplateCardQuoteArea          `json:"quote_area,omitempty"`
	EmphasisContent       *TemplateCardEmphasis           `json:"emphasis_content,omitempty"`
	SubTitleText          string                          `json:"sub_title_text,omitempty"`
	HorizontalContentList []TemplateCardHorizontalContent `json:"horizontal_content_list,omitempty"`
	JumpList              []TemplateCardJump              `json:"jump_list,omitempty"`
	CardAction            *TemplateCardAction             `json:"card_action,omitempty"`
	ButtonSelection       *TemplateCardButtonSelection    `json:"button_selection,omitempty"`
	ButtonList            []TemplateCardButton            `json:"button_list,omitempty"`
	CheckBox              *TemplateCardCheckBox           `json:"checkbox,omitempty"`
	SelectList            []TemplateCardSelect            `json:"select_list,omitempty"`
	SubmitButton          *TemplateCardSubmitButton       `json:"submit_button,omitempty"`
	ImageTextArea         *TemplateCardImageTextArea      `json:"image_text_area,omitempty"`
	CardImage             *TemplateCardCardImage          `json:"card_image,omitempty"`
	VerticalContentList   []TemplateCardVerticalContent   `json:"vertical_content_list,omitempty"`
}

TemplateCard 模版卡片消息

func (*TemplateCard) MsgType

func (tc *TemplateCard) MsgType() string

type TemplateCardAction

type TemplateCardAction struct {
	Type     int    `json:"type,omitempty"`
	Url      string `json:"url,omitempty"`
	AppId    string `json:"appid,omitempty"`
	PagePath string `json:"pagepath,omitempty"`
}

TemplateCardAction 模版卡片-整体卡片点击

type TemplateCardActionMenu

type TemplateCardActionMenu struct {
	Desc       string                       `json:"desc,omitempty"`
	ActionList []TemplateCardActionMenuItem `json:"action_list"`
}

TemplateCardActionMenu 模版卡片-操作菜单

type TemplateCardActionMenuItem

type TemplateCardActionMenuItem struct {
	Text string `json:"text"`
	Key  string `json:"key"`
}

TemplateCardActionMenuItem 模版卡片-操作菜单项

type TemplateCardButton

type TemplateCardButton struct {
	Text  string `json:"text"`
	Style int    `json:"style,omitempty"`
	Key   string `json:"key,omitempty"`
	Type  int    `json:"type,omitempty"`
	Url   string `json:"url,omitempty"`
}

TemplateCardButton 模版卡片-按钮

type TemplateCardButtonSelection

type TemplateCardButtonSelection struct {
	QuestionKey string                              `json:"question_key"`
	Title       string                              `json:"title,omitempty"`
	OptionList  []TemplateCardButtonSelectionOption `json:"option_list"`
	SelectedId  string                              `json:"selected_id,omitempty"`
}

TemplateCardButtonSelection 模版卡片-下拉式按钮

type TemplateCardButtonSelectionOption

type TemplateCardButtonSelectionOption struct {
	Id   string `json:"id"`
	Text string `json:"text"`
}

TemplateCardButtonSelectionOption 模版卡片-下拉式按钮选项

type TemplateCardCardImage

type TemplateCardCardImage struct {
	Url         string  `json:"url"`
	AspectRatio float64 `json:"aspect_ratio,omitempty"`
}

TemplateCardCardImage 模版卡片-图片

type TemplateCardCheckBox

type TemplateCardCheckBox struct {
	QuestionKey string                       `json:"question_key"`
	OptionList  []TemplateCardCheckBoxOption `json:"option_list"`
	Mode        int                          `json:"mode,omitempty"`
}

TemplateCardCheckBox 模版卡片-选择题

type TemplateCardCheckBoxOption

type TemplateCardCheckBoxOption struct {
	Id        string `json:"id"`
	Text      string `json:"text"`
	IsChecked bool   `json:"is_checked,omitempty"`
}

TemplateCardCheckBoxOption 模版卡片-选择题选项

type TemplateCardEmphasis

type TemplateCardEmphasis struct {
	Title string `json:"title,omitempty"`
	Desc  string `json:"desc,omitempty"`
}

TemplateCardEmphasis 模版卡片-关键数据

type TemplateCardHorizontalContent

type TemplateCardHorizontalContent struct {
	KeyName string `json:"keyname,omitempty"`
	Value   string `json:"value,omitempty"`
	Type    int    `json:"type,omitempty"`
	Url     string `json:"url,omitempty"`
	MediaId string `json:"media_id,omitempty"`
	Userid  string `json:"userid,omitempty"`
}

TemplateCardHorizontalContent 模版卡片-二级标题+文本

type TemplateCardImageTextArea

type TemplateCardImageTextArea struct {
	Type     int    `json:"type,omitempty"`
	Url      string `json:"url,omitempty"`
	AppId    string `json:"appid,omitempty"`
	PagePath string `json:"pagepath,omitempty"`
	Title    string `json:"title,omitempty"`
	Desc     string `json:"desc,omitempty"`
	ImageUrl string `json:"image_url"`
}

TemplateCardImageTextArea 模版卡片-左图右文

type TemplateCardJump

type TemplateCardJump struct {
	Type     int    `json:"type,omitempty"`
	Url      string `json:"url,omitempty"`
	Title    string `json:"title"`
	AppId    string `json:"appid,omitempty"`
	PagePath string `json:"pagepath,omitempty"`
}

TemplateCardJump 模版卡片-跳转

type TemplateCardQuoteArea

type TemplateCardQuoteArea struct {
	Type      int    `json:"type,omitempty"`
	Url       string `json:"url,omitempty"`
	AppId     string `json:"appid,omitempty"`
	PagePath  string `json:"pagepath,omitempty"`
	Title     string `json:"title,omitempty"`
	QuoteText string `json:"quote_text,omitempty"`
}

TemplateCardQuoteArea 模版卡片-引用区域

type TemplateCardSelect

type TemplateCardSelect struct {
	QuestionKey string                     `json:"question_key"`
	Title       string                     `json:"title,omitempty"`
	SelectedId  string                     `json:"selected_id,omitempty"`
	OptionList  []TemplateCardSelectOption `json:"option_list"`
}

TemplateCardSelect 模版卡片-下拉选择器

type TemplateCardSelectOption

type TemplateCardSelectOption struct {
	Id   string `json:"id"`
	Text string `json:"text"`
}

TemplateCardSelectOption 模版卡片-下拉选择器选项

type TemplateCardSource

type TemplateCardSource struct {
	IconUrl   string `json:"icon_url,omitempty"`
	Desc      string `json:"desc,omitempty"`
	DescColor int    `json:"desc_color,omitempty"`
}

TemplateCardSource 模版卡片-来源

type TemplateCardSubmitButton

type TemplateCardSubmitButton struct {
	Text string `json:"text"`
	Key  string `json:"key"`
}

TemplateCardSubmitButton 模版卡片-提交按钮

type TemplateCardTitle

type TemplateCardTitle struct {
	Title string `json:"title,omitempty"`
	Desc  string `json:"desc,omitempty"`
}

TemplateCardTitle 模版卡片-主标题

type TemplateCardVerticalContent

type TemplateCardVerticalContent struct {
	Title string `json:"title"`
	Desc  string `json:"desc,omitempty"`
}

TemplateCardVerticalContent 模版卡片-纵向内容

type Text

type Text struct {
	Content             string   `json:"content"`
	MentionedList       []string `json:"mentioned_list,omitempty"`
	MentionedMobileList []string `json:"mentioned_mobile_list,omitempty"`
}

Text 文本消息

func (*Text) MsgType

func (t *Text) MsgType() string

type TextCard

type TextCard struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Url         string `json:"url"`
	BtnTxt      string `json:"btntxt,omitempty"`
}

TextCard 文本卡片消息

func (*TextCard) MsgType

func (tc *TextCard) MsgType() string

type UpdateButton

type UpdateButton struct {
	ReplaceName string `json:"replace_name"`
}

UpdateButton 更新模版卡片-按钮

type UpdateChatRequest

type UpdateChatRequest struct {
	ChatId      string   `json:"chatid"`
	Name        string   `json:"name,omitempty"`
	Owner       string   `json:"owner,omitempty"`
	AddUserList []string `json:"add_user_list,omitempty"`
	DelUserList []string `json:"del_user_list,omitempty"`
}

UpdateChatRequest 修改群聊会话请求

type UpdateTemplateCardRequest

type UpdateTemplateCardRequest struct {
	UserIds      []string      `json:"userids,omitempty"`
	PartyIds     []int         `json:"partyids,omitempty"`
	TagIds       []int         `json:"tagids,omitempty"`
	AtAll        int           `json:"atall,omitempty"`
	AgentId      int64         `json:"agentid"`
	ResponseCode string        `json:"response_code"`
	Button       *UpdateButton `json:"button,omitempty"`
	TemplateCard *TemplateCard `json:"template_card,omitempty"`
}

UpdateTemplateCardRequest 更新模版卡片消息请求

type UpdateTemplateCardResult

type UpdateTemplateCardResult struct {
	InvalidUser []string `json:"invaliduser"`
}

UpdateTemplateCardResult 更新模版卡片消息结果

type Video

type Video struct {
	MediaId     string `json:"media_id"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

Video 视频消息

func (*Video) MsgType

func (v *Video) MsgType() string

type Voice

type Voice struct {
	MediaId string `json:"media_id"`
}

Voice 语音消息

func (*Voice) MsgType

func (v *Voice) MsgType() string

Jump to

Keyboard shortcuts

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