Closed kriw closed 7 years ago
@kriw can you explain how to use this to download files? Where should the token value come from?
The token is your Slack API Token.
This is the example.
@respond_to("uploaded a file: \<?(.*)\>? .*")
def mention_download(message, url):
if not 'file' in message.body:
return
url = message.body['file']['url_private']
message.send("OK")
if url.startswith('http'):
with create_tmp_file() as tmpf:
import secret
download_file(url, tmpf, secret.API_TOKEN)
message.channel.upload_file(url, tmpf,
'downloaded from {}'.format(url))
and
This is secret.py
included in above file.
API_TOKEN = "xxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx"
It supports downloading file uploaded on slack. Related issue: https://github.com/lins05/slackbot/issues/99