diff options
| author | jason | 2016-08-19 10:39:40 -0600 |
|---|---|---|
| committer | jason | 2016-08-19 10:39:40 -0600 |
| commit | 3a8d973943305ddf7bea7b58a3adccee56309f7c (patch) | |
| tree | 3d17162ac8421c6c6c55a2dc3ca5645f9d5b1a6d | |
| parent | a6b4e3c30e27cd847e56edf18a32a3f460bc0052 (diff) | |
| download | warmachine-ng-3a8d973943305ddf7bea7b58a3adccee56309f7c.tar.gz warmachine-ng-3a8d973943305ddf7bea7b58a3adccee56309f7c.zip | |
fix a bug where sometimes is_bot isn't in part of user info
| -rw-r--r-- | warmachine/connections/slack.py | 8 |
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'): |