feat: add priority for pushover messages

pull/74/head
Khaliq 1 year ago
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…
Cancel
Save