Ignore threaded messages

This commit is contained in:
Victor Truong 2020-07-30 03:32:10 -07:00
parent d07d84c60e
commit 4e9225c2f9

View file

@ -24,6 +24,11 @@ func onMessage(slackClient *slack.Client, event *slackevents.MessageEvent) {
return return
} }
// Ignore threaded messages.
if event.ThreadTimeStamp != "" {
return
}
// Attempt to extract a positive number at the start of a string. // Attempt to extract a positive number at the start of a string.
countPattern := regexp.MustCompile(`^\d+`) countPattern := regexp.MustCompile(`^\d+`)
matchedNumber, err := strconv.Atoi(countPattern.FindString(event.Text)) matchedNumber, err := strconv.Atoi(countPattern.FindString(event.Text))