import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"register","description":"","frontmatter":{"title":"register"},"headers":[],"relativePath":"dev/api/plugin/register.md","filePath":"zh/dev/api/plugin/register.md","lastUpdated":1734175019000}'),l={name:"dev/api/plugin/register.md"};function e(h,s,p,k,r,o){return t(),a("div",null,s[0]||(s[0]=[n(`

模块 nonebot_plugin_marshoai.plugin.register

此模块用于获取function call中函数定义信息以及注册函数


func async_wrapper(func: SYNC_FUNCTION_CALL_FUNC) -> ASYNC_FUNCTION_CALL_FUNC

说明: 将同步函数包装为异步函数,但是不会真正异步执行,仅用于统一调用及函数签名

参数:

返回: ASYNC_FUNCTION_CALL: 异步函数

源代码在GitHub上查看
python
def async_wrapper(func: SYNC_FUNCTION_CALL_FUNC) -> ASYNC_FUNCTION_CALL_FUNC:

    async def wrapper(*args, **kwargs) -> str:
        return func(*args, **kwargs)
    return wrapper

func function_call(*funcs: FUNCTION_CALL_FUNC) -> None

参数:

返回: str: 函数定义信息

源代码在GitHub上查看
python
def function_call(*funcs: FUNCTION_CALL_FUNC) -> None:
    for func in funcs:
        function_call = get_function_info(func)

func get_function_info(func: FUNCTION_CALL_FUNC)

说明: 获取函数信息

参数:

返回: FunctionCall: 函数信息对象模型

源代码在GitHub上查看
python
def get_function_info(func: FUNCTION_CALL_FUNC):
    name = func.__name__
    description = func.__doc__
    logger.info(f'注册函数: {name} {description}')
`,22)]))}const u=i(l,[["render",e]]);export{g as __pageData,u as default};