mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-02-18 00:30:13 +08:00
Update api.md
This commit is contained in:
parent
f55ffe817b
commit
a163d2c075
@ -2391,9 +2391,15 @@ async def _(session):
|
||||
|
||||
渲染 Expression。
|
||||
|
||||
对于 Expression 的三种类型:`str`、`Sequence[str]`、`Callable`,行为分别是:
|
||||
|
||||
- `str`:以 `*args`、`**kwargs` 为参数,使用 `str.format()` 进行格式化
|
||||
- `Sequence[str]`:随机选择其中之一,进行上面 `str` 的操作
|
||||
- `Callable`:以 `*args`、`**kwargs` 为参数,调用该可调用对象/函数,对返回的字符串进行上面 `str` 的操作
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `expr: Expression_T`: 要渲染的 Expression,当 Expression 为非字符串的 Squence 类型时则会随机选择其中一项
|
||||
- `expr: Expression_T`: 要渲染的 Expression
|
||||
- `escape_args: bool`: 是否对渲染参数进行转义
|
||||
- `*args: Any`: 渲染参数,用于 `str.format()` 或 Expression 函数调用时传入位置参数
|
||||
- `**kwargs: Any`: 渲染参数,用于 `str.format()` 或 Expression 函数调用时传入命名参数
|
||||
|
Loading…
x
Reference in New Issue
Block a user