robot

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level added in v0.0.24

type Level string

Level is a type that represents the level of a message.

const (
	LevelInfo    Level = "info"
	LevelWarning Level = "warning"
	LevelError   Level = "error"
)

Constants for the different levels of a message.

type SentTextRequest added in v0.0.24

type SentTextRequest struct {
	// Level is the level of the message.
	Level Level `json:"level"`
	// Content is the content of the message.
	Content string `json:"content"`
	// IsAtAll is a boolean indicating whether to mention all users.
	IsAtAll bool `json:"is_at_all"`
}

SentTextRequest is a struct that represents a request to send a text message. It contains the level of the message, the content of the message, and a boolean indicating whether to mention all users.

type WorkWechatRobot

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

WorkWechatRobot is a struct that represents a Work WeChat robot. It contains the URL of the Work WeChat robot.

func NewWorkWechatRobot

func NewWorkWechatRobot(url string) *WorkWechatRobot

NewWorkWechatRobot is a function that creates a new WorkWechatRobot object. It takes the URL of the Work WeChat robot as a parameter, and returns a pointer to the created WorkWechatRobot object.

func (*WorkWechatRobot) SendText

func (robot *WorkWechatRobot) SendText(req *SentTextRequest)

SendText is a method of WorkWechatRobot that sends a text message. It takes a pointer to a SentTextRequest struct as a parameter. The method constructs the message, creates a POST request with the message in the body, and sends the request to the Work WeChat robot. If there is an error in creating the request or sending the request, the method logs the error.

Jump to

Keyboard shortcuts

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