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

Method on_endswith

nonebot/plugin/on.py:662–680  ·  view source on GitHub ↗

注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 参数: msg: 指定消息结尾内容 ignorecase: 是否忽略大小写 rule: 事件响应规则 permission: 事件响应权限 handlers: 事件处理函数列表 temp: 是否为临时事件响应器(仅执行一次) expire_time: 事件响应器最终有效时间点,过时即被删除 priority: 事

(self, msg: str | tuple[str, ...], **kwargs)

Source from the content-addressed store, hash-verified

660 return matcher
661
662 def on_endswith(self, msg: str | tuple[str, ...], **kwargs) -> type[Matcher]:
663 """注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。
664
665 参数:
666 msg: 指定消息结尾内容
667 ignorecase: 是否忽略大小写
668 rule: 事件响应规则
669 permission: 事件响应权限
670 handlers: 事件处理函数列表
671 temp: 是否为临时事件响应器(仅执行一次)
672 expire_time: 事件响应器最终有效时间点,过时即被删除
673 priority: 事件响应器优先级
674 block: 是否阻止事件向更低优先级传递
675 state: 默认 state
676 """
677 final_kwargs = self._get_final_kwargs(kwargs, exclude={"type"})
678 matcher = on_endswith(msg, **final_kwargs)
679 self.matchers.append(matcher)
680 return matcher
681
682 def on_fullmatch(self, msg: str | tuple[str, ...], **kwargs) -> type[Matcher]:
683 """注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。

Callers 1

matchers.pyFile · 0.80

Calls 3

on_endswithFunction · 0.85
_get_final_kwargsMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected