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

Method execute

ai/ai.ts:4825–4984  ·  view source on GitHub ↗
(
    msg: Api.Message,
    args: string[],
    _prefixes: string[],
  )

Source from the content-addressed store, hash-verified

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;
4865 }
4866 requireUser(state === "on" || state === "off", "参数必须是 on 或 off");
4867 await configManager.updateConfig((cfg) => {
4868 cfg.videoAudio = state === "on";
4869 });
4870 await this.editMessage(
4871 msg,
4872 `✅ 视频音频已${state === "on" ? "开启" : "关闭"}`,
4873 );
4874 return;
4875 }
4876 if (subCommand === "duration") {
4877 const duration = parseInt(args[2]);
4878 if (!args[2]) {
4879 await this.editMessage(
4880 msg,
4881 `⏱️ <b>视频时长:</b>\n\n⏰ 当前时长: <code>${config.videoDuration} 秒</code>`,
4882 );

Callers

nothing calls this directly

Calls 13

getMessageImagePartsFunction · 0.85
sendProcessingFunction · 0.85
deleteMessageOrGroupFunction · 0.85
getConfigManagerMethod · 0.80
editMessageMethod · 0.80
createAbortTokenMethod · 0.80
generateVideoMethod · 0.80
sendVideosMethod · 0.80
releaseTokenMethod · 0.80
requireUserFunction · 0.70
getMessageTextFunction · 0.70
getConfigMethod · 0.45

Tested by

no test coverage detected