diff options
author | David Thorman <dcthorman25@gmail.com> | 2018-07-28 05:53:12 -0700 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2018-07-28 14:53:12 +0200 |
commit | 2d40eac3ddf889d27ff68a0d501484efc4faf45d (patch) | |
tree | d8a791574130f0d9f347190321a43a5ef19a28bf /wee_slack.py | |
parent | 4fac1a9512fdac1268599e13e37e1778e31487ef (diff) | |
download | wee-slack-2d40eac3ddf889d27ff68a0d501484efc4faf45d.tar.gz |
Adding support for new slack upload message style (#599)
* Adding support for new slack upload message style
* better handling of empty messages
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py index f14cfa8..c732482 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2113,6 +2113,14 @@ class SlackMessage(object): message_json['text'] ) + if message_json.get('upload'): + parts = [message_json['text']] + for f in message_json.get('files', []): + parts.append("({}) - {}".format( + f.get('title'), + f.get('url_private'))) + message_json['text'] = ' | '.join(p for p in parts if p) + def __hash__(self): return hash(self.ts) |