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

Method execute

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

Source from the content-addressed store, hash-verified

4112
4113 async execute(
4114 msg: Api.Message,
4115 args: string[],
4116 _prefixes: string[],
4117 ): Promise<void> {
4118 const configManager = await this.getConfigManager();
4119 const config = configManager.getConfig();
4120
4121 if (args.length < 2) {
4122 await this.editMessage(
4123 msg,
4124 `💭 <b>当前提示词:</b>\n\n📝 内容: <code>${config.prompt || "未设置"}</code>`,
4125 );
4126 return;
4127 }
4128
4129 const action = args[1].toLowerCase();
4130 if (action === "set") {
4131 requireUser(args.length >= 3, "参数格式错误");
4132 await configManager.updateConfig((cfg) => {
4133 cfg.prompt = args.slice(2).join(" ");
4134 });
4135 await this.editMessage(
4136 msg,
4137 `✅ 提示词已设置:\n\n<code>${args.slice(2).join(" ")}</code>`,
4138 );
4139 return;
4140 }
4141
4142 if (action === "del") {
4143 await configManager.updateConfig((cfg) => {
4144 cfg.prompt = "";
4145 });
4146 await this.editMessage(msg, "✅ 提示词已删除");
4147 return;
4148 }
4149
4150 throw new UserError("参数格式错误");
4151 }
4152}
4153
4154class CollapseFeature extends BaseFeatureHandler {
4155 readonly name = "折叠设置";

Callers

nothing calls this directly

Calls 5

getConfigManagerMethod · 0.80
editMessageMethod · 0.80
requireUserFunction · 0.70
getConfigMethod · 0.45
updateConfigMethod · 0.45

Tested by

no test coverage detected