https://github.com/cloud-org/msgpush
通用推送消息 simple sdk
https://github.com/cloud-org/msgpush
feishu golang pushdeer slack wecom
Last synced: 2 months ago
JSON representation
通用推送消息 simple sdk
- Host: GitHub
- URL: https://github.com/cloud-org/msgpush
- Owner: cloud-org
- Created: 2022-03-01T12:44:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-02T04:16:14.000Z (almost 4 years ago)
- Last Synced: 2025-03-08T15:49:58.981Z (over 1 year ago)
- Topics: feishu, golang, pushdeer, slack, wecom
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [msgpush](#msgpush)
- [usage](#usage)
- [acknowledgement](#acknowledgement)
### msgpush
通用推送消息 simple sdk
#### usage
```sh
go get -v github.com/cloud-org/msgpush
```
```go
type NotifyPush struct {
Notifys []msgpush.NotifyPush
}
func GetNotify(software, token string) (msgpush.NotifyPush, error) {
switch software {
case "dingtalk": // 钉钉推送
return msgpush.NewDingTalk(token), nil
case "wecom": // 企业微信推送
return msgpush.NewWeCom(token), nil
case "slack": // slack 推送
return msgpush.NewSlack(token), nil
case "pushdeer":
return msgpush.NewPushDeer(token), nil
case "feishu":
return msgpush.NewFeiShu(token), nil
default:
return nil, fmt.Errorf("暂时不支持类型 %v", software)
}
}
func (n *NotifyPush) Push(content string) {
if n == nil {
logx.Infof("notify push not init")
return
}
for i := 0; i < len(n.Notifys); i++ {
if err := n.Notifys[i].Send(content); err != nil {
logx.Infof("notify err: %v", err)
continue
}
}
}
```
#### acknowledgement
- github.com/imroc/req