Merge pull request #74 from kha7iq/priority-for-pushover

feat: add priority for pushover messages
pull/76/head
Khaliq 1 year ago committed by GitHub
commit db4a0fe266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,6 +16,7 @@ type pushOver struct {
Recipient string
Message string
Title string
Priority int
}
// 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.",
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 {
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, ",")
for _, v := range users {

Loading…
Cancel
Save