aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason2016-08-23 10:54:40 -0600
committerjason2016-08-23 10:54:40 -0600
commit4cfcd2f373ead1540d53e891df2c14b9a5bab19c (patch)
tree428c6b704df98bbb9cbd48416b8256ccb06b5b5a
parentc69288efc97dd9f2628036687a20e5aaaf51e159 (diff)
downloadwarmachine-ng-4cfcd2f373ead1540d53e891df2c14b9a5bab19c.tar.gz
warmachine-ng-4cfcd2f373ead1540d53e891df2c14b9a5bab19c.zip
Fix a crash when slack sends a message without a 'type' property
-rw-r--r--warmachine/connections/slack.py6
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)