Skip to content

Commit

Permalink
🐛 修复injected导入问题(test good)
Browse files Browse the repository at this point in the history
  • Loading branch information
wling-art committed Feb 14, 2024
1 parent 27cc8b1 commit e0adba6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions tooldelta/plugin_load/injected_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
from distutils.core import setup_keywords
import os, sys
import os
import importlib
from re import A
import ujson as json
Expand Down Expand Up @@ -112,10 +112,10 @@ async def execute_player_left(playername):
async def load_plugin_file(file):
# 导入插件模块
module_name = file
plugin_module = importlib.import_module(f"插件文件.ToolDelta注入式插件.{module_name}")
plugin_module = {}
exec(open(os.path.join(os.getcwd(),f"插件文件/ToolDelta注入式插件/{module_name}/__init__.py"), "r", encoding="utf-8").read(), plugin_module)
# 获取插件元数据

return create_plugin_metadata(getattr(plugin_module, "__plugin_meta__", {"name": module_name}))
return create_plugin_metadata(plugin_module.get("__plugin_meta__",{"name": module_name}))

class PluginMetadata:
def __init__(
Expand Down Expand Up @@ -159,7 +159,6 @@ async def load_plugin(plugin_grp):

# 读取本目录下的文件夹名字
PLUGIN_PATH = os.path.join(os.getcwd(), "插件文件", "ToolDelta注入式插件")
sys.path.append("插件文件")
for file in os.listdir(PLUGIN_PATH):
if os.path.isdir(os.path.join(PLUGIN_PATH, file)):
plugin_grp.injected_plugin_loaded_num += 1
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.4
0.3.5

0 comments on commit e0adba6

Please sign in to comment.