MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / bind_chat_id

Function bind_chat_id

agents/role-manager/main.py:277–307  ·  view source on GitHub ↗

绑定飞书群 ID 到角色 Args: role_name: 角色名 feishu_chat_id: 飞书群 ID Returns: 绑定结果

(role_name: str, feishu_chat_id: str)

Source from the content-addressed store, hash-verified

275 """
276 绑定飞书群 ID 到角色
277
278 Args:
279 role_name: 角色名
280 feishu_chat_id: 飞书群 ID
281
282 Returns:
283 绑定结果
284 """
285 meta = load_roles_meta()
286
287 if role_name not in meta["roles"]:
288 return {"success": False, "message": f"角色 {role_name} 不存在"}
289
290 meta["roles"][role_name]["feishu_chat_id"] = feishu_chat_id
291 save_roles_meta(meta)
292
293 # 同时更新画像
294 user_id = f"user_{role_name}"
295 profile = get_profile(user_id)
296 if profile:
297 profile["feishu_chat_id"] = feishu_chat_id
298 profile["updated_at"] = datetime.now().isoformat()
299 update_profile(user_id, profile)
300
301 return {
302 "success": True,
303 "message": f"已将角色 {role_name} 绑定到飞书群 {feishu_chat_id}",
304 }
305
306
307def parse_role_command(text: str) -> Optional[Dict[str, Any]]:
308 """
309 解析角色命令
310

Callers 1

process_role_commandFunction · 0.85

Calls 5

save_roles_metaFunction · 0.85
update_profileFunction · 0.85
nowMethod · 0.80
load_roles_metaFunction · 0.70
get_profileFunction · 0.50

Tested by

no test coverage detected