dingding

package
v0.0.0-...-4871d7d Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendMarkdown

func SendMarkdown(accessToken, title, content string, opts ...BotOption) error

SendMarkdown send markdown to ding ding bot.

func SendText

func SendText(accessToken, content string, opts ...BotOption) error

SendText send text to ding ding bot.

Types

type At

type At struct {
	AtMobiles []string `json:"atMobiles"`
	AtUserIds []string `json:"atUserIds"`
	IsAtAll   bool     `json:"isAtAll"`
}

At 群消息是否@其他人.

type Bot

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

Bot 钉钉群聊机器人.

func NewBot

func NewBot(accessToken string, opts ...BotOption) *Bot

NewBot new a ding ding bot. 目前只支持发送text,markdown消息类型. 若想支持其它消息类型,需要自己添加.

其它消息类型请参考钉钉消息类型格式:
https://developers.dingtalk.com/document/robots/message-types-and-data-format.

func (*Bot) SendMarkdown

func (b *Bot) SendMarkdown(title, content string) (resp string, err error)

SendMarkdown send markdown message.

func (*Bot) SendMessage

func (b *Bot) SendMessage() (resp string, err error)

SendMessage 发送message. message 不能为空.

func (*Bot) SendText

func (b *Bot) SendText(content string) (resp string, err error)

SendText send text message.

type BotOption

type BotOption func(*Bot)

BotOption bot option.

func WithAtAll

func WithAtAll(isAtAll bool) BotOption

WithAtAll set at all. default is false.

func WithAtUserIds

func WithAtUserIds(atUserIds []string) BotOption

WithAtUserIds set at user ids. default is empty.

func WithMobiles

func WithMobiles(mobiles []string) BotOption

WithMobiles set mobiles. default is empty.

func WithSecret

func WithSecret(secret string) BotOption

WithSecret set secret.

func WithUrl

func WithUrl(url string) BotOption

WithUrl set url.

type Markdown

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

Markdown markdown.

type Message

type Message struct {
	Msgtype  string    `json:"msgtype"`
	Text     *Text     `json:"text"`
	Markdown *Markdown `json:"markdown"`
	At       *At       `json:"at"`
}

Message 钉钉消息. 目前只支持发送text,markdown消息类型. 若想支持其它消息类型,需要自己添加.

其它消息类型请参考钉钉消息类型格式:
https://developers.dingtalk.com/document/robots/message-types-and-data-format.

type Text

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

Text 文本.

Jump to

Keyboard shortcuts

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