aboutsummaryrefslogtreecommitdiffstats
path: root/warmachine/connections/slack.py
diff options
context:
space:
mode:
authorjason2016-08-19 10:39:40 -0600
committerjason2016-08-19 10:39:40 -0600
commit3a8d973943305ddf7bea7b58a3adccee56309f7c (patch)
tree3d17162ac8421c6c6c55a2dc3ca5645f9d5b1a6d /warmachine/connections/slack.py
parenta6b4e3c30e27cd847e56edf18a32a3f460bc0052 (diff)
downloadwarmachine-ng-3a8d973943305ddf7bea7b58a3adccee56309f7c.tar.gz
warmachine-ng-3a8d973943305ddf7bea7b58a3adccee56309f7c.zip
fix a bug where sometimes is_bot isn't in part of user info
Diffstat (limited to 'warmachine/connections/slack.py')
-rw-r--r--warmachine/connections/slack.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/warmachine/connections/slack.py b/warmachine/connections/slack.py
index 10b6354..938c541 100644
--- a/warmachine/connections/slack.py
+++ b/warmachine/connections/slack.py
@@ -107,8 +107,12 @@ class SlackWS(Connection):
107 else: 107 else:
108 _user = self.user_nick_to_id[destination] 108 _user = self.user_nick_to_id[destination]
109 109
110 if 'is_bot' not in self.user_map[_user]:
111 self.error('is_bot property not found for user {}'.format(
112 message['destination']))
113
110 # slack doesn't allow bots to message other bots 114 # slack doesn't allow bots to message other bots
111 if self.user_map[_user]['is_bot']: 115 if '#' not in destination and self.user_map[_user]['is_bot']:
112 return 116 return
113 117
114 destination = self.get_dm_id_by_user(_user) 118 destination = self.get_dm_id_by_user(_user)
@@ -191,7 +195,7 @@ class SlackWS(Connection):
191 195
192 async def process_message(self, msg): 196 async def process_message(self, msg):
193 if 'text' not in msg: 197 if 'text' not in msg:
194 raise Exception(msg) 198 self.log.error('key "text" not found in message: {}'.format(msg))
195 199
196 # Built-in !whois command. Return information about a particular user. 200 # Built-in !whois command. Return information about a particular user.
197 if msg['text'].startswith('!whois'): 201 if msg['text'].startswith('!whois'):