app/liteyuki/dev/plugin.py
Nanaloveyuki 908812a3d9
Some checks failed
Docker Image Build / build (push) Failing after 2m10s
Deploy VitePress site to Liteyuki PaaS / build (push) Failing after 2m30s
Pre-commit checks / pre-commit (3.10) (push) Failing after 3m7s
Pre-commit checks / pre-commit (3.11) (push) Failing after 2m37s
Pre-commit checks / pre-commit (3.12) (push) Failing after 2m42s
Pre-commit checks / pre-commit (3.13) (push) Failing after 3m18s
📝 重置了deploy下的文档
新添加了adapter.md用来转移配置器相关内容; 修改了部分文件的版权归属日期;
2025-04-03 21:54:03 +08:00

29 lines
723 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
"""
Copyright (C) 2020-2025 LiteyukiStudio. All Rights Reserved
@Time : 2024/8/18 上午5:04
@Author : snowykami
@Email : snowykami@outlook.com
@File : plugin.py
@Software: PyCharm
"""
from pathlib import Path
from liteyuki.bot import LiteyukiBot
from liteyuki.config import load_config_in_default
def run_plugins(*module_path: str | Path):
"""
运行插件无需手动初始化bot
Args:
module_path: 插件路径,参考`liteyuki.load_plugin`的函数签名
"""
cfg = load_config_in_default()
plugins = cfg.get("liteyuki.plugins", [])
plugins.extend(module_path)
cfg["liteyuki.plugins"] = plugins
bot = LiteyukiBot(**cfg)
bot.run()