dingding

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DINGDINGSendErr   = errors.New("send DINGDING fail")
	DINGDINGBadURLErr = errors.New("bad DINGDING URL")
)

Functions

func New

func New(proxy string) subscriber.Subscriber

func PrettyPrint

func PrettyPrint(content string, isWebhook bool) string

PrettyPrint 钉钉消息显示的处理 1. 如果 content 能反序列化成 string,那么使用反序列化后的内容作为钉钉消息内容 2. 如果 content 能使用json反序列,那么对使用带缩进的反序列化后的内容作为钉钉消息内容 3. 否则,直接使用 content

Types

type DDAt

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

type DDContent

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

example dingding message:

{
     "msgtype": "text",
     "text": {
         "content": "我就是我,  @1825718XXXX 是不一样的烟火"
     },
     "at": {
         "atMobiles": [
             "1825718XXXX"
         ],
         "isAtAll": false
     }
 }

type DDDest

type DDDest [][]string

[[A,B,C],[D,E,F],[G,H,I]] -> A,B,C 中随机选一个发送消息,如果失败则换这3个中的下一个地址来重试,D,E,F 和 G,H,I也一样

type DDMarkdown

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

type DDMessage

type DDMessage struct {
	Msgtype  string      `json:"msgtype"`
	Text     *DDContent  `json:"text,omitempty"`
	Markdown *DDMarkdown `json:"markdown,omitempty"`
	At       DDAt        `json:"at"`
}

type DDSubscriber

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

func (*DDSubscriber) DINGDINGSend

func (d *DDSubscriber) DINGDINGSend(u string, m *DDMessage) error

func (*DDSubscriber) Name

func (d *DDSubscriber) Name() string

func (*DDSubscriber) Publish

func (d *DDSubscriber) Publish(dest string, content string, time int64, msg *types.Message) []error

example URL:https://oapi.dingtalk.com/robot/send?access_token=xxxx

func (*DDSubscriber) Status

func (d *DDSubscriber) Status() interface{}

type LegacyDDDest

type LegacyDDDest []string

Jump to

Keyboard shortcuts

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