-
Notifications
You must be signed in to change notification settings - Fork 312
General topic messages ignored in group forum mode #109
Copy link
Copy link
Closed
Description
Bug
When using PROJECT_THREADS_MODE=group in a Telegram supergroup with forum topics enabled, messages sent to the General topic are silently rejected.
Root cause
Orchestrator._extract_message_thread_id() returns None for General topic messages because Telegram does not include a message_thread_id field (or sends 0) for the built-in General topic.
At line 177 of orchestrator.py, the if not message_thread_id guard then rejects the update:
message_thread_id = self._extract_message_thread_id(update)
if not message_thread_id:
await self._reject_for_thread_mode(...)
return FalseExpected behaviour
Messages in the General topic should be routed to whatever project is mapped to message_thread_id = 1 in the project_threads table — Telegram's canonical ID for the General topic.
Proposed fix
In _extract_message_thread_id, when the chat is a forum supergroup and no thread ID is present, default to 1:
@staticmethod
def _extract_message_thread_id(update: Update) -> Optional[int]:
message = update.effective_message
if not message:
return None
message_thread_id = getattr(message, "message_thread_id", None)
if isinstance(message_thread_id, int) and message_thread_id > 0:
return message_thread_id
dm_topic = getattr(message, "direct_messages_topic", None)
topic_id = getattr(dm_topic, "topic_id", None) if dm_topic else None
if isinstance(topic_id, int) and topic_id > 0:
return topic_id
# Telegram omits message_thread_id for the General topic in forum groups;
# its canonical thread ID is 1.
chat = update.effective_chat
if chat and getattr(chat, "is_forum", False):
return 1
return NoneEnvironment
- claude-code-telegram v1.3.0
PROJECT_THREADS_MODE=group- Telegram supergroup with forum topics enabled
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels