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

Function startswith

nonebot/rule.py:180–190  ·  view source on GitHub ↗

匹配消息纯文本开头。 参数: msg: 指定消息开头字符串元组 ignorecase: 是否忽略大小写

(msg: str | tuple[str, ...], ignorecase: bool = False)

Source from the content-addressed store, hash-verified

178
179
180def startswith(msg: str | tuple[str, ...], ignorecase: bool = False) -> Rule:
181 """匹配消息纯文本开头。
182
183 参数:
184 msg: 指定消息开头字符串元组
185 ignorecase: 是否忽略大小写
186 """
187 if isinstance(msg, str):
188 msg = (msg,)
189
190 return Rule(StartswithRule(msg, ignorecase))
191
192
193class EndswithRule:

Callers 2

on_startswithFunction · 0.90
test_startswithFunction · 0.90

Calls 2

RuleClass · 0.90
StartswithRuleClass · 0.85

Tested by 1

test_startswithFunction · 0.72