From 72db01db636c4ec2e63b50a7c79dfbdbf758b8a9 Mon Sep 17 00:00:00 2001 From: Hyudryu Date: Tue, 17 Feb 2026 13:42:57 -0800 Subject: [PATCH] slack: Added replyInThread logic and custom react emoji in config --- nanobot/channels/slack.py | 6 ++++-- nanobot/config/schema.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/nanobot/channels/slack.py b/nanobot/channels/slack.py index e5fff63..dca5055 100644 --- a/nanobot/channels/slack.py +++ b/nanobot/channels/slack.py @@ -152,13 +152,15 @@ class SlackChannel(BaseChannel): text = self._strip_bot_mention(text) - thread_ts = event.get("thread_ts") or event.get("ts") + thread_ts = event.get("thread_ts") + if self.config.reply_in_thread and not thread_ts: + thread_ts = event.get("ts") # Add :eyes: reaction to the triggering message (best-effort) try: if self._web_client and event.get("ts"): await self._web_client.reactions_add( channel=chat_id, - name="eyes", + name=self.config.react_emoji, timestamp=event.get("ts"), ) except Exception as e: diff --git a/nanobot/config/schema.py b/nanobot/config/schema.py index 76ec74d..3cacbde 100644 --- a/nanobot/config/schema.py +++ b/nanobot/config/schema.py @@ -148,6 +148,8 @@ class SlackConfig(Base): bot_token: str = "" # xoxb-... app_token: str = "" # xapp-... user_token_read_only: bool = True + reply_in_thread: bool = True + react_emoji: str = "eyes" group_policy: str = "mention" # "mention", "open", "allowlist" group_allow_from: list[str] = Field(default_factory=list) # Allowed channel IDs if allowlist dm: SlackDMConfig = Field(default_factory=SlackDMConfig)