Skip to content

Commit

Permalink
fix sleep logging message, bot token and channel required (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaric authored Oct 25, 2023
1 parent 3b6c5ce commit 1aff794
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/motion-poll/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func main() {
if ssUrl != "" && opts.SlackBotToken != "token" && opts.SlackChannelID != "" {
getAndUploadSnapshot(ssUrl, opts.SlackChannelID, *slackClient)
}
fmt.Printf(utils.SleepTemplate, opts.CooldownTimer)
time.Sleep(time.Duration(opts.CooldownTimer) * time.Second)
}
time.Sleep(1 * time.Second)
Expand Down
4 changes: 2 additions & 2 deletions pkg/model/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ type BasicParameters struct {
}

type SlackParameters struct {
SlackChannelID string `short:"c" long:"channel-id" description:"The ID of the slack channel where snapshots will be posted if provided" required:"false"`
SlackBotToken string `short:"b" long:"bot-token" description:"The token for the slack bot that will upload a snapshot if provided" required:"false" default:"token"`
SlackChannelID string `short:"c" long:"channel-id" description:"The ID of the slack channel where snapshots will be posted if provided" required:"true"`
SlackBotToken string `short:"b" long:"bot-token" description:"The token for the slack bot that will upload a snapshot if provided" required:"true"`
MessageTemplate string `short:"m" long:"message-template" description:"The message template in JSON format to use for notifications instead of the default one" required:"false" default:"Motion detected at %s"`
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/logTemplates.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package utils

const ArgParseError = "Error while parsing CLI args %v\n"

const SleepTemplate = "Sleeping for %d minutes\n"
const SleepTemplate = "Sleeping for %d seconds\n"

const ConnectionOK = "Connected to device %s\n"

Expand Down

0 comments on commit 1aff794

Please sign in to comment.