@@ -3757,6 +3757,7 @@ async def files_upload_v2(
37573757 # To upload multiple files at a time
37583758 file_uploads : Optional [List [Dict [str , Any ]]] = None ,
37593759 channel : Optional [str ] = None ,
3760+ channels : Optional [List [str ]] = None ,
37603761 initial_comment : Optional [str ] = None ,
37613762 thread_ts : Optional [str ] = None ,
37623763 request_file_info : bool = True , # since v3.23, this flag is no longer necessary
@@ -3778,20 +3779,8 @@ async def files_upload_v2(
37783779 raise e .SlackRequestError ("You cannot specify both the file and the content argument." )
37793780
37803781 # deprecated arguments:
3781- channels , filetype = kwargs . get ( "channels" ), kwargs .get ("filetype" )
3782+ filetype = kwargs .get ("filetype" )
37823783
3783- if channels is not None :
3784- warnings .warn (
3785- "Although the channels parameter is still supported for smooth migration from legacy files.upload, "
3786- "we recommend using the new channel parameter with a single str value instead for more clarity."
3787- )
3788- if (isinstance (channels , (list , tuple )) and len (channels ) > 1 ) or (
3789- isinstance (channels , str ) and len (channels .split ("," )) > 1
3790- ):
3791- raise e .SlackRequestError (
3792- "Sharing files with multiple channels is no longer supported in v2. "
3793- "Share files in each channel separately instead."
3794- )
37953784 if filetype is not None :
37963785 warnings .warn ("The filetype parameter is no longer supported. Please remove it from the arguments." )
37973786
@@ -3845,15 +3834,10 @@ async def files_upload_v2(
38453834 raise e .SlackRequestError (message )
38463835
38473836 # step3: files.completeUploadExternal with all the sets of (file_id + title)
3848- channel_to_share = channel
3849- if channels is not None :
3850- if isinstance (channels , str ):
3851- channel_to_share = channels .split ("," )[0 ]
3852- else :
3853- channel_to_share = channels [0 ]
38543837 completion = await self .files_completeUploadExternal (
38553838 files = [{"id" : f ["file_id" ], "title" : f ["title" ]} for f in files ],
3856- channel_id = channel_to_share ,
3839+ channel_id = channel ,
3840+ channels = channels ,
38573841 initial_comment = initial_comment ,
38583842 thread_ts = thread_ts ,
38593843 ** kwargs ,
@@ -3889,6 +3873,7 @@ async def files_completeUploadExternal(
38893873 * ,
38903874 files : List [Dict [str , str ]],
38913875 channel_id : Optional [str ] = None ,
3876+ channels : Optional [List [str ]] = None ,
38923877 initial_comment : Optional [str ] = None ,
38933878 thread_ts : Optional [str ] = None ,
38943879 ** kwargs ,
@@ -3905,6 +3890,8 @@ async def files_completeUploadExternal(
39053890 "thread_ts" : thread_ts ,
39063891 }
39073892 )
3893+ if channels :
3894+ kwargs ["channels" ] = "," .join (channels )
39083895 return await self .api_call ("files.completeUploadExternal" , params = kwargs )
39093896
39103897 async def functions_completeSuccess (
0 commit comments