generated from Soulter/helloworld
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (26 loc) · 1.33 KB
/
main.py
File metadata and controls
34 lines (26 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from astrbot.api.event import filter, AstrMessageEvent, MessageEventResult
from astrbot.api.star import Context, Star, register
from astrbot.api import logger
from astrbot.core import AstrBotConfig
from .core.handler.modelmaster_handle import ModelMasterHandler
from astrbot.core.platform.sources.aiocqhttp.aiocqhttp_message_event import (
AiocqhttpMessageEvent,
)
@register("TML-Bot", "TML", "Just For TML", "...", "...")
class TMLBotPlugin(Star):
def __init__(self, context: Context, config: AstrBotConfig):
super().__init__(context)
logger.info(f"初始化TML-Bot插件,配置:{config}")
self.context = context
self.config = config
async def initialize(self):
self.modelMaster = ModelMasterHandler(self.context, self.config)
logger.info("√ ModelMasterHandler 初始化完成")
@filter.command("生成AI视频")
async def gen_ai_video(self, event: AiocqhttpMessageEvent, prompt: str | None = None):
await self.modelMaster.gen_ai_video(event, prompt)
@filter.command("测试")
async def test(self, event: AiocqhttpMessageEvent):
yield event.plain_result(f"Hello~ 这里是TML AI助手.") # 发送一条纯文本消息
async def terminate(self):
"""可选择实现异步的插件销毁方法,当插件被卸载/停用时会调用。"""