ruff
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import os
|
||||
import importlib
|
||||
import os
|
||||
import pkgutil
|
||||
|
||||
|
||||
def load_all_plugins():
|
||||
"""扫描并加载当前包下所有的插件(支持文件和文件夹)"""
|
||||
package_name = __package__
|
||||
@@ -11,7 +12,7 @@ def load_all_plugins():
|
||||
|
||||
for loader, module_name, is_pkg in pkgutil.iter_modules(package_path):
|
||||
full_module_name = f"{package_name}.{module_name}"
|
||||
|
||||
|
||||
try:
|
||||
importlib.import_module(full_module_name)
|
||||
type_str = "包" if is_pkg else "文件"
|
||||
@@ -19,4 +20,5 @@ def load_all_plugins():
|
||||
except Exception as e:
|
||||
print(f" 加载插件 {module_name} 失败: {e}")
|
||||
|
||||
load_all_plugins()
|
||||
|
||||
load_all_plugins()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from core.command_manager import matcher
|
||||
#TODO 把该死的这些给抽象化
|
||||
|
||||
|
||||
# TODO 把该死的这些给抽象化
|
||||
@matcher.command("echo")
|
||||
async def handle_echo(bot, event, args):
|
||||
if not args:
|
||||
@@ -8,12 +10,10 @@ async def handle_echo(bot, event, args):
|
||||
reply_msg = " ".join(args)
|
||||
|
||||
if event.message_type == "group":
|
||||
await bot.call_api("send_group_msg", {
|
||||
"group_id": event.group_id,
|
||||
"message": reply_msg
|
||||
})
|
||||
await bot.call_api(
|
||||
"send_group_msg", {"group_id": event.group_id, "message": reply_msg}
|
||||
)
|
||||
else:
|
||||
await bot.call_api("send_private_msg", {
|
||||
"user_id": event.user_id,
|
||||
"message": reply_msg
|
||||
})
|
||||
await bot.call_api(
|
||||
"send_private_msg", {"user_id": event.user_id, "message": reply_msg}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user