mirror of https://github.com/statping/statping
Update Online Message for Telegram Notifier
parent
2a3c682013
commit
c9f140f2dc
|
@ -20,6 +20,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hunterlong/statping/core/notifier"
|
"github.com/hunterlong/statping/core/notifier"
|
||||||
|
"github.com/hunterlong/statping/core"
|
||||||
"github.com/hunterlong/statping/types"
|
"github.com/hunterlong/statping/types"
|
||||||
"github.com/hunterlong/statping/utils"
|
"github.com/hunterlong/statping/utils"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -99,7 +100,12 @@ func (u *telegram) OnFailure(s *types.Service, f *types.Failure) {
|
||||||
func (u *telegram) OnSuccess(s *types.Service) {
|
func (u *telegram) OnSuccess(s *types.Service) {
|
||||||
if !s.Online {
|
if !s.Online {
|
||||||
u.ResetUniqueQueue(fmt.Sprintf("service_%v", s.Id))
|
u.ResetUniqueQueue(fmt.Sprintf("service_%v", s.Id))
|
||||||
msg := fmt.Sprintf("Your service '%v' is back online!", s.Name)
|
var msg interface{}
|
||||||
|
if core.CoreApp.UpdateNotify.Bool {
|
||||||
|
msg = core.ReturnService(s).SmallText()
|
||||||
|
} else {
|
||||||
|
msg = fmt.Sprintf("Your service '%v' is currently offline!", s.Name)
|
||||||
|
}
|
||||||
u.AddQueue(fmt.Sprintf("service_%v", s.Id), msg)
|
u.AddQueue(fmt.Sprintf("service_%v", s.Id), msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue