diff options
| author | jason | 2016-08-23 10:54:40 -0600 |
|---|---|---|
| committer | jason | 2016-08-23 10:54:40 -0600 |
| commit | 4cfcd2f373ead1540d53e891df2c14b9a5bab19c (patch) | |
| tree | 428c6b704df98bbb9cbd48416b8256ccb06b5b5a /warmachine/connections/slack.py | |
| parent | c69288efc97dd9f2628036687a20e5aaaf51e159 (diff) | |
| download | warmachine-ng-4cfcd2f373ead1540d53e891df2c14b9a5bab19c.tar.gz warmachine-ng-4cfcd2f373ead1540d53e891df2c14b9a5bab19c.zip | |
Fix a crash when slack sends a message without a 'type' property
Diffstat (limited to 'warmachine/connections/slack.py')
| -rw-r--r-- | warmachine/connections/slack.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/warmachine/connections/slack.py b/warmachine/connections/slack.py index 5556abd..26113b9 100644 --- a/warmachine/connections/slack.py +++ b/warmachine/connections/slack.py | |||
| @@ -74,6 +74,12 @@ class SlackWS(Connection): | |||
| 74 | return | 74 | return |
| 75 | 75 | ||
| 76 | self.log.debug('new slack message: {}'.format(message)) | 76 | self.log.debug('new slack message: {}'.format(message)) |
| 77 | |||
| 78 | # Sometimes there isn't a type in the message we receive | ||
| 79 | if 'type' not in message: | ||
| 80 | self.log.error('Received typeless message: {}'.format(message)) | ||
| 81 | return | ||
| 82 | |||
| 77 | if message['type'] == 'message' and 'subtype' not in message: | 83 | if message['type'] == 'message' and 'subtype' not in message: |
| 78 | # Handle text messages from users | 84 | # Handle text messages from users |
| 79 | return await self.process_message(message) | 85 | return await self.process_message(message) |