MCPcopy Create free account
hub / github.com/Loping151/RoverSign / _call_all_target_send_hooks

Function _call_all_target_send_hooks

RoverSign/utils/bot_send_hook.py:89–114  ·  view source on GitHub ↗

调用所有插件的 target_send hooks

(
    target_type: str,
    target_id: Optional[str],
    bot_id: str,
    bot_self_id: str,
)

Source from the content-addressed store, hash-verified

87
88
89async def _call_all_target_send_hooks(
90 target_type: str,
91 target_id: Optional[str],
92 bot_id: str,
93 bot_self_id: str,
94):
95 """调用所有插件的 target_send hooks"""
96 group_id = target_id if target_type == "group" else None
97 if not group_id:
98 return
99
100 for plugin_name, manager in _plugin_hook_managers.items():
101 if not manager.target_send_hooks:
102 continue
103
104 logger.debug(f"[库洛签到·BotHook] 调用 {len(manager.target_send_hooks)} 个 target_send hooks, group_id={group_id}")
105
106 for hook in manager.target_send_hooks:
107 try:
108 logger.debug(f"[库洛签到·BotHook] 执行 hook: {hook.__name__}, group_id={group_id}")
109 if _hook_arity(hook) >= 3:
110 await hook(group_id, bot_id, bot_self_id)
111 else:
112 await hook(group_id, bot_self_id)
113 except Exception as e:
114 logger.warning(f"[库洛签到·BotHook] target_send hook {hook.__name__} 执行失败: {e}")
115
116
117async def _call_all_group_activity_hooks(group_id: Optional[str], bot_id: str, bot_self_id: str):

Callers 2

hooked_sendFunction · 0.85
hooked_target_sendFunction · 0.85

Calls 1

_hook_arityFunction · 0.85

Tested by

no test coverage detected