mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-06-13 07:38:00 +00:00
Update docs
This commit is contained in:
parent
9190b65b6d
commit
23d0a57a5f
@ -2309,7 +2309,7 @@ async def _(session):
|
|||||||
await send(bot, ctx, 'hello')
|
await send(bot, ctx, 'hello')
|
||||||
```
|
```
|
||||||
|
|
||||||
### `render_expression(expr, *, escape_args=True, **kwargs)`
|
### `render_expression(expr, *args, escape_args=True, **kwargs)`
|
||||||
|
|
||||||
- **说明:**
|
- **说明:**
|
||||||
|
|
||||||
@ -2319,7 +2319,8 @@ async def _(session):
|
|||||||
|
|
||||||
- `expr: Expression_T`: 要渲染的 Expression
|
- `expr: Expression_T`: 要渲染的 Expression
|
||||||
- `escape_args: bool`: 是否对渲染参数进行转义
|
- `escape_args: bool`: 是否对渲染参数进行转义
|
||||||
- `**kwargs: Any`: 渲染参数,用于 `str.format()` 或 Expression 函数调用传参
|
- `*args: Any`: 渲染参数,用于 `str.format()` 或 Expression 函数调用时传入位置参数
|
||||||
|
- `**kwargs: Any`: 渲染参数,用于 `str.format()` 或 Expression 函数调用时传入命名参数
|
||||||
|
|
||||||
- **返回:**
|
- **返回:**
|
||||||
|
|
||||||
@ -2328,10 +2329,11 @@ async def _(session):
|
|||||||
- **用法:**
|
- **用法:**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
msg = render_expression(
|
msg1 = render_expression(
|
||||||
['你好,{username}!', '欢迎,{username}~'],
|
['你好,{username}!', '欢迎,{username}~'],
|
||||||
username=username
|
username=username
|
||||||
)
|
)
|
||||||
|
msg2 = render_expression('你所查询的城市是{}', city)
|
||||||
```
|
```
|
||||||
|
|
||||||
## `nonebot.argparse` 模块
|
## `nonebot.argparse` 模块
|
||||||
|
@ -4,6 +4,11 @@ sidebar: auto
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## v1.2.2
|
||||||
|
|
||||||
|
- 修复 `nonebot.natual_language.IntentCommand` 类 `current_arg` 参数默认为 `None` 导致的 bug
|
||||||
|
- `nonebot.helpers.render_expression` 函数新增 `*args` 用于向 Expression 传递位置参数
|
||||||
|
|
||||||
## v1.2.1
|
## v1.2.1
|
||||||
|
|
||||||
- 修复 `nonebot.helpers.context_id` 的 `group` 模式无法正确产生私聊用户 ID 的 bug
|
- 修复 `nonebot.helpers.context_id` 的 `group` 模式无法正确产生私聊用户 ID 的 bug
|
||||||
|
Loading…
x
Reference in New Issue
Block a user