Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to change default sound #10

Closed
kroeade opened this issue Feb 18, 2020 · 1 comment · Fixed by #12
Closed

Add option to change default sound #10

kroeade opened this issue Feb 18, 2020 · 1 comment · Fixed by #12

Comments

@kroeade
Copy link

kroeade commented Feb 18, 2020

It's possible to add an option to change the default sound.
There are the changes done in the main.go file, leaving the default tone to the default "pushover":

diff --git a/main.go b/main.go
index a4cd30b..4ac7f7b 100644
--- a/main.go
+++ b/main.go
@@ -17,6 +17,7 @@ const (
        pushoverUserKey  = "pushoverUserKey"
        messageBody      = "messageBody"
        messageTitle     = "messageTitle"
+       messageSound     = "messageSound"
        okPriority       = "okPriority"
        warningPriority  = "warningPriority"
        criticalPriority = "criticalPriority"
@@ -31,6 +32,7 @@ type HandlerConfig struct {
        PushoverUserKey      string
        MessageBodyTemplate  string
        MessageTitleTemplate string
+       MessageSound         string
        OkPriority           uint64
        WarningPriority      uint64
        CriticalPriority     uint64
@@ -82,6 +84,14 @@ var (
                        Usage:     "The message body, in token substitution format",
                        Value:     &config.MessageBodyTemplate,
                },
+               {
+                       Path:      messageSound,
+                       Argument:  messageSound,
+                       Shorthand: "s",
+                       Default:   "pushover",
+                       Usage:     "The sound of the message",
+                       Value:     &config.MessageSound,
+               },
                {
                        Path:      okPriority,
                        Argument:  okPriority,
@@ -181,6 +191,7 @@ func SendPushover(event *corev2.Event) error {
        pushoverForm.Add("token", config.PushoverToken)
        pushoverForm.Add("user", config.PushoverUserKey)
        pushoverForm.Add("priority", priority)
+       pushoverForm.Add("sound", config.MessageSound)
        pushoverForm.Add("title", messageTitle)
        pushoverForm.Add("message", messageBody)
@nixwiz
Copy link
Owner

nixwiz commented Feb 18, 2020

Thanks @kroeade , I'll look at getting this added in today or tomorrow1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants