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

Function hooked_send

RoverSign/utils/bot_send_hook.py:171–189  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

169
170 # 包装 send 方法
171 async def hooked_send(self, *args, **kwargs):
172 # 调用 hooks
173 user_id = getattr(self.ev, "user_id", None) if hasattr(self, "ev") else None
174 bot_id = getattr(self, "bot_id", "") if hasattr(self, "bot_id") else ""
175 bot_self_id = getattr(self, "bot_self_id", "") if hasattr(self, "bot_self_id") else ""
176
177 # 调用所有插件的用户活跃度 hooks
178 await _call_all_user_activity_hooks(user_id, bot_id, bot_self_id)
179
180 # 调用所有插件的 target_send hooks (群组消息时更新群组绑定)
181 if hasattr(self, "ev"):
182 target_type = getattr(self.ev, "user_type", "")
183 group_id = getattr(self.ev, "group_id", None)
184 if target_type and group_id:
185 await _call_all_target_send_hooks(target_type, group_id, bot_id, bot_self_id)
186 await _call_all_group_activity_hooks(group_id, bot_id, bot_self_id)
187
188 # 调用原始方法
189 return await original_send(self, *args, **kwargs)
190
191 # 包装 target_send 方法
192 async def hooked_target_send(self, *args, **kwargs):

Callers

nothing calls this directly

Tested by

no test coverage detected