diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2021-04-30 00:28:00 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2021-04-30 00:30:39 +0200 |
commit | 2c70f00a9996e104fbefefb8c2fd9d0103bbb04e (patch) | |
tree | 25f872b1197e7570f77271451e156bc7a461461f /wee_slack.py | |
parent | defd8a0e1a46b786bd3880632477e742a4d6d56c (diff) | |
download | wee-slack-2c70f00a9996e104fbefefb8c2fd9d0103bbb04e.tar.gz |
Include channel name in file names for downloaded files
Fixes #836
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index 6acd29a..bd03c7a 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -4000,12 +4000,12 @@ def process_message( channel.prnt_message(message, history_message) if not history_message: - download_files(message_json, team) + download_files(message_json, channel) return message -def download_files(message_json, team): +def download_files(message_json, channel): download_location = config.files_download_location if not download_location: return @@ -4033,7 +4033,9 @@ def download_files(message_json, team): continue filetype = "" if f["title"].endswith(f["filetype"]) else "." + f["filetype"] - filename = "{}_{}{}".format(team.name, f["title"], filetype) + filename = "{}.{}_{}{}".format( + channel.team.name, channel.name, f["title"], filetype + ) for fileout in fileout_iter(os.path.join(download_location, filename)): if os.path.isfile(fileout): continue @@ -4041,7 +4043,7 @@ def download_files(message_json, team): "url:" + f["url_private"], { "file_out": fileout, - "httpheader": "Authorization: Bearer " + team.token, + "httpheader": "Authorization: Bearer " + channel.team.token, }, config.slack_timeout, "", |