| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package main
- import (
- "fmt"
- "time"
- "git.wenlab.co/joe/beaconfire"
- "git.wenlab.co/joe/beaconfire/providers"
- )
- func main() {
- // multi channels
- var bfs []beaconfire.BeaconFire
- // workwx
- wx := providers.NewWorkWx(&providers.OptionsWorkwx{
- Key: "xfdd",
- })
- // telegram
- tg := providers.NewTelegram(&providers.OptionsTelegram{
- Token: "ttt",
- })
- // together
- bfs = append(bfs, wx, tg)
- // send
- var err error
- var name string
- for _, bf := range bfs {
- // checker original
- name = bf.Name()
- if name == providers.TELEGRAM_NAME {
- fmt.Println("telegram sending ...")
- }
- // send
- err = bf.Send(beaconfire.NewBeaconParam("subject", "im a message", time.Now().Unix(), ""))
- if err != nil {
- // log
- fmt.Println("Error:", err)
- }
- }
- }
|