Merge pull request #163 from velour/msgtypes

slackapp: filter out ungood message types
This commit is contained in:
Chris Sexton 2019-03-11 18:25:45 -04:00 committed by GitHub
commit bd169dd85b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -140,6 +140,17 @@ func (s *SlackApp) checkRingOrAdd(ts string) bool {
} }
func (s *SlackApp) msgReceivd(msg *slackevents.MessageEvent) { func (s *SlackApp) msgReceivd(msg *slackevents.MessageEvent) {
if msg.TimeStamp == "" {
log.Debug().
Str("type", msg.SubType).
Msg("ignoring an unhandled event type")
return
}
log.Debug().
Str("type", msg.SubType).
Msg("accepting a message")
if s.checkRingOrAdd(msg.TimeStamp) { if s.checkRingOrAdd(msg.TimeStamp) {
log.Debug(). log.Debug().
Str("ts", msg.TimeStamp). Str("ts", msg.TimeStamp).