37 行
1.2 KiB
Python
37 行
1.2 KiB
Python
"""AstrBot MoviePilot integration plugin."""
|
|
|
|
from astrbot.api import logger, star
|
|
from astrbot.api.event import AstrMessageEvent, filter
|
|
from astrbot.api.star import AstrBotConfig
|
|
|
|
from access_policy import AccessPolicy
|
|
|
|
|
|
@star.register(
|
|
"astrbot_plugin_moviepilot",
|
|
"AstrBot MoviePilot Contributors",
|
|
"在 AstrBot 中通过命令和 LLM 控制 MoviePilot。",
|
|
"0.1.0",
|
|
)
|
|
class MoviePilotPlugin(star.Star):
|
|
"""MoviePilot integration entrypoint."""
|
|
|
|
def __init__(self, context: star.Context, config: AstrBotConfig) -> None:
|
|
super().__init__(context)
|
|
self.config = config
|
|
self.access_policy = AccessPolicy(config)
|
|
logger.info("MoviePilot 插件已加载")
|
|
|
|
@filter.command("mp")
|
|
async def moviepilot_help(self, event: AstrMessageEvent) -> None:
|
|
"""显示 MoviePilot 插件命令入口。"""
|
|
if not self.access_policy.is_allowed(event):
|
|
return
|
|
yield event.plain_result(
|
|
"MoviePilot 插件已加载。当前开发中,后续将支持 /mp search、/mp resources、"
|
|
"/mp subscribe 和 /mp download。"
|
|
)
|
|
|
|
async def terminate(self) -> None:
|
|
"""释放插件资源。"""
|
|
logger.info("MoviePilot 插件已停止")
|