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

Class TimeoutFeature

ai/ai.ts:4323–4360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4321
4322class TimeoutFeature extends BaseFeatureHandler {
4323 readonly name = "超时设置";
4324 readonly command = "timeout";
4325 readonly description = "设置请求超时";
4326
4327 constructor(configManagerPromise: Promise<ConfigManager>) {
4328 super(configManagerPromise);
4329 }
4330
4331 async execute(
4332 msg: Api.Message,
4333 args: string[],
4334 _prefixes: string[],
4335 ): Promise<void> {
4336 const configManager = await this.getConfigManager();
4337 const config = configManager.getConfig();
4338
4339 if (args.length < 2) {
4340 await this.editMessage(
4341 msg,
4342 `⏱️ <b>当前超时设置:</b>\n\n⏰ 超时时间: <code>${config.timeout} 秒</code>`,
4343 );
4344 return;
4345 }
4346
4347 const timeout = parseInt(args[1]);
4348 requireUser(
4349 !isNaN(timeout) && timeout >= 1 && timeout <= 600,
4350 "超时时间必须在 1 到 600 秒之间",
4351 );
4352
4353 await configManager.updateConfig((cfg) => {
4354 cfg.timeout = timeout;
4355 });
4356
4357 await this.editMessage(msg, `✅ 超时时间已设置为 ${timeout} 秒`);
4358 }
4359}
4360
4361class QuestionFeature extends BaseFeatureHandler {
4362 readonly name = "AI 提问";
4363 readonly command = "";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected