Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
feat: enhance sender ID handling in Telegram channel
codeLzq1663acd1a1d3
diff --git a/nanobot/channels/base.py b/nanobot/channels/base.pyindex d83367c0f..8f16399e5 100644--- a/nanobot/channels/base.py+++ b/nanobot/channels/base.py@@ -72,7 +72,14 @@ class BaseChannel(ABC):if not allow_list:return True- return str(sender_id) in allow_list+ sender_str = str(sender_id)+ if sender_str in allow_list:+ return True+ if "|" in sender_str:+ for part in sender_str.split("|"):+ if part and part in allow_list:+ return True+ return Falseasync def _handle_message(self,diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.pyindex 840c250e2..ac2dba43b 100644--- a/nanobot/channels/telegram.py+++ b/nanobot/channels/telegram.py@@ -199,8 +199,10 @@ class TelegramChannel(BaseChannel):user = update.effective_userchat_id = message.chat_id- # Get sender identifier (prefer username, fallback to user_id)- sender_id = str(user.username or user.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}"# Store chat_id for repliesself._chat_ids[sender_id] = chat_id