Merge branch 'main' into pr-694

This commit is contained in:
Re-bin
2026-02-16 12:16:05 +00:00
10 changed files with 495 additions and 16 deletions
+8 -6
View File
@@ -231,12 +231,18 @@ class TelegramChannel(BaseChannel):
"Type /help to see available commands."
)
@staticmethod
def _sender_id(user) -> str:
"""Build sender_id with username for allowlist matching."""
sid = str(user.id)
return f"{sid}|{user.username}" if user.username else sid
async def _forward_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Forward slash commands to the bus for unified handling in AgentLoop."""
if not update.message or not update.effective_user:
return
await self._handle_message(
sender_id=str(update.effective_user.id),
sender_id=self._sender_id(update.effective_user),
chat_id=str(update.message.chat_id),
content=update.message.text,
)
@@ -249,11 +255,7 @@ class TelegramChannel(BaseChannel):
message = update.message
user = update.effective_user
chat_id = message.chat_id
# Use stable numeric ID, but keep username for allowlist compatibility
sender_id = str(user.id)
if user.username:
sender_id = f"{sender_id}|{user.username}"
sender_id = self._sender_id(user)
# Store chat_id for replies
self._chat_ids[sender_id] = chat_id