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

Function da

da/da.ts:286–588  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

284 const lines = msg.text?.trim()?.split(/\r?\n/g) || [];
285 const parts = lines?.[0]?.split(/\s+/) || [];
286 const [, ...args] = parts; // 跳过命令本身
287 const sub = (args[0] || "").toLowerCase();
288
289 const client = await getGlobalClient();
290 if (!client) {
291 await msg.edit({ text: "❌ 客户端错误", parseMode: "html" });
292 return;
293 }
294
295 if (!msg.chatId || msg.isPrivate) {
296 await msg.edit({ text: "❌ 仅群组可用", parseMode: "html" });
297 return;
298 }
299
300 const taskId = msg.chatId.toString();
301
302 try {
303 // 无参数时显示帮助
304 if (!sub) {
305 await msg.edit({ text: help_text, parseMode: "html" });
306 return;
307 }
308
309 // 处理 help 命令
310 if (sub === "help" || sub === "h") {
311 await msg.edit({ text: help_text, parseMode: "html" });
312 return;
313 }
314
315 // 处理停止命令
316 if (sub === "stop") {
317 const task = await getTask(taskId);
318
319 if (!task) {
320 await msg.delete();
321 return;
322 }
323
324 task.isRunning = false;
325 task.isPaused = true;
326 await saveTask(task);
327
328 const msgId = await sendProgressToSaved(client, task, "已手动停止");
329 if (msgId && !task.savedMessageId) {
330 task.savedMessageId = msgId;
331 await saveTask(task);
332 }
333
334 await msg.delete();
335 return;
336 }
337
338 // 处理状态查询
339 if (sub === "status") {
340 const task = await getTask(taskId);
341
342 if (!task) {
343 await msg.delete();

Callers

nothing calls this directly

Calls 9

getTaskFunction · 0.85
saveTaskFunction · 0.85
sendProgressToSavedFunction · 0.85
fastDeleteBatchFunction · 0.85
removeTaskFunction · 0.85
errorMethod · 0.80
editMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected