Skip to content

Add multiple handlers per reaction and REMOVE_BROADCAST handler#10

Merged
alexeygrigorev merged 4 commits into
mainfrom
copilot/remove-thread-please-from-channel
Jan 17, 2026
Merged

Add multiple handlers per reaction and REMOVE_BROADCAST handler#10
alexeygrigorev merged 4 commits into
mainfrom
copilot/remove-thread-please-from-channel

Conversation

Copilot AI commented Jan 17, 2026

Copy link
Copy Markdown
Contributor

When users reply in a thread with "also send to channel" checked, the message violates community guidelines by appearing in both locations. The thread reaction should remove the channel broadcast while keeping the thread message, then post a reminder.

Changes

Multiple handlers per reaction

  • Reactions now support types: [HANDLER1, HANDLER2] alongside legacy type: HANDLER
  • Handlers execute sequentially
  • Config example:
    - reaction: thread
      types:
        - REMOVE_BROADCAST
        - SLACK_POST
      message: "Please use threads..."

REMOVE_BROADCAST handler

  • Detects broadcasted thread replies via thread_ts != ts
  • Calls slack.remove_message() to delete from channel view
  • Message persists in thread (Slack API behavior)
  • No-op for regular messages and thread parents

Updated thread reaction

  • Uses both REMOVE_BROADCAST and SLACK_POST handlers
  • First removes broadcast if present, then posts reminder message

Implementation

Detection logic:

thread_ts = message_details.get('thread_ts')
is_broadcasted_reply = thread_ts is not None and thread_ts != ts

Handler execution in process_reaction():

action_types = reaction_config.get('types') or [reaction_config.get('type')]
for action_type in action_types:
    if action_handler := action_handlers.get(action_type):
        action_handler(event, reaction_config)
Original prompt

This section details on the original issue you should resolve

<issue_title>Thread please to remove it from the channel</issue_title>
<issue_description>Sometimes people use feature also send to channel. In our community guidelines it's not allowed unless really necessary. So when I leave the please thread reaction on a message that was sent to channel, I want to remove it from the channel (but keep in the thread) and also send the message we currently sending. Perhaps we can have two handlers for thread please?</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 17, 2026 07:43
Co-authored-by: alexeygrigorev <875246+alexeygrigorev@users.noreply.github.com>
Co-authored-by: alexeygrigorev <875246+alexeygrigorev@users.noreply.github.com>
Co-authored-by: alexeygrigorev <875246+alexeygrigorev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to remove thread please from channel messages Add multiple handlers per reaction and REMOVE_BROADCAST handler Jan 17, 2026
Copilot AI requested a review from alexeygrigorev January 17, 2026 07:49
@alexeygrigorev alexeygrigorev marked this pull request as ready for review January 17, 2026 09:09
@alexeygrigorev alexeygrigorev merged commit 12e9892 into main Jan 17, 2026
1 check passed
@alexeygrigorev alexeygrigorev deleted the copilot/remove-thread-please-from-channel branch January 17, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thread please to remove it from the channel

2 participants