nonebot2/docs/api/utils.md

40 lines
479 B
Markdown
Raw Normal View History

2020-09-12 16:43:31 +00:00
---
contentSidebar: true
sidebarDepth: 0
---
# NoneBot.utils 模块
## `run_sync(func)`
* **说明**
一个用于包装 sync function 为 async function 的装饰器
* **参数**
* `func: Callable[..., Any]`: 被装饰的同步函数
* **返回**
2020-09-13 05:01:23 +00:00
* `Callable[..., Awaitable[Any]]`
2020-09-12 16:43:31 +00:00
## _class_ `DataclassEncoder`
基类:`json.encoder.JSONEncoder`
* **说明**
2020-09-13 05:01:23 +00:00
在JSON序列化 `Message` (List[Dataclass]) 时使用的 `JSONEncoder`