bot

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const DingtalkAddr = "https://oapi.dingtalk.com/robot/send"

Variables

This section is empty.

Functions

func Init

func Init(b Interface)

func Send

func Send(text string) error

func SendRaw

func SendRaw(raw any) error

Types

type Dingtalk

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

func NewDingtalk

func NewDingtalk(token, secret string) *Dingtalk

func (*Dingtalk) Name

func (bot *Dingtalk) Name() string

func (*Dingtalk) Send

func (bot *Dingtalk) Send(text string) error

func (*Dingtalk) SendRaw

func (bot *Dingtalk) SendRaw(raw any) error

func (*Dingtalk) Sign

func (bot *Dingtalk) Sign(secret string) (string, string)

type DingtalkAt

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

type DingtalkMarkdown

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

type DingtalkReq

type DingtalkReq struct {
	MsgType string      `json:"msgtype"` // such as: "text", "markdown"
	At      *DingtalkAt `json:"at,omitempty"`

	Text     *DingtalkText     `json:"text,omitempty"`
	Markdown *DingtalkMarkdown `json:"markdown,omitempty"`
}

type DingtalkResp

type DingtalkResp struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

type DingtalkText

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

type Interface

type Interface interface {
	Name() string
	Send(text string) error
	SendRaw(raw any) error
}

func Bot

func Bot() Interface

Jump to

Keyboard shortcuts

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