bot

package module
v0.0.0-...-f7f54a0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

企业微信

软件架构

软件架构说明

使用说明

# 替换 test 为环境变量中的定义
curl localhost:9000/test/txt?title=title\&warn=warn\&comment=cmt -X POST -d 'msg=abcde'
# 测试 img 发送
curl localhost:9000/test/img/?title=title -X POST -d 'msg=abcde'
示例
func sendMsg(title, msg string) {
	var form = make(url.Values)
	form.Add("msg", msg)
	form.Add("title", title)
	_, err := http.PostForm(wxchatURL, form) // wxchatURL=http://localhost:9000/test/img
	if err != nil {
		logrus.Error("sendmsg error: ", err.Error())
	}
}
生成镜像
# 先编码再做镜像(要用centos基础镜像)
go build -o wxchatbot main/main.go
docker build -t harbor.do.io/haifengat/wxchatbot:`date +%Y%m%d` . && docker push harbor.do.io/haifengat/wxchatbot:`date +%Y%m%d`

20210409

  1. 支持多机器人
    1. 环境变量 bots: '{"test":"59f75927-dce5-45ba-94b0-d63679e9a914"}'

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendImg

func SendImg(botKey, title string, lines ...string) error

SendImg 发送图片

func SendMsg

func SendMsg(botKey, title, warn, msg, comment string) error

SendMsg 发送消息 botKey 机器人的Key

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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