diff options
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py index f6448ce..7ba22ab 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2051,6 +2051,15 @@ class SlackMessage(object): if message_json.get('subtype') == 'me_message' and not message_json['text'].startswith(self.sender): message_json['text'] = self.sender + ' ' + self.message_json['text'] + # Replace Slack link with direct link to shared file (required if + # shared by an external user since only the direct link is accessible) + if message_json.get('subtype') == 'file_share': + message_json['text'] = re.sub( + r'<http.+\|', + r'<{}|'.format(message_json['file']['url_private']), + message_json['text'] + ) + def __hash__(self): return hash(self.ts) |