diff --git a/nonebot_plugin_marshoai/plugin/func_call/caller.py b/nonebot_plugin_marshoai/plugin/func_call/caller.py index e812835d..41b73505 100644 --- a/nonebot_plugin_marshoai/plugin/func_call/caller.py +++ b/nonebot_plugin_marshoai/plugin/func_call/caller.py @@ -82,7 +82,7 @@ class Caller: if module := inspect.getmodule(func): module_name = module.__name__.split(".")[-1] else: - module_name = "global" + module_name = "" self._name = f"{module_name}-{func.__name__}" _caller_data[self._name] = self @@ -140,6 +140,7 @@ class Caller: """ y, r = await self.pre_check() if not y: + logger.debug(f"Function {self._name} pre_check failed: {r}") return r if self.func is None: diff --git a/nonebot_plugin_marshoai/plugins/snowykami_testplugin/__init__.py b/nonebot_plugin_marshoai/plugins/snowykami_testplugin/__init__.py index 3b6bc565..b3083bbc 100644 --- a/nonebot_plugin_marshoai/plugins/snowykami_testplugin/__init__.py +++ b/nonebot_plugin_marshoai/plugins/snowykami_testplugin/__init__.py @@ -95,9 +95,11 @@ async def run_python_code(code: str, b: Bot, e: MessageEvent) -> str: return "运行成功: " + str(r) -@on_function_call(description="运行shell命令,需要超级用户权限").params( - command=String(description="shell命令内容") -).permission(SUPERUSER) +@on_function_call( + description="在设备上运行shell命令, Run command on this device" +).params(command=String(description="shell命令内容")).permission(SUPERUSER).name( + "run_shell_command" +) async def run_shell_command(command: str, b: Bot, e: MessageEvent) -> str: """运行shell命令""" try: