robot

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: GPL-3.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

View Source
const (
	M_TEXT msgType = iota
	M_LINK
	M_MARKDOWN
	M_ACTIONCARD
	M_FEEDCARD
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionCard

type ActionCard struct {
	// Title 首屏会话透出的展示内容
	Title string `json:"title"`

	// Text markdown格式的消息
	Text string `json:"text"`

	// SingleTitle 单个按钮的方案。(设置此项和singleURL后btns无效)
	SingleTitle string `json:"singleTitle"`

	// SingleURL 点击singleTitle按钮触发的URL
	SingleURL string `json:"singleURL"`

	// HideAvatar      0-正常发消息者头像,1-隐藏发消息者头像
	HideAvatar string `json:"hideAvatar,omitempty"`

	// Btns 按钮的信息:title-按钮方案,actionURL-点击按钮触发的URL
	Btns []Btn `json:"btns,omitempty"`

	// BtnOrientation   0-按钮竖直排列,1-按钮横向排列
	BtnOrientation string `json:"btnOrientation,omitempty"`
}

ActionCard actionCard类型

func (*ActionCard) GetBtnOrientation

func (a *ActionCard) GetBtnOrientation() string

func (*ActionCard) GetBtns

func (a *ActionCard) GetBtns() []Btn

func (*ActionCard) GetHideAvatar

func (a *ActionCard) GetHideAvatar() string

func (*ActionCard) GetSingleTitle

func (a *ActionCard) GetSingleTitle() string

func (*ActionCard) GetSingleURL

func (a *ActionCard) GetSingleURL() string

func (*ActionCard) GetText

func (a *ActionCard) GetText() string

func (*ActionCard) GetTitle

func (a *ActionCard) GetTitle() string

func (ActionCard) GetType

func (ActionCard) GetType() string

func (*ActionCard) SetBtnOrientation

func (a *ActionCard) SetBtnOrientation(btnOrientation string)

func (*ActionCard) SetBtns

func (a *ActionCard) SetBtns(btns []Btn)

func (*ActionCard) SetHideAvatar

func (a *ActionCard) SetHideAvatar(hideAvatar string)

func (*ActionCard) SetSingleTitle

func (a *ActionCard) SetSingleTitle(singleTitle string)

func (*ActionCard) SetSingleURL

func (a *ActionCard) SetSingleURL(singleURL string)

func (*ActionCard) SetText

func (a *ActionCard) SetText(text string)

func (*ActionCard) SetTitle

func (a *ActionCard) SetTitle(title string)

type At

type At struct {
	// atMobiles 被@人的手机号(在text内容里要有@手机号)
	AtMobiles []string `json:"atMobiles,omitempty"`

	// isAtAll   @所有人时:true,否则为:false
	IsAtAll bool `json:"isAtAll,omitempty"`
}

At @

func (*At) GetAtMobiles

func (a *At) GetAtMobiles() []string

func (*At) GetIsAtAll

func (a *At) GetIsAtAll() bool

func (*At) SetAtMobiles

func (a *At) SetAtMobiles(atMobiles []string)

func (*At) SetIsAtAll

func (a *At) SetIsAtAll(isAtAll bool)

type Btn

type Btn struct {
	// Title 按钮方案
	Title string `json:"title"`

	// ActionURL 点击按钮触发的URL
	ActionURL string `json:"actionURL"`
}

Btn 按钮的信息

func (*Btn) GetActionURL

func (b *Btn) GetActionURL() string

func (*Btn) GetTitle

func (b *Btn) GetTitle() string

func (*Btn) SetActionURL

func (b *Btn) SetActionURL(actionURL string)

func (*Btn) SetTitle

func (b *Btn) SetTitle(title string)

type FeedCard

type FeedCard struct {
	Links []FeedCardLink `json:"links"`
}

FeedCard 资讯类信息

func (f *FeedCard) GetLinks() []FeedCardLink

func (FeedCard) GetType

func (FeedCard) GetType() string
func (f *FeedCard) SetLinks(links []FeedCardLink)
type FeedCardLink struct {
	//Title 单条信息文本
	Title string `json:"title"`

	// MessageURL 点击单条信息到跳转链接
	MessageURL string `json:"messageURL"`

	// PicURL 单条信息后面图片的URL
	PicURL string `json:"picURL"`
}

func (*FeedCardLink) GetMessageURL

func (f *FeedCardLink) GetMessageURL() string

func (*FeedCardLink) GetPicURL

func (f *FeedCardLink) GetPicURL() string

func (*FeedCardLink) GetTitle

func (f *FeedCardLink) GetTitle() string

func (*FeedCardLink) SetMessageURL

func (f *FeedCardLink) SetMessageURL(messageURL string)

func (*FeedCardLink) SetPicURL

func (f *FeedCardLink) SetPicURL(picURL string)

func (*FeedCardLink) SetTitle

func (f *FeedCardLink) SetTitle(title string)

type IMsg

type IMsg interface {
	GetType() string
}
type Link struct {
	// Title 消息标题
	Title string `json:"title"`

	// Text 消息内容。如果太长只会部分展示
	Text string `json:"text,omitempty"`

	// MessageURL 点击消息跳转的URL
	MessageURL string `json:"messageUrl"`

	// PicURL 图片URL
	PicURL string `json:"picUrl,omitempty"`
}

Link link类型

func (*Link) GetMessageUrl

func (l *Link) GetMessageUrl() string

func (*Link) GetPicURL

func (l *Link) GetPicURL() string

func (*Link) GetText

func (l *Link) GetText() string

func (*Link) GetTitle

func (l *Link) GetTitle() string

func (Link) GetType

func (Link) GetType() string

func (*Link) SetMessageUrl

func (l *Link) SetMessageUrl(messageURL string)

func (*Link) SetPicURL

func (l *Link) SetPicURL(picURL string)

func (*Link) SetText

func (l *Link) SetText(text string)

func (*Link) SetTitle

func (l *Link) SetTitle(title string)

type Markdown

type Markdown struct {
	// Title 首屏会话透出的展示内容
	Title string `json:"title"`

	// Text  markdown格式的消息
	Text string `json:"text"`
}

Markdown markdown类型

func (*Markdown) GetText

func (m *Markdown) GetText() string

func (*Markdown) GetTitle

func (m *Markdown) GetTitle() string

func (Markdown) GetType

func (Markdown) GetType() string

func (*Markdown) SetText

func (m *Markdown) SetText(text string)

func (*Markdown) SetTitle

func (m *Markdown) SetTitle(title string)

type Send

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

func NewSend

func NewSend(msg IMsg, options ...SendOption) *Send

func (*Send) GetApiName

func (r *Send) GetApiName() string

func (*Send) GetAt

func (r *Send) GetAt() *At

func (*Send) GetBody

func (r *Send) GetBody() ([]byte, error)

func (*Send) GetHeader

func (r *Send) GetHeader() map[string]string

func (*Send) GetMethod

func (r *Send) GetMethod() string

func (*Send) GetMsgType

func (r *Send) GetMsgType() string

func (*Send) GetSuccessCode

func (r *Send) GetSuccessCode() int64

func (*Send) SetAt

func (r *Send) SetAt(at *At)

type SendOption

type SendOption func(*Send)

func SendWithAtMobiles

func SendWithAtMobiles(atMobiles []string) SendOption

func SendWithIsAtAll

func SendWithIsAtAll(isAtAll bool) SendOption

type Text

type Text struct {
	// Content 消息内容
	Content string `json:"content"`
}

Text text类型

func (*Text) GetContent

func (t *Text) GetContent() string

func (Text) GetType

func (Text) GetType() string

func (*Text) SetContent

func (t *Text) SetContent(content string)

Jump to

Keyboard shortcuts

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