MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / VideoFeature

Class VideoFeature

ai/ai.ts:4807–4985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4805
4806class VideoFeature extends BaseFeatureHandler {
4807 readonly name = "视频生成";
4808 readonly command = "video";
4809 readonly description = "生成视频";
4810
4811 private aiService: AIService;
4812 private messageUtils: MessageUtils;
4813
4814 constructor(
4815 aiService: AIService,
4816 configManagerPromise: Promise<ConfigManager>,
4817 httpClient: HttpClient,
4818 ) {
4819 super(configManagerPromise);
4820 this.aiService = aiService;
4821 this.messageUtils = new MessageUtils(configManagerPromise, httpClient);
4822 }
4823
4824 async execute(
4825 msg: Api.Message,
4826 args: string[],
4827 _prefixes: string[],
4828 ): Promise<void> {
4829 const prefixes = getPrefixes();
4830 const configManager = await this.getConfigManager();
4831 const config = configManager.getConfig();
4832 const replyMsg = await safeGetReplyMessage(msg);
4833 const replyToId = replyMsg?.id;
4834
4835 const subCommand = args[1]?.toLowerCase();
4836 let imageMode: VideoImageMode = "auto";
4837 let promptStartIndex = 1;
4838 if (subCommand === "preview") {
4839 const state = args[2]?.toLowerCase();
4840 if (!state) {
4841 await this.editMessage(
4842 msg,
4843 `🎬 <b>视频预览状态:</b>\n\n📄 当前状态: ${config.videoPreview ? "开启" : "关闭"}`,
4844 );
4845 return;
4846 }
4847 requireUser(state === "on" || state === "off", "参数必须是 on 或 off");
4848 await configManager.updateConfig((cfg) => {
4849 cfg.videoPreview = state === "on";
4850 });
4851 await this.editMessage(
4852 msg,
4853 `✅ 视频预览已${state === "on" ? "开启" : "关闭"}`,
4854 );
4855 return;
4856 }
4857 if (subCommand === "audio") {
4858 const state = args[2]?.toLowerCase();
4859 if (!state) {
4860 await this.editMessage(
4861 msg,
4862 `🔊 <b>视频音频状态:</b>\n\n📄 当前状态: ${config.videoAudio ? "开启" : "关闭"}`,
4863 );
4864 return;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected