-
Notifications
You must be signed in to change notification settings - Fork 385
Slackbot: per-message dedupe; ignore only edits while in-progress #1226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
620ef08
607f2e6
d8c1bf8
2b31afe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -118,6 +118,33 @@ async def run_agent( | |||||||||||
| raise | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def _extract_message_context(event: Any) -> tuple[bool, str | None, str | None, str]: | ||||||||||||
| """Return (is_edit, message_ts, thread_ts, text) for Slack events. | ||||||||||||
|
|
||||||||||||
| - For `message_changed` events, Slack nests the edited message under `event.message`. | ||||||||||||
| - For normal app_mention events, fields are at the top level. | ||||||||||||
| """ | ||||||||||||
| is_edit = getattr(event, "subtype", None) == "message_changed" | ||||||||||||
| msg = (getattr(event, "message", None) or {}) if is_edit else {} | ||||||||||||
|
||||||||||||
| msg = (getattr(event, "message", None) or {}) if is_edit else {} | |
| msg = getattr(event, "message", {}) if is_edit else {} |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This nested conditional with multiple or operators is difficult to read. Consider breaking this into separate lines or using a more explicit if-else structure for better readability.
| text = (msg.get("text") if is_edit else (getattr(event, "text", None) or "")) or "" | |
| if is_edit: | |
| text = msg.get("text") or "" | |
| else: | |
| text = getattr(event, "text", None) or "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function lacks a docstring that explains the return tuple structure. While there's a brief comment, a proper docstring would improve maintainability by clearly documenting the return values: (is_edit, message_ts, thread_ts, text).