robots

package
v2.1.69 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildContent

func BuildContent(kvs []MarkdownKV) string

func FormatError

func FormatError(err error) string

FormatError 将error转换成文字,并且标红

Types

type MarkdownKV

type MarkdownKV struct {
	Key       string
	KeySuffix string
	Value     interface{}
}

func GeneralHeader

func GeneralHeader() []MarkdownKV

GeneralHeader 通用kv,用于标识发送时间和来源

type MarkdownMsg

type MarkdownMsg struct {
	Msgtype  string `json:"msgtype"`
	Markdown struct {
		Title string `json:"title"`
		Text  string `json:"text"`
	} `json:"markdown"`
}

type Robot

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

func NewWithClient

func NewWithClient(client *httpRequest.HttpClient) *Robot

NewWithClient 使用已有的client初始化

func NewWithUrl

func NewWithUrl(webhookUrl string) *Robot

NewWithUrl 使用url初始化

func (*Robot) SendMarkdown

func (r *Robot) SendMarkdown(ctx context.Context, title, content string) error

func (*Robot) SendMarkdownKVs

func (r *Robot) SendMarkdownKVs(ctx context.Context, title string, kvs []MarkdownKV) error

SendMarkdownKVs 该方法会把MarkdownKV,展示为key: value形式

func (*Robot) SendTextMsg

func (r *Robot) SendTextMsg(ctx context.Context, content string) error

type TextMsg

type TextMsg struct {
	Msgtype string `json:"msgtype"`
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
}

Jump to

Keyboard shortcuts

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