mirror of
https://github.com/kha7iq/pingme.git
synced 2025-05-15 14:20:18 -07:00
feat: add priority for pushover messages
This commit is contained in:
parent
3ec42b8a4b
commit
600ce268ac
@ -16,6 +16,7 @@ type pushOver struct {
|
|||||||
Recipient string
|
Recipient string
|
||||||
Message string
|
Message string
|
||||||
Title string
|
Title string
|
||||||
|
Priority int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send parse values from *cli.context and return *cli.Command.
|
// Send parse values from *cli.context and return *cli.Command.
|
||||||
@ -61,10 +62,27 @@ All configuration options are also available via environment variables.`,
|
|||||||
Usage: "Title of the message.",
|
Usage: "Title of the message.",
|
||||||
EnvVars: []string{"PUSHOVER_TITLE"},
|
EnvVars: []string{"PUSHOVER_TITLE"},
|
||||||
},
|
},
|
||||||
|
&cli.IntFlag{
|
||||||
|
Destination: &pushOverOpts.Priority,
|
||||||
|
Name: "priority",
|
||||||
|
Aliases: []string{"p"},
|
||||||
|
Value: 0,
|
||||||
|
Usage: "Priority of the message.",
|
||||||
|
EnvVars: []string{"PUSHOVER_PRIORITY"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
app := pushover.New(pushOverOpts.Token)
|
app := pushover.New(pushOverOpts.Token)
|
||||||
message := pushover.NewMessageWithTitle(pushOverOpts.Message, pushOverOpts.Title)
|
|
||||||
|
// message := &pushover.Message{Title: pushOverOpts.Title, Message: pushOverOpts.Message, Priority: pushOverOpts.Priority}
|
||||||
|
|
||||||
|
message := &pushover.Message{Title: pushOverOpts.Title,
|
||||||
|
Message: pushOverOpts.Message,
|
||||||
|
Priority: pushOverOpts.Priority,
|
||||||
|
Retry: 60,
|
||||||
|
Expire: 3600,
|
||||||
|
}
|
||||||
|
|
||||||
users := strings.Split(pushOverOpts.Recipient, ",")
|
users := strings.Split(pushOverOpts.Recipient, ",")
|
||||||
|
|
||||||
for _, v := range users {
|
for _, v := range users {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user