Ejemplo n.º 1
0
func (p *pushoverNotification) notify(msg []byte) error {
	sent := pushover.Notify(p.identity, string(msg))
	if !sent {
		return fmt.Errorf("pushover notification failed.")
	}
	return nil
}
Ejemplo n.º 2
0
func notify(destination, message string) error {
	// TODO: cache this.
	pushauth := pushover.Authenticate(config.PushoverKey, destination)
	if !pushover.Notify(pushauth, message) {
		return fmt.Errorf("pushover notification failed.")
	}
	return nil
}
Ejemplo n.º 3
0
func sendNotification() bool {
	identity := pushover.Authenticate("ajUCEgKvd9QmeMKFHBmvwMct1DYytx", "iBzANa9RG4jhS3s9QK9MAGNruSoGSz")
	sent := pushover.Notify(identity, "turn on server")
	if !sent {
		///log
		return false
	}
	return true
}
Ejemplo n.º 4
0
func PushoverBackend(file *ini.File, event *string, text *string) {
	api_key, ok := file.Get("pushover", "api_key")
	if !ok {
		log.Fatal("Pushover API key not found")
	}

	user_key, ok := file.Get("pushover", "user_key")
	if !ok {
		log.Fatal("Pushover User key not found")
	}

	identity := pushover.Authenticate(api_key, user_key)
	sent := pushover.Notify(identity, fmt.Sprintf("%s:%s", event, text))
	if !sent {
		fmt.Println("[!] notification failed.")
		os.Exit(1)
	}
}