Skip to content

Commit 1edf454

Browse files
committed
fix(agent): match channel_id api argument for set_status and set_suggested_prompts
1 parent d789fac commit 1edf454

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

slack_bolt/agent/agent.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def set_status(
7777
*,
7878
status: str,
7979
loading_messages: Optional[List[str]] = None,
80-
channel: Optional[str] = None,
80+
channel_id: Optional[str] = None,
8181
thread_ts: Optional[str] = None,
8282
**kwargs,
8383
) -> SlackResponse:
@@ -86,15 +86,15 @@ def set_status(
8686
Args:
8787
status: The status text to display.
8888
loading_messages: Optional list of loading messages to cycle through.
89-
channel: Channel ID. Defaults to the channel from the event context.
89+
channel_id: Channel ID. Defaults to the channel from the event context.
9090
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
9191
**kwargs: Additional arguments passed to ``WebClient.assistant_threads_setStatus()``.
9292
9393
Returns:
9494
``SlackResponse`` from the API call.
9595
"""
9696
return self._client.assistant_threads_setStatus(
97-
channel_id=channel or self._channel_id, # type: ignore[arg-type]
97+
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
9898
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
9999
status=status,
100100
loading_messages=loading_messages,
@@ -106,7 +106,7 @@ def set_suggested_prompts(
106106
*,
107107
prompts: Sequence[Union[str, Dict[str, str]]],
108108
title: Optional[str] = None,
109-
channel: Optional[str] = None,
109+
channel_id: Optional[str] = None,
110110
thread_ts: Optional[str] = None,
111111
**kwargs,
112112
) -> SlackResponse:
@@ -116,7 +116,7 @@ def set_suggested_prompts(
116116
prompts: A sequence of prompts. Each prompt can be either a string
117117
(used as both title and message) or a dict with 'title' and 'message' keys.
118118
title: Optional title for the suggested prompts section.
119-
channel: Channel ID. Defaults to the channel from the event context.
119+
channel_id: Channel ID. Defaults to the channel from the event context.
120120
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
121121
**kwargs: Additional arguments passed to ``WebClient.assistant_threads_setSuggestedPrompts()``.
122122
@@ -131,7 +131,7 @@ def set_suggested_prompts(
131131
prompts_arg.append(prompt)
132132

133133
return self._client.assistant_threads_setSuggestedPrompts(
134-
channel_id=channel or self._channel_id, # type: ignore[arg-type]
134+
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
135135
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
136136
prompts=prompts_arg,
137137
title=title,

slack_bolt/agent/async_agent.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async def set_status(
7676
*,
7777
status: str,
7878
loading_messages: Optional[List[str]] = None,
79-
channel: Optional[str] = None,
79+
channel_id: Optional[str] = None,
8080
thread_ts: Optional[str] = None,
8181
**kwargs,
8282
) -> AsyncSlackResponse:
@@ -85,15 +85,15 @@ async def set_status(
8585
Args:
8686
status: The status text to display.
8787
loading_messages: Optional list of loading messages to cycle through.
88-
channel: Channel ID. Defaults to the channel from the event context.
88+
channel_id: Channel ID. Defaults to the channel from the event context.
8989
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
9090
**kwargs: Additional arguments passed to ``AsyncWebClient.assistant_threads_setStatus()``.
9191
9292
Returns:
9393
``AsyncSlackResponse`` from the API call.
9494
"""
9595
return await self._client.assistant_threads_setStatus(
96-
channel_id=channel or self._channel_id, # type: ignore[arg-type]
96+
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
9797
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
9898
status=status,
9999
loading_messages=loading_messages,
@@ -105,7 +105,7 @@ async def set_suggested_prompts(
105105
*,
106106
prompts: Sequence[Union[str, Dict[str, str]]],
107107
title: Optional[str] = None,
108-
channel: Optional[str] = None,
108+
channel_id: Optional[str] = None,
109109
thread_ts: Optional[str] = None,
110110
**kwargs,
111111
) -> AsyncSlackResponse:
@@ -115,7 +115,7 @@ async def set_suggested_prompts(
115115
prompts: A sequence of prompts. Each prompt can be either a string
116116
(used as both title and message) or a dict with 'title' and 'message' keys.
117117
title: Optional title for the suggested prompts section.
118-
channel: Channel ID. Defaults to the channel from the event context.
118+
channel_id: Channel ID. Defaults to the channel from the event context.
119119
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
120120
**kwargs: Additional arguments passed to ``AsyncWebClient.assistant_threads_setSuggestedPrompts()``.
121121
@@ -130,7 +130,7 @@ async def set_suggested_prompts(
130130
prompts_arg.append(prompt)
131131

132132
return await self._client.assistant_threads_setSuggestedPrompts(
133-
channel_id=channel or self._channel_id, # type: ignore[arg-type]
133+
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
134134
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
135135
prompts=prompts_arg,
136136
title=title,

tests/slack_bolt/agent/test_agent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_set_status_with_loading_messages(self):
183183
)
184184

185185
def test_set_status_overrides_context_defaults(self):
186-
"""Explicit channel/thread_ts override context defaults."""
186+
"""Explicit channel_id/thread_ts override context defaults."""
187187
client = MagicMock(spec=WebClient)
188188
client.assistant_threads_setStatus.return_value = MagicMock()
189189

@@ -196,7 +196,7 @@ def test_set_status_overrides_context_defaults(self):
196196
)
197197
agent.set_status(
198198
status="Thinking...",
199-
channel="C999",
199+
channel_id="C999",
200200
thread_ts="9999999999.999999",
201201
)
202202

@@ -295,7 +295,7 @@ def test_set_suggested_prompts_with_dict_prompts(self):
295295
)
296296

297297
def test_set_suggested_prompts_overrides_context_defaults(self):
298-
"""Explicit channel/thread_ts override context defaults."""
298+
"""Explicit channel_id/thread_ts override context defaults."""
299299
client = MagicMock(spec=WebClient)
300300
client.assistant_threads_setSuggestedPrompts.return_value = MagicMock()
301301

@@ -308,7 +308,7 @@ def test_set_suggested_prompts_overrides_context_defaults(self):
308308
)
309309
agent.set_suggested_prompts(
310310
prompts=["Hello"],
311-
channel="C999",
311+
channel_id="C999",
312312
thread_ts="9999999999.999999",
313313
)
314314

tests/slack_bolt_async/agent/test_async_agent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ async def test_set_status_with_loading_messages(self):
214214

215215
@pytest.mark.asyncio
216216
async def test_set_status_overrides_context_defaults(self):
217-
"""Explicit channel/thread_ts override context defaults."""
217+
"""Explicit channel_id/thread_ts override context defaults."""
218218
client = MagicMock(spec=AsyncWebClient)
219219
client.assistant_threads_setStatus, call_tracker, _ = _make_async_api_mock()
220220

@@ -227,7 +227,7 @@ async def test_set_status_overrides_context_defaults(self):
227227
)
228228
await agent.set_status(
229229
status="Thinking...",
230-
channel="C999",
230+
channel_id="C999",
231231
thread_ts="9999999999.999999",
232232
)
233233

@@ -331,7 +331,7 @@ async def test_set_suggested_prompts_with_dict_prompts(self):
331331

332332
@pytest.mark.asyncio
333333
async def test_set_suggested_prompts_overrides_context_defaults(self):
334-
"""Explicit channel/thread_ts override context defaults."""
334+
"""Explicit channel_id/thread_ts override context defaults."""
335335
client = MagicMock(spec=AsyncWebClient)
336336
client.assistant_threads_setSuggestedPrompts, call_tracker, _ = _make_async_api_mock()
337337

@@ -344,7 +344,7 @@ async def test_set_suggested_prompts_overrides_context_defaults(self):
344344
)
345345
await agent.set_suggested_prompts(
346346
prompts=["Hello"],
347-
channel="C999",
347+
channel_id="C999",
348348
thread_ts="9999999999.999999",
349349
)
350350

0 commit comments

Comments
 (0)