Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

slack: robustly filter message events\n\n- Ignore all message subtypes (e.g., message_changed, deleted, joins)\n- Ignore events missing user or with empty text\n- Keep existing bot_id and mention checks intact\n\nPrevents bot self-edits and event messages from being treated as user input

cyhhao1b769e1bdf0e
diff --git a/modules/im/slack.py b/modules/im/slack.py
index 63600c3dd..e2f63d9b5 100644
--- a/modules/im/slack.py
+++ b/modules/im/slack.py
@@ -299,6 +299,13 @@ class SlackBot(BaseIMClient):
if event.get("bot_id"):
return
+ # Ignore message subtypes (edited, deleted, joins, etc.)
+ # We only process plain user messages without subtype
+ event_subtype = event.get("subtype")
+ if event_subtype:
+ logger.debug(f"Ignoring Slack message with subtype: {event_subtype}")
+ return
+
channel_id = event.get("channel")
# Check if channel is authorized based on whitelist configuration
@@ -309,13 +316,22 @@ class SlackBot(BaseIMClient):
# Check if this message contains a bot mention
# If it does, skip processing as it will be handled by app_mention event
- text = event.get("text", "")
+ text = (event.get("text") or "").strip()
import re
if re.search(r"<@[\w]+>", text):
logger.info(f"Skipping message event with bot mention: '{text}'")
return
+ # Ignore messages without user or without actual text
+ user_id = event.get("user")
+ if not user_id:
+ logger.debug("Ignoring Slack message without user id")
+ return
+ if not text:
+ logger.debug("Ignoring Slack message with empty text")
+ return
+
# Check if channel is authorized based on whitelist
if not await self._is_authorized_channel(channel_id):
logger.info(f"Unauthorized message from channel: {channel_id}")
@@ -332,7 +348,7 @@ class SlackBot(BaseIMClient):
thread_id = event.get("thread_ts") or event.get("ts")
context = MessageContext(
- user_id=event.get("user"),
+ user_id=user_id,
channel_id=channel_id,
thread_id=thread_id, # Always have a thread_id
message_id=event.get("ts"),