diff --git a/docs/reference/async_app.html b/docs/reference/async_app.html index 6a45d2ada..670ba58d0 100644 --- a/docs/reference/async_app.html +++ b/docs/reference/async_app.html @@ -5415,7 +5415,7 @@
class AsyncSetSuggestedPrompts
-(client: slack_sdk.web.async_client.AsyncWebClient,
channel_id: str,
thread_ts: str)
+(client: slack_sdk.web.async_client.AsyncWebClient,
channel_id: str,
thread_ts: str | None = None)
class AsyncSetSuggestedPrompts:
client: AsyncWebClient
channel_id: str
- thread_ts: str
+ thread_ts: Optional[str]
def __init__(
self,
client: AsyncWebClient,
channel_id: str,
- thread_ts: str,
+ thread_ts: Optional[str] = None,
):
self.client = client
self.channel_id = channel_id
@@ -5441,6 +5441,7 @@ Class variables
self,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
+ thread_ts: Optional[str] = None,
) -> AsyncSlackResponse:
prompts_arg: List[Dict[str, str]] = []
for prompt in prompts:
@@ -5451,7 +5452,7 @@ Class variables
return await self.client.assistant_threads_setSuggestedPrompts(
channel_id=self.channel_id,
- thread_ts=self.thread_ts,
+ thread_ts=thread_ts if thread_ts is not None else self.thread_ts,
prompts=prompts_arg,
title=title,
)
@@ -5467,7 +5468,7 @@ The type of the None singleton.
var thread_ts : strvar thread_ts : str | NoneThe type of the None singleton.
prop set_status : SetStatus@property
-def set_status(self) -> SetStatus:
- warnings.warn(
- "AssistantUtilities.set_status is deprecated. "
- "Use the set_status argument directly in your listener function "
- "or access it via context.set_status instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- return SetStatus(self.client, self.channel_id, self.thread_ts)
-prop set_suggested_prompts : SetSuggestedPrompts@property
-def set_suggested_prompts(self) -> SetSuggestedPrompts:
- return SetSuggestedPrompts(self.client, self.channel_id, self.thread_ts)
-prop set_title : SetTitle
-def is_valid(self) ‑> bool
-def is_valid(self) -> bool:
- return self.channel_id is not None and self.thread_ts is not None
-channel_id
clientget_thread_contextis_validpayloadsave_thread_contextsayset_statusset_suggested_promptsset_titlethread_context_storethread_tsprop set_status : AsyncSetStatus@property
-def set_status(self) -> AsyncSetStatus:
- warnings.warn(
- "AsyncAssistantUtilities.set_status is deprecated. "
- "Use the set_status argument directly in your listener function "
- "or access it via context.set_status instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- return AsyncSetStatus(self.client, self.channel_id, self.thread_ts)
-prop set_suggested_prompts : AsyncSetSuggestedPrompts@property
-def set_suggested_prompts(self) -> AsyncSetSuggestedPrompts:
- return AsyncSetSuggestedPrompts(self.client, self.channel_id, self.thread_ts)
-prop set_title : AsyncSetTitle
-def is_valid(self) ‑> bool
-def is_valid(self) -> bool:
- return self.channel_id is not None and self.thread_ts is not None
-channel_id
clientget_thread_contextis_validpayloadsave_thread_contextsayset_statusset_suggested_promptsset_titlethread_context_storethread_ts
class FileAssistantThreadContextStore
-(base_dir: str = '/Users/eden.zimbelman/.bolt-app-assistant-thread-contexts')
+(base_dir: str = '/Users/wbergamin/.bolt-app-assistant-thread-contexts')
class AsyncSetSuggestedPrompts
-(client: slack_sdk.web.async_client.AsyncWebClient,
channel_id: str,
thread_ts: str)
+(client: slack_sdk.web.async_client.AsyncWebClient,
channel_id: str,
thread_ts: str | None = None)
class AsyncSetSuggestedPrompts:
client: AsyncWebClient
channel_id: str
- thread_ts: str
+ thread_ts: Optional[str]
def __init__(
self,
client: AsyncWebClient,
channel_id: str,
- thread_ts: str,
+ thread_ts: Optional[str] = None,
):
self.client = client
self.channel_id = channel_id
@@ -74,6 +74,7 @@ Classes
self,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
+ thread_ts: Optional[str] = None,
) -> AsyncSlackResponse:
prompts_arg: List[Dict[str, str]] = []
for prompt in prompts:
@@ -84,7 +85,7 @@ Classes
return await self.client.assistant_threads_setSuggestedPrompts(
channel_id=self.channel_id,
- thread_ts=self.thread_ts,
+ thread_ts=thread_ts if thread_ts is not None else self.thread_ts,
prompts=prompts_arg,
title=title,
)
@@ -100,7 +101,7 @@ The type of the None singleton.
var thread_ts : strvar thread_ts : str | NoneThe type of the None singleton.
class SetSuggestedPrompts
-(client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
+(client: slack_sdk.web.client.WebClient,
channel_id: str,
thread_ts: str | None = None)
class SetSuggestedPrompts:
client: WebClient
channel_id: str
- thread_ts: str
+ thread_ts: Optional[str]
def __init__(
self,
client: WebClient,
channel_id: str,
- thread_ts: str,
+ thread_ts: Optional[str] = None,
):
self.client = client
self.channel_id = channel_id
@@ -85,6 +85,7 @@ Classes
self,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
+ thread_ts: Optional[str] = None,
) -> SlackResponse:
prompts_arg: List[Dict[str, str]] = []
for prompt in prompts:
@@ -95,7 +96,7 @@ Classes
return self.client.assistant_threads_setSuggestedPrompts(
channel_id=self.channel_id,
- thread_ts=self.thread_ts,
+ thread_ts=thread_ts if thread_ts is not None else self.thread_ts,
prompts=prompts_arg,
title=title,
)
@@ -111,7 +112,7 @@ The type of the None singleton.
var thread_ts : strvar thread_ts : str | NoneThe type of the None singleton.
class SetSuggestedPrompts
-(client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
+(client: slack_sdk.web.client.WebClient,
channel_id: str,
thread_ts: str | None = None)
class SetSuggestedPrompts:
client: WebClient
channel_id: str
- thread_ts: str
+ thread_ts: Optional[str]
def __init__(
self,
client: WebClient,
channel_id: str,
- thread_ts: str,
+ thread_ts: Optional[str] = None,
):
self.client = client
self.channel_id = channel_id
@@ -74,6 +74,7 @@ Classes
self,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
+ thread_ts: Optional[str] = None,
) -> SlackResponse:
prompts_arg: List[Dict[str, str]] = []
for prompt in prompts:
@@ -84,7 +85,7 @@ Classes
return self.client.assistant_threads_setSuggestedPrompts(
channel_id=self.channel_id,
- thread_ts=self.thread_ts,
+ thread_ts=thread_ts if thread_ts is not None else self.thread_ts,
prompts=prompts_arg,
title=title,
)
@@ -100,7 +101,7 @@ The type of the None singleton.
var thread_ts : strvar thread_ts : str | NoneThe type of the None singleton.
class BoltUnhandledRequestError
-(*,
request: ForwardRef('BoltRequest') | ForwardRef('AsyncBoltRequest'),
current_response: ForwardRef('BoltResponse') | None,
last_global_middleware_name: str | None = None)
+(*,
request: BoltRequest | AsyncBoltRequest,
current_response: BoltResponse | None,
last_global_middleware_name: str | None = None)
class FileAssistantThreadContextStore
-(base_dir: str = '/Users/eden.zimbelman/.bolt-app-assistant-thread-contexts')
+(base_dir: str = '/Users/wbergamin/.bolt-app-assistant-thread-contexts')
class SetSuggestedPrompts
-(client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
+(client: slack_sdk.web.client.WebClient,
channel_id: str,
thread_ts: str | None = None)
class SetSuggestedPrompts:
client: WebClient
channel_id: str
- thread_ts: str
+ thread_ts: Optional[str]
def __init__(
self,
client: WebClient,
channel_id: str,
- thread_ts: str,
+ thread_ts: Optional[str] = None,
):
self.client = client
self.channel_id = channel_id
@@ -6065,6 +6065,7 @@ Class variables
self,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
+ thread_ts: Optional[str] = None,
) -> SlackResponse:
prompts_arg: List[Dict[str, str]] = []
for prompt in prompts:
@@ -6075,7 +6076,7 @@ Class variables
return self.client.assistant_threads_setSuggestedPrompts(
channel_id=self.channel_id,
- thread_ts=self.thread_ts,
+ thread_ts=thread_ts if thread_ts is not None else self.thread_ts,
prompts=prompts_arg,
title=title,
)
@@ -6091,7 +6092,7 @@ The type of the None singleton.
var thread_ts : strvar thread_ts : str | NoneThe type of the None singleton.
-def warning_unhandled_by_global_middleware(name: str,
req: BoltRequest | ForwardRef('AsyncBoltRequest')) ‑> str
+def warning_unhandled_by_global_middleware(name: str,
req: BoltRequest | AsyncBoltRequest) ‑> str
-def warning_unhandled_request(req: BoltRequest | ForwardRef('AsyncBoltRequest')) ‑> str
+def warning_unhandled_request(req: BoltRequest | AsyncBoltRequest) ‑> str
A middleware can process request data before other middleware and listener functions.
A middleware can process request data before other middleware and listener functions.
A middleware can process request data before other middleware and listener functions.
A middleware can process request data before other middleware and listener functions.
A middleware can process request data before other middleware and listener functions.
class AsyncOAuthSettings
-(*,
client_id: str | None = None,
client_secret: str | None = None,
scopes: str | Sequence[str] | None = None,
user_scopes: str | Sequence[str] | None = None,
redirect_uri: str | None = None,
install_path: str = '/slack/install',
install_page_rendering_enabled: bool = True,
redirect_uri_path: str = '/slack/oauth_redirect',
callback_options: AsyncCallbackOptions | None = None,
success_url: str | None = None,
failure_url: str | None = None,
authorization_url: str | None = None,
installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None = None,
installation_store_bot_only: bool = False,
token_rotation_expiration_minutes: int = 120,
user_token_resolution: str = 'authed_user',
state_validation_enabled: bool = True,
state_store: slack_sdk.oauth.state_store.async_state_store.AsyncOAuthStateStore | None = None,
state_cookie_name: str = 'slack-app-oauth-state',
state_expiration_seconds: int = 600,
logger: logging.Logger = <Logger slack_bolt.oauth.async_oauth_settings (WARNING)>)
+(*,
client_id: str | None = None,
client_secret: str | None = None,
scopes: Sequence[str] | str | None = None,
user_scopes: Sequence[str] | str | None = None,
redirect_uri: str | None = None,
install_path: str = '/slack/install',
install_page_rendering_enabled: bool = True,
redirect_uri_path: str = '/slack/oauth_redirect',
callback_options: AsyncCallbackOptions | None = None,
success_url: str | None = None,
failure_url: str | None = None,
authorization_url: str | None = None,
installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None = None,
installation_store_bot_only: bool = False,
token_rotation_expiration_minutes: int = 120,
user_token_resolution: str = 'authed_user',
state_validation_enabled: bool = True,
state_store: slack_sdk.oauth.state_store.async_state_store.AsyncOAuthStateStore | None = None,
state_cookie_name: str = 'slack-app-oauth-state',
state_expiration_seconds: int = 600,
logger: logging.Logger = <Logger slack_bolt.oauth.async_oauth_settings (WARNING)>)
class OAuthSettings
-(*,
client_id: str | None = None,
client_secret: str | None = None,
scopes: str | Sequence[str] | None = None,
user_scopes: str | Sequence[str] | None = None,
redirect_uri: str | None = None,
install_path: str = '/slack/install',
install_page_rendering_enabled: bool = True,
redirect_uri_path: str = '/slack/oauth_redirect',
callback_options: CallbackOptions | None = None,
success_url: str | None = None,
failure_url: str | None = None,
authorization_url: str | None = None,
installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,
installation_store_bot_only: bool = False,
token_rotation_expiration_minutes: int = 120,
user_token_resolution: str = 'authed_user',
state_validation_enabled: bool = True,
state_store: slack_sdk.oauth.state_store.state_store.OAuthStateStore | None = None,
state_cookie_name: str = 'slack-app-oauth-state',
state_expiration_seconds: int = 600,
logger: logging.Logger = <Logger slack_bolt.oauth.oauth_settings (WARNING)>)
+(*,
client_id: str | None = None,
client_secret: str | None = None,
scopes: Sequence[str] | str | None = None,
user_scopes: Sequence[str] | str | None = None,
redirect_uri: str | None = None,
install_path: str = '/slack/install',
install_page_rendering_enabled: bool = True,
redirect_uri_path: str = '/slack/oauth_redirect',
callback_options: CallbackOptions | None = None,
success_url: str | None = None,
failure_url: str | None = None,
authorization_url: str | None = None,
installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,
installation_store_bot_only: bool = False,
token_rotation_expiration_minutes: int = 120,
user_token_resolution: str = 'authed_user',
state_validation_enabled: bool = True,
state_store: slack_sdk.oauth.state_store.state_store.OAuthStateStore | None = None,
state_cookie_name: str = 'slack-app-oauth-state',
state_expiration_seconds: int = 600,
logger: logging.Logger = <Logger slack_bolt.oauth.oauth_settings (WARNING)>)
+def is_any_im_message_event(body: Dict[str, Any]) ‑> bool
+def is_any_im_message_event(body: Dict[str, Any]) -> bool:
+ if is_message_event(body):
+ # Any message event with no subtype or any subtype (message_changed, message_deleted, etc.)
+ return body["event"].get("channel_type") == "im"
+ return False
+
+def is_app_home_opened_event(body: Dict[str, Any], tab: str | None = None) ‑> bool
+def is_app_home_opened_event(body: Dict[str, Any], tab: Optional[str] = None) -> bool:
+ if is_event(body) and body["event"]["type"] == "app_home_opened":
+ if tab is not None:
+ return body["event"].get("tab") == tab
+ return True
+ return False
+
def is_assistant_event(body: Dict[str, Any]) ‑> bool
def is_bot_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
- if is_event(body):
+ if is_any_im_message_event(body):
return (
- is_message_event_in_assistant_thread(body)
- and body["event"].get("subtype") is None
+ body["event"].get("subtype") is None
and body["event"].get("thread_ts") is not None
and body["event"].get("bot_id") is not None
)
@@ -248,17 +280,32 @@ Functions
-def is_message_event_in_assistant_thread(body: Dict[str, Any]) ‑> bool
+
+def is_im_message_event(body: Dict[str, Any]) ‑> bool
+
+-
+
+
+Expand source code
+
+def is_im_message_event(body: Dict[str, Any]) -> bool:
+ if is_any_im_message_event(body):
+ return body["event"].get("subtype") in (None, "file_share")
+ return False
+
+
+
+
+def is_message_event(body: Dict[str, Any]) ‑> bool
-
Expand source code
-def is_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
+def is_message_event(body: Dict[str, Any]) -> bool:
if is_event(body):
- return body["event"]["type"] == "message" and body["event"].get("channel_type") == "im"
+ return body["event"]["type"] == "message"
return False
@@ -299,14 +346,10 @@ Functions
def is_other_message_sub_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
# message_changed, message_deleted etc.
- if is_event(body):
- return (
- is_message_event_in_assistant_thread(body)
- and not is_user_message_event_in_assistant_thread(body)
- and (
- _is_other_message_sub_event(body["event"].get("message"))
- or _is_other_message_sub_event(body["event"].get("previous_message"))
- )
+ if is_any_im_message_event(body):
+ return not is_user_message_event_in_assistant_thread(body) and (
+ _is_other_message_sub_event(body["event"].get("message"))
+ or _is_other_message_sub_event(body["event"].get("previous_message"))
)
return False
@@ -347,13 +390,8 @@ Functions
Expand source code
def is_user_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
- if is_event(body):
- return (
- is_message_event_in_assistant_thread(body)
- and body["event"].get("subtype") in (None, "file_share")
- and body["event"].get("thread_ts") is not None
- and body["event"].get("bot_id") is None
- )
+ if is_im_message_event(body):
+ return body["event"].get("thread_ts") is not None and body["event"].get("bot_id") is None
return False
@@ -491,7 +529,7 @@ Functions
Expand source code
def to_message(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
- if is_event(body) and body["event"]["type"] == "message":
+ if is_message_event(body):
return to_event(body)
return None
@@ -582,6 +620,8 @@ Functions
Functions
is_action
+is_any_im_message_event
+is_app_home_opened_event
is_assistant_event
is_assistant_thread_context_changed_event
is_assistant_thread_started_event
@@ -595,7 +635,8 @@ Functions
is_event
is_function
is_global_shortcut
-is_message_event_in_assistant_thread
+is_im_message_event
+is_message_event
is_message_shortcut
is_options
is_other_message_sub_event_in_assistant_thread
diff --git a/slack_bolt/version.py b/slack_bolt/version.py
index 79018b9b2..2c08c0adb 100644
--- a/slack_bolt/version.py
+++ b/slack_bolt/version.py
@@ -1,3 +1,3 @@
"""Check the latest version at https://pypi.org/project/slack-bolt/"""
-__version__ = "1.29.0"
+__version__ = "1.30.0"