message

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BtnOrientationVertical   = "0"
	BtnOrientationHorizontal = "1"
)
View Source
const MaxFeedCardLinks = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionCard

type ActionCard struct {
	Message
	ActionCardBody *ActionCardBody `json:"actionCard"`
}

func NewActionCard

func NewActionCard() *ActionCard

func (*ActionCard) AddBtn

func (ac *ActionCard) AddBtn(btn *ActionCardBtnBody) *ActionCard

func (*ActionCard) SetBtnOrientation

func (ac *ActionCard) SetBtnOrientation(orientation string) *ActionCard

0-按钮竖直排列,1-按钮横向排列

func (*ActionCard) SetBtnTitle

func (ac *ActionCard) SetBtnTitle(title string) *ActionCard

单个按钮的标题。(设置此项和singleURL后btns无效)

func (*ActionCard) SetBtnUrl

func (ac *ActionCard) SetBtnUrl(url string) *ActionCard

点击singleTitle按钮触发的URL

func (*ActionCard) SetBtns

func (ac *ActionCard) SetBtns(btns []*ActionCardBtnBody) *ActionCard

按钮组

func (*ActionCard) SetText

func (ac *ActionCard) SetText(text string) *ActionCard

markdown格式的消息

func (*ActionCard) SetTitle

func (ac *ActionCard) SetTitle(title string) *ActionCard

首屏会话透出的展示内容

type ActionCardBody

type ActionCardBody struct {
	Title          string               `json:"title"`
	Text           string               `json:"text"`
	BtnOrientation string               `json:"btnOrientation,omitempty"`
	BtnTitle       string               `json:"singleTitle,omitempty"`
	BtnURL         string               `json:"singleURL,omitempty"`
	BtnsBody       []*ActionCardBtnBody `json:"btns,omitempty"`
}

type ActionCardBtnBody

type ActionCardBtnBody struct {
	Title string `json:"title"`
	Url   string `json:"actionURL"`
}

func NewActionCardBtn

func NewActionCardBtn() *ActionCardBtnBody

func (*ActionCardBtnBody) SetTitle

func (acbb *ActionCardBtnBody) SetTitle(text string) *ActionCardBtnBody

按钮标题

func (*ActionCardBtnBody) SetUrl

func (acbb *ActionCardBtnBody) SetUrl(url string) *ActionCardBtnBody

点击按钮触发的URL

type At

type At struct {
	AtBody *AtBody `json:"at,omitempty"`
}

func (*At) SetAtMobiles

func (at *At) SetAtMobiles(mobiles []string) *At

被@人的手机号(在content里添加@人的手机号)

func (*At) SetIsAll

func (at *At) SetIsAll(isAll bool) *At

是否@所有人

type AtBody

type AtBody struct {
	Mobiles []string `json:"atMobiles,omitempty"`
	IsAll   bool     `json:"isAtAll,omitempty"`
}

type FeedCard

type FeedCard struct {
	Message
	FeedCardBody *FeedCardBody `json:"feedCard"`
}

func NewFeedCard

func NewFeedCard() *FeedCard
func (fc *FeedCard) AddLink(link *FeedCardLinkBody) *FeedCard
func (fc *FeedCard) SetLinks(links []*FeedCardLinkBody) *FeedCard

type FeedCardBody

type FeedCardBody struct {
	Links []*FeedCardLinkBody `json:"links"`
}

type FeedCardLinkBody

type FeedCardLinkBody struct {
	Title string `json:"title"`
	Pic   string `json:"picURL"`
	Url   string `json:"messageURL"`
}
func NewFeedCardLink() *FeedCardLinkBody

func (*FeedCardLinkBody) SetPic

func (fclb *FeedCardLinkBody) SetPic(pic string) *FeedCardLinkBody

单条信息后面图片的URL

func (*FeedCardLinkBody) SetTitle

func (fclb *FeedCardLinkBody) SetTitle(text string) *FeedCardLinkBody

单条信息文本

func (*FeedCardLinkBody) SetUrl

func (fclb *FeedCardLinkBody) SetUrl(url string) *FeedCardLinkBody

点击单条信息到跳转链接

type IMessage

type IMessage interface {
	GetType() string
}
type Link struct {
	Message
	LinkBody *LinkBody `json:"link"`
}
func NewLink() *Link

func (*Link) SetPic

func (l *Link) SetPic(pic string) *Link

图片URL

func (*Link) SetText

func (l *Link) SetText(text string) *Link

消息内容。如果太长只会部分展示

func (*Link) SetTitle

func (l *Link) SetTitle(title string) *Link

消息标题

func (*Link) SetUrl

func (l *Link) SetUrl(url string) *Link

点击消息跳转的URL

type LinkBody

type LinkBody struct {
	Text  string `json:"text"`
	Title string `json:"title"`
	Pic   string `json:"picUrl"`
	Url   string `json:"messageUrl"`
}

type Markdown

type Markdown struct {
	Message
	At
	MarkdownBody *MarkdownBody `json:"markdown"`
}

func NewMarkdown

func NewMarkdown() *Markdown

func (*Markdown) SetText

func (m *Markdown) SetText(text string) *Markdown

markdown格式的消息

func (*Markdown) SetTitle

func (m *Markdown) SetTitle(title string) *Markdown

首屏会话透出的展示内容

type MarkdownBody

type MarkdownBody struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

type Message

type Message struct {
	Type string `json:"msgtype"`
}

func (*Message) GetType

func (m *Message) GetType() string

func (*Message) SetType

func (m *Message) SetType(t string) *Message

type Text

type Text struct {
	Message
	At
	TextBody *TextBody `json:"text"`
}

func NewText

func NewText() *Text

func (*Text) SetContent

func (t *Text) SetContent(content string) *Text

消息内容

type TextBody

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

Jump to

Keyboard shortcuts

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