feat: surface the set_status argument to listeners if required event details are available#1465
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1465 +/- ##
==========================================
- Coverage 91.47% 91.43% -0.05%
==========================================
Files 232 232
Lines 7334 7340 +6
==========================================
+ Hits 6709 6711 +2
- Misses 625 629 +4 ☔ View full report in Codecov by Sentry. |
zimeg
left a comment
There was a problem hiding this comment.
@WilliamBergamin LGTM! These are nice patterns being followed 🐣
| @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) |
There was a problem hiding this comment.
📣 question: This deprecation is visible to callers of set_status using the assistant class? I think this has solid recommendations but want to make sure I'm not misunderstanding the scope of change!
There was a problem hiding this comment.
Nope from what I understand this deprecation would only be visible for users that try to do something like
assistant_utils = AssistantUtilities()
assistant_utils.set_statusI'm actually considering removing def set_status(self) entirely since I think this class was intended for internal use 🤔
There was a problem hiding this comment.
@WilliamBergamin Ahha this catches confusion I had in not finding these messages! Let's save removal for upcoming breaking change since I understand type definitions might be imported from a particular path?
There was a problem hiding this comment.
Let's save removal for upcoming breaking change since I understand type definitions might be imported from a particular path?
Yess I agree it will be safer to do this in a major
|
@lukegalbraithrussell now This is the same behavior |
Summary
These changes aim to widen the availability of
set_statusto mirror the patterns established bysay_streamset_statusis available onapp.eventandapp.messagelisteners, if Bolt fails to extractchannelorthread_tsthenset_statuswill be NoneTesting
set_statusSample app.py
manifest.json
{ "_metadata": { "major_version": 1, "minor_version": 1 }, "display_information": { "name": "set_status_experiment" }, "features": { "app_home": { "home_tab_enabled": false, "messages_tab_enabled": true, "messages_tab_read_only_enabled": false }, "bot_user": { "display_name": "set_status_experiment", "always_online": false } }, "oauth_config": { "scopes": { "bot": [ "app_mentions:read", "chat:write", "im:read", "im:write", "channels:history", "im:history" ] } }, "settings": { "event_subscriptions": { "bot_events": [ "app_mention", "message.im" ] }, "interactivity": { "is_enabled": true }, "org_deploy_enabled": true, "socket_mode_enabled": true, "token_rotation_enabled": false } }Category
slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.