Updated to use new Slack file upload API.

This commit is contained in:
Eric Winter
2025-11-18 13:22:23 -07:00
parent e86f5a0442
commit d63eab527b

View File

@@ -33,7 +33,9 @@ from slack_sdk.errors import SlackApiError
# Name of Slack channels to use as message target # Name of Slack channels to use as message target
SLACK_CHANNEL_NAME = '#kaijudev' SLACK_CHANNEL_NAME = '#kaijudev'
SLACK_CHANNEL_ID = 'C01CGRFSUE9'
SLACK_TEST_CHANNEL_NAME = '#kaijudev-testing' SLACK_TEST_CHANNEL_NAME = '#kaijudev-testing'
SLACK_TEST_CHANNEL_ID = 'C06Q1RAMJ03'
def read_strip_blanks_and_comments(path): def read_strip_blanks_and_comments(path):
@@ -386,12 +388,12 @@ def slack_send_image(slack_client, image_file_path, initial_comment='',
None None
""" """
if is_test: if is_test:
channel = SLACK_TEST_CHANNEL_NAME channel_id = SLACK_TEST_CHANNEL_ID
else: else:
channel = SLACK_CHANNEL_NAME channel_id = SLACK_CHANNEL_ID
try: try:
response = slack_client.files_upload( response = slack_client.files_upload_v2(
channels=channel, channel=channel_id,
thread_ts=thread_ts, thread_ts=thread_ts,
file=image_file_path, file=image_file_path,
initial_comment=initial_comment, initial_comment=initial_comment,