Skip to content

Commit

Permalink
Sun Jun 9 01:31:57 AM CST 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
licproF committed Jun 8, 2024
1 parent 92b559f commit 6add62c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions TMBot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def loglevel(level):

plugConf = []

def read_plugins_info(path):
def impor_plugin(path):
plugins = []
if path.is_dir():
for file in path.glob('*.py'):
Expand Down Expand Up @@ -91,8 +91,8 @@ def load_plugins():
global plugConf
sys_plugins_path = Path(__file__).resolve().parent / 'utils/plugins'
data_plugins_path = Path(__file__).resolve().parent.parent / 'TMBdata/plugins'
sys_plugins = read_plugins_info(sys_plugins_path)
data_plugins = read_plugins_info(data_plugins_path)
sys_plugins = impor_plugin(sys_plugins_path)
data_plugins = impor_plugin(data_plugins_path)
plugConf = sys_plugins + data_plugins
logging.info("所有插件已加载完成~")

Expand Down
4 changes: 2 additions & 2 deletions TMBot/utils/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def start_client():
async def main():
async with client:
logging.info(f'登录成功!在任意对话框发送 {prefix}help 获取帮助~')
from utils.utils import setup_event_handlers
setup_event_handlers(client)
from utils.utils import event_handler
event_handler(client)
await client.run_until_disconnected()

client.loop.run_until_complete(main())
2 changes: 1 addition & 1 deletion TMBot/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def wrapped():
return wrapped
return decorator

def setup_event_handlers(client):
def event_handler(client):
config_path = Path(__file__).resolve().parent.parent.parent / 'TMBdata/config/config.json'
with config_path.open() as f:
config = json.load(f)
Expand Down

0 comments on commit 6add62c

Please sign in to comment.