Skip to content

Your lightweight open-source personal agent.

slack: Added replyInThread logic and custom react emoji in config

Hyudryu72db01db636c
diff --git a/nanobot/channels/slack.py b/nanobot/channels/slack.py
index e5fff63e1..dca505598 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 76ec74dc1..3cacbdef2 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)