From 91ee797eaa6d1d86f52755b66bc22fe239a4c190 Mon Sep 17 00:00:00 2001 From: yuji38kwmt Date: Mon, 13 May 2024 14:49:28 +0900 Subject: [PATCH] =?UTF-8?q?`files.upload`=20:=20=E5=86=85=E9=83=A8?= =?UTF-8?q?=E3=81=A7`files=5Fupload=5Fv2`=E3=82=92=E4=BD=BF=E3=81=86?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82=20(#138)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * "--channel_id"に変更 * 月ごとに更新 * 修正 --- .github/dependabot.yml | 2 +- .gitignore | 4 +++- slack_primitive_cli/command/files.py | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3a21864..c990752 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,5 +3,5 @@ updates: - package-ecosystem: pip directory: "/" schedule: - interval: weekly + interval: monthly open-pull-requests-limit: 10 diff --git a/.gitignore b/.gitignore index 29b13e4..d7f0e56 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,6 @@ venv.bak/ # output directory of tests tests/out/ -pip-wheel-metadata/ \ No newline at end of file +pip-wheel-metadata/ + +out/ diff --git a/slack_primitive_cli/command/files.py b/slack_primitive_cli/command/files.py index d94e60f..6a18c41 100644 --- a/slack_primitive_cli/command/files.py +++ b/slack_primitive_cli/command/files.py @@ -12,7 +12,7 @@ @click.command(name="files.upload", help="Uploads or creates a file. See https://api.slack.com/methods/files.upload ") @click.option("--token", envvar=TOKEN_ENVVAR, required=True, help=TOKEN_HELP_MESSAGE) -@click.option("--channels", required=True, help="Comma-separated list of channel names or IDs where the file will be shared.") +@click.option("--channel_id", required=True, help="Channel IDs where the file will be shared.") @optgroup.group("File contents", cls=RequiredMutuallyExclusiveOptionGroup) @optgroup.option("--file", help="File contents via multipart/form-data. If omitting this parameter, you must submit content.") @optgroup.option("--content", help="File contents via a POST variable. If omitting this parameter, you must provide a file.") @@ -22,15 +22,15 @@ @click.option("--thread_ts", help="Provide another message's ts value to upload this file as a reply.") @click.option("--title", help="Title of file.") @my_backoff -def upload(token, channels, file, content, filename, filetype, initial_comment, thread_ts, title): # noqa: ANN001, ANN201 +def upload(token, channel_id, file, content, filename, filetype, initial_comment, thread_ts, title): # noqa: ANN001, ANN201 set_logger() client = slack_sdk.WebClient(token=token) if filename is None and file is not None: filename = os.path.basename(file) - response = client.files_upload( - channels=channels, + response = client.files_upload_v2( + channel=channel_id, file=file, content=content, filename=filename,