fix: 优化插件的结果处理

This commit is contained in:
Soulter
2024-05-25 18:46:38 +08:00
parent c653e492c4
commit 4d36ffcb08
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -64,6 +64,8 @@ class Command:
result = await plugin.plugin_instance.run(ame)
else:
result = await asyncio.to_thread(plugin.plugin_instance.run, ame)
if not result:
continue
if isinstance(result, CommandResult):
hit = result.hit
res = result._result_tuple()
+1 -1
View File
@@ -18,7 +18,7 @@ class CommandResult():
用于在Command中返回多个值
'''
def __init__(self, hit: bool, success: bool, message_chain: list, command_name: str = "unknown_command") -> None:
def __init__(self, hit: bool, success: bool = False, message_chain: list = [], command_name: str = "unknown_command") -> None:
self.hit = hit
self.success = success
self.message_chain = message_chain