Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions slack_bolt/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def set_status(
*,
status: str,
loading_messages: Optional[List[str]] = None,
channel: Optional[str] = None,
channel_id: Optional[str] = None,
thread_ts: Optional[str] = None,
**kwargs,
) -> SlackResponse:
Expand All @@ -86,15 +86,15 @@ def set_status(
Args:
status: The status text to display.
loading_messages: Optional list of loading messages to cycle through.
channel: Channel ID. Defaults to the channel from the event context.
channel_id: Channel ID. Defaults to the channel from the event context.
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
**kwargs: Additional arguments passed to ``WebClient.assistant_threads_setStatus()``.

Returns:
``SlackResponse`` from the API call.
"""
return self._client.assistant_threads_setStatus(
channel_id=channel or self._channel_id, # type: ignore[arg-type]
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
status=status,
loading_messages=loading_messages,
Expand All @@ -106,7 +106,7 @@ def set_suggested_prompts(
*,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
channel: Optional[str] = None,
channel_id: Optional[str] = None,
thread_ts: Optional[str] = None,
**kwargs,
) -> SlackResponse:
Expand All @@ -116,7 +116,7 @@ def set_suggested_prompts(
prompts: A sequence of prompts. Each prompt can be either a string
(used as both title and message) or a dict with 'title' and 'message' keys.
title: Optional title for the suggested prompts section.
channel: Channel ID. Defaults to the channel from the event context.
channel_id: Channel ID. Defaults to the channel from the event context.
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
**kwargs: Additional arguments passed to ``WebClient.assistant_threads_setSuggestedPrompts()``.

Expand All @@ -131,7 +131,7 @@ def set_suggested_prompts(
prompts_arg.append(prompt)

return self._client.assistant_threads_setSuggestedPrompts(
channel_id=channel or self._channel_id, # type: ignore[arg-type]
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
prompts=prompts_arg,
title=title,
Expand Down
12 changes: 6 additions & 6 deletions slack_bolt/agent/async_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def set_status(
*,
status: str,
loading_messages: Optional[List[str]] = None,
channel: Optional[str] = None,
channel_id: Optional[str] = None,
thread_ts: Optional[str] = None,
**kwargs,
) -> AsyncSlackResponse:
Expand All @@ -85,15 +85,15 @@ async def set_status(
Args:
status: The status text to display.
loading_messages: Optional list of loading messages to cycle through.
channel: Channel ID. Defaults to the channel from the event context.
channel_id: Channel ID. Defaults to the channel from the event context.
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
**kwargs: Additional arguments passed to ``AsyncWebClient.assistant_threads_setStatus()``.

Returns:
``AsyncSlackResponse`` from the API call.
"""
return await self._client.assistant_threads_setStatus(
channel_id=channel or self._channel_id, # type: ignore[arg-type]
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
status=status,
loading_messages=loading_messages,
Expand All @@ -105,7 +105,7 @@ async def set_suggested_prompts(
*,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
channel: Optional[str] = None,
channel_id: Optional[str] = None,
thread_ts: Optional[str] = None,
**kwargs,
) -> AsyncSlackResponse:
Expand All @@ -115,7 +115,7 @@ async def set_suggested_prompts(
prompts: A sequence of prompts. Each prompt can be either a string
(used as both title and message) or a dict with 'title' and 'message' keys.
title: Optional title for the suggested prompts section.
channel: Channel ID. Defaults to the channel from the event context.
channel_id: Channel ID. Defaults to the channel from the event context.
thread_ts: Thread timestamp. Defaults to the thread_ts from the event context.
**kwargs: Additional arguments passed to ``AsyncWebClient.assistant_threads_setSuggestedPrompts()``.

Expand All @@ -130,7 +130,7 @@ async def set_suggested_prompts(
prompts_arg.append(prompt)

return await self._client.assistant_threads_setSuggestedPrompts(
channel_id=channel or self._channel_id, # type: ignore[arg-type]
channel_id=channel_id or self._channel_id, # type: ignore[arg-type]
thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type]
prompts=prompts_arg,
title=title,
Expand Down
8 changes: 4 additions & 4 deletions tests/slack_bolt/agent/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def test_set_status_with_loading_messages(self):
)

def test_set_status_overrides_context_defaults(self):
"""Explicit channel/thread_ts override context defaults."""
"""Explicit channel_id/thread_ts override context defaults."""
client = MagicMock(spec=WebClient)
client.assistant_threads_setStatus.return_value = MagicMock()

Expand All @@ -196,7 +196,7 @@ def test_set_status_overrides_context_defaults(self):
)
agent.set_status(
status="Thinking...",
channel="C999",
channel_id="C999",
thread_ts="9999999999.999999",
)

Expand Down Expand Up @@ -295,7 +295,7 @@ def test_set_suggested_prompts_with_dict_prompts(self):
)

def test_set_suggested_prompts_overrides_context_defaults(self):
"""Explicit channel/thread_ts override context defaults."""
"""Explicit channel_id/thread_ts override context defaults."""
client = MagicMock(spec=WebClient)
client.assistant_threads_setSuggestedPrompts.return_value = MagicMock()

Expand All @@ -308,7 +308,7 @@ def test_set_suggested_prompts_overrides_context_defaults(self):
)
agent.set_suggested_prompts(
prompts=["Hello"],
channel="C999",
channel_id="C999",
thread_ts="9999999999.999999",
)

Expand Down
8 changes: 4 additions & 4 deletions tests/slack_bolt_async/agent/test_async_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async def test_set_status_with_loading_messages(self):

@pytest.mark.asyncio
async def test_set_status_overrides_context_defaults(self):
"""Explicit channel/thread_ts override context defaults."""
"""Explicit channel_id/thread_ts override context defaults."""
client = MagicMock(spec=AsyncWebClient)
client.assistant_threads_setStatus, call_tracker, _ = _make_async_api_mock()

Expand All @@ -227,7 +227,7 @@ async def test_set_status_overrides_context_defaults(self):
)
await agent.set_status(
status="Thinking...",
channel="C999",
channel_id="C999",
thread_ts="9999999999.999999",
)

Expand Down Expand Up @@ -331,7 +331,7 @@ async def test_set_suggested_prompts_with_dict_prompts(self):

@pytest.mark.asyncio
async def test_set_suggested_prompts_overrides_context_defaults(self):
"""Explicit channel/thread_ts override context defaults."""
"""Explicit channel_id/thread_ts override context defaults."""
client = MagicMock(spec=AsyncWebClient)
client.assistant_threads_setSuggestedPrompts, call_tracker, _ = _make_async_api_mock()

Expand All @@ -344,7 +344,7 @@ async def test_set_suggested_prompts_overrides_context_defaults(self):
)
await agent.set_suggested_prompts(
prompts=["Hello"],
channel="C999",
channel_id="C999",
thread_ts="9999999999.999999",
)

Expand Down