Files
vRp.CD2g_test/notify/senders/README.md
2024-01-15 10:37:51 +08:00

1.5 KiB

Senders

Go doc

senders Package 包含了内置通知发送器的实现

目录导航

列出了该 package 下所有的函数及类型定义,可通过目录导航进行快捷跳转 ❤️

展开 / 折叠目录导航

包级函数定义

函数名称 描述
NewFeiShu 根据特定的 webhook 地址创建飞书发送器

类型定义

类型 名称 描述
STRUCT FeiShu 飞书发送器

详情信息

func NewFeiShu(webhook string) *FeiShu

根据特定的 webhook 地址创建飞书发送器


FeiShu STRUCT

飞书发送器

type FeiShu struct {
	client  *resty.Client
	webhook string
}

func (*FeiShu) Push(notify notify.Notify) error

推送通知

查看 / 收起单元测试

func TestFeiShu_Push(t *testing.T) {
	fs := NewFeiShu("https://open.feishu.cn/open-apis/bot/v2/hook/d886f30f-814c-47b1-aeb0-b508da0f7f22")
	rt := notifies.NewFeiShu(notifies.FeiShuMessageWithRichText(notifies.NewFeiShuRichText().Create("zh_cn", "标题咯").AddText("哈哈哈").Ok()))
	if err := fs.Push(rt); err != nil {
		panic(err)
	}
}