Skip to content

Commit

Permalink
feat: add priority for pushover messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kha7iq committed Nov 23, 2023
1 parent 3ec42b8 commit 600ce26
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion service/pushover/pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 600ce26

Please sign in to comment.