mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-02-07 19:36:56 +08:00
✏️ fix doc api link error
This commit is contained in:
parent
c8369f599f
commit
f53e374521
@ -197,7 +197,7 @@ API_TIMEOUT=30.0
|
|||||||
- **类型**: `Set[str]`
|
- **类型**: `Set[str]`
|
||||||
- **默认值**: `set()`
|
- **默认值**: `set()`
|
||||||
|
|
||||||
机器人超级用户,可以使用权限 {ref}`nonebot.permission.SUPERUSER`。
|
机器人超级用户,可以使用权限 [`SUPERUSER`](../api/permission.md#SUPERUSER)。
|
||||||
|
|
||||||
```env
|
```env
|
||||||
SUPERUSERS=["1234567890"]
|
SUPERUSERS=["1234567890"]
|
||||||
@ -221,7 +221,7 @@ NICKNAME=["bot"]
|
|||||||
- Command Start: `{"/"}`
|
- Command Start: `{"/"}`
|
||||||
- Command Separator: `{"."}`
|
- Command Separator: `{"."}`
|
||||||
|
|
||||||
命令消息的起始符和分隔符。用于 {ref}`nonebot.rule.command` 规则。
|
命令消息的起始符和分隔符。用于 [`command`](../api/rule.md#command) 规则。
|
||||||
|
|
||||||
```env
|
```env
|
||||||
COMMAND_START={"/", "!"}
|
COMMAND_START={"/", "!"}
|
||||||
|
@ -259,17 +259,22 @@ async def _(foo: Message = CommandArg()): ...
|
|||||||
获取 shell 命令解析后的参数。
|
获取 shell 命令解析后的参数。
|
||||||
|
|
||||||
:::tip 提示
|
:::tip 提示
|
||||||
如果参数解析失败,则为 {ref}`nonebot.exception.ParserExit` 异常,并携带错误码与错误信息。
|
如果参数解析失败,则为 [`ParserExit`](../../api/exception.md#ParserExit) 异常,并携带错误码与错误信息。
|
||||||
|
|
||||||
由于 `ArgumentParser` 在解析到 `--help` 参数时也会抛出异常,这种情况下错误码为 `0` 且错误信息即为帮助信息。
|
由于 `ArgumentParser` 在解析到 `--help` 参数时也会抛出异常,这种情况下错误码为 `0` 且错误信息即为帮助信息。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
```python {7}
|
```python {8,12}
|
||||||
from nonebot import on_shell_command
|
from nonebot import on_shell_command
|
||||||
from nonebot.params import ShellCommandArgs
|
from nonebot.params import ShellCommandArgs
|
||||||
|
|
||||||
matcher = on_shell_command("cmd", parser)
|
matcher = on_shell_command("cmd", parser)
|
||||||
|
|
||||||
|
# 解析失败
|
||||||
|
@matcher.handle()
|
||||||
|
async def _(foo: ParserExit = ShellCommandArgs()): ...
|
||||||
|
|
||||||
|
# 解析成功
|
||||||
@matcher.handle()
|
@matcher.handle()
|
||||||
async def _(foo: Dict[str, Any] = ShellCommandArgs()): ...
|
async def _(foo: Dict[str, Any] = ShellCommandArgs()): ...
|
||||||
```
|
```
|
||||||
|
@ -16,7 +16,7 @@ options:
|
|||||||
|
|
||||||
向用户回复一条消息。回复的方式或途径由协议适配器自行实现。
|
向用户回复一条消息。回复的方式或途径由协议适配器自行实现。
|
||||||
|
|
||||||
可以是 `str`, {ref}`nonebot.adapters._message.Message`, {ref}`nonebot.adapters._message.MessageSegment` 或 {ref}`nonebot.adapters._template.MessageTemplate`。
|
可以是 `str`, [`Message`](../../api/adapters/_message.md#Message), [`MessageSegment`](../../api/adapters/_message.md#MessageSegment) 或 [`MessageTemplate`](../../api/adapters/_template.md#MessageTemplate)。
|
||||||
|
|
||||||
这个操作等同于使用 `bot.send(event, message, **kwargs)` 但不需要自行传入 `event`。
|
这个操作等同于使用 `bot.send(event, message, **kwargs)` 但不需要自行传入 `event`。
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user