Skip to content

Commit

Permalink
📝 Docs: 更新最佳实践的 Alconna 部分 (#2656)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
RF-Tar-Railt and pre-commit-ci[bot] authored Apr 18, 2024
1 parent cbecc7b commit b0d554e
Show file tree
Hide file tree
Showing 5 changed files with 468 additions and 193 deletions.
7 changes: 3 additions & 4 deletions website/docs/best-practice/alconna/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,16 @@ async def got_location(location: str = ArgPlainText()):

</details>

```python {5-10,14-16,18-19}
```python {5-9,13-15,17-18}
from nonebot.rule import to_me
from arclet.alconna import Alconna, Args
from nonebot_plugin_alconna import Match, on_alconna

weather = on_alconna(
Alconna("天气", Args["location?", str]),
aliases={"weather", "天气预报"},
rule=to_me(),
)
weather.shortcut("weather", {"command": "天气"})
weather.shortcut("天气预报", {"command": "天气"})


@weather.handle()
Expand All @@ -133,7 +132,7 @@ async def got_location(location: str):
或阅读 [Alconna 基本介绍](./command.md) 一节。

关于更多 `on_alconna` 的使用方法,可参考 [插件文档](https://github.com/nonebot/plugin-alconna/blob/master/docs.md)
或阅读 [响应规则的使用](./matcher.md) 一节。
或阅读 [响应规则的使用](./matcher.mdx) 一节。

## 交流与反馈

Expand Down
Loading

0 comments on commit b0d554e

Please sign in to comment.