feat(节点跟踪): 改进用户跟踪功能并添加新用户通知
当新用户首次发送消息时,返回布尔值并通知可用节点。在handler.py中添加对新用户的处理逻辑,当检测到新用户时,向其发送当前在线的节点列表。这有助于新用户更快了解可用资源。
This commit is contained in:
+8
-1
@@ -132,7 +132,14 @@ async def _process_message(user_id: str, chat_id: str, text: str) -> None:
|
||||
from config import ROUTER_MODE
|
||||
if ROUTER_MODE:
|
||||
from router.nodes import get_node_registry
|
||||
get_node_registry().track_user(user_id)
|
||||
registry = get_node_registry()
|
||||
is_new = registry.track_user(user_id)
|
||||
if is_new:
|
||||
nodes = registry.get_nodes_for_user(user_id)
|
||||
online = [n for n in nodes if n.is_online]
|
||||
if online:
|
||||
names = ", ".join(n.display_name for n in online)
|
||||
await send_text(chat_id, "chat_id", f"Available nodes: {names}")
|
||||
|
||||
reply = await handle_command(user_id, text)
|
||||
if reply is not None:
|
||||
|
||||
Reference in New Issue
Block a user