Feature: 添加 State 响应器触发消息注入 (#1315)

This commit is contained in:
Akirami
2022-10-12 13:41:28 +08:00
committed by GitHub
parent 3e3d6f91a5
commit 8377680fd7
7 changed files with 223 additions and 28 deletions

View File

@ -363,6 +363,62 @@ matcher = on_regex("regex")
async def _(foo: Dict[str, Any] = RegexDict()): ...
```
### Startswith
获取触发响应器的消息前缀字符串。
```python {7}
from nonebot import on_startswith
from nonebot.params import Startswith
matcher = on_startswith("prefix")
@matcher.handle()
async def _(foo: str = Startswith()): ...
```
### Endswith
获取触发响应器的消息后缀字符串。
```python {7}
from nonebot import on_endswith
from nonebot.params import Endswith
matcher = on_endswith("suffix")
@matcher.handle()
async def _(foo: str = Endswith()): ...
```
### Fullmatch
获取触发响应器的消息字符串。
```python {7}
from nonebot import on_fullmatch
from nonebot.params import Fullmatch
matcher = on_fullmatch("fullmatch")
@matcher.handle()
async def _(foo: str = Fullmatch()): ...
```
### Keyword
获取触发响应器的关键字字符串。
```python {7}
from nonebot import on_keyword
from nonebot.params import Keyword
matcher = on_keyword({"keyword"})
@matcher.handle()
async def _(foo: str = Keyword()): ...
```
### Matcher
获取当前事件响应器实例。