mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 16:51:26 +00:00
完成适配器化改造,所有上报数据统一、接口调用等都改成通过不同消息源的适配器来完成,插件和消息源的耦合
This commit is contained in:
@ -1,15 +1,12 @@
|
||||
import os
|
||||
import importlib
|
||||
|
||||
from command import CommandRegistry
|
||||
from commands import core
|
||||
from nl_processor import parse_potential_commands
|
||||
from little_shit import get_nl_processors_dir, get_fallback_command_after_nl_processors
|
||||
from little_shit import load_plugins, get_fallback_command_after_nl_processors
|
||||
from command import hub as cmdhub
|
||||
|
||||
|
||||
def _init():
|
||||
_load_processors()
|
||||
load_plugins('nl_processors')
|
||||
|
||||
|
||||
__registry__ = cr = CommandRegistry(init_func=_init)
|
||||
@ -41,13 +38,3 @@ def process(args_text, ctx_msg):
|
||||
core.echo('暂时无法理解你的意思。\n'
|
||||
'由于自然语言识别还非常不完善,建议使用命令来精确控制我。\n'
|
||||
'如需帮助请发送「使用帮助」。', ctx_msg)
|
||||
|
||||
|
||||
def _load_processors():
|
||||
processor_mod_files = filter(
|
||||
lambda filename: filename.endswith('.py') and not filename.startswith('_'),
|
||||
os.listdir(get_nl_processors_dir())
|
||||
)
|
||||
command_mods = [os.path.splitext(file)[0] for file in processor_mod_files]
|
||||
for mod_name in command_mods:
|
||||
importlib.import_module('nl_processors.' + mod_name)
|
||||
|
Reference in New Issue
Block a user