Skip to content

Commit

Permalink
Allow msg to be set manually and don't overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Walsh committed Aug 22, 2018
1 parent 1f4b53d commit 37ceb08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ config := pushover.GetConfigEnv()
config := pushover.GetConfigFile(file)

msg := pushover.NewMessageConfig(config)
res, err := m.Push("message")
res, err := msg.Push("message")

if err != nil {
fmt.Errorf("Error sending message: %s\n", err.Error())
Expand Down
6 changes: 3 additions & 3 deletions pushover/pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func NewMessageConfig(config Config) *Message {
func (m *Message) Push(message string) (r *Response, err error) {
r = &Response{}

if message == "" {
if message == "" && m.Message == "" {
return r, errors.New("Message can not be blank")
} else if m.Message == "" {
m.Message = message
}
m.Message = message

// Check that required items are set
if m.Priority == PriorityEmergency {
err = m.EmergencyParamsSet()
Expand Down

0 comments on commit 37ceb08

Please sign in to comment.