MCPcopy
hub / github.com/nonebot/nonebot2 / on_message

Method on_message

nonebot/plugin/on.py:588–604  ·  view source on GitHub ↗

注册一个消息事件响应器。 参数: rule: 事件响应规则 permission: 事件响应权限 handlers: 事件处理函数列表 temp: 是否为临时事件响应器(仅执行一次) expire_time: 事件响应器最终有效时间点,过时即被删除 priority: 事件响应器优先级 block: 是否阻止事件向更低优先级传递 state: 默认 state

(self, **kwargs)

Source from the content-addressed store, hash-verified

586 return matcher
587
588 def on_message(self, **kwargs) -> type[Matcher]:
589 """注册一个消息事件响应器。
590
591 参数:
592 rule: 事件响应规则
593 permission: 事件响应权限
594 handlers: 事件处理函数列表
595 temp: 是否为临时事件响应器(仅执行一次)
596 expire_time: 事件响应器最终有效时间点,过时即被删除
597 priority: 事件响应器优先级
598 block: 是否阻止事件向更低优先级传递
599 state: 默认 state
600 """
601 final_kwargs = self._get_final_kwargs(kwargs, exclude={"type"})
602 matcher = on_message(**final_kwargs)
603 self.matchers.append(matcher)
604 return matcher
605
606 def on_notice(self, **kwargs) -> type[Matcher]:
607 """注册一个通知事件响应器。

Callers 1

matchers.pyFile · 0.80

Calls 3

on_messageFunction · 0.85
_get_final_kwargsMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected