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

Method waitForNewMessage

checkin/checkin.ts:471–492  ·  view source on GitHub ↗
(
    client: any,
    peer: string,
    minDate: number,
    timeoutMs: number,
    filter?: (m: Api.Message) => boolean
  )

Source from the content-addressed store, hash-verified

469 if (!enabled.length) {
470 if (statusMsg) await this.edit(statusMsg, "❌ 没有启用的签到目标");
471 return;
472 }
473
474 const results: Array<{ target: SignTarget; result: SignResult }> = [];
475 for (let i = 0; i < enabled.length; i++) {
476 const t = enabled[i];
477 const r = await this.runSingleSign(t);
478 results.push({ target: t, result: r });
479 if (i < enabled.length - 1) await this.sleep(2000);
480 }
481
482 const ok = results.filter((x) => x.result.success).length;
483 const fail = results.length - ok;
484 const lines = results
485 .map((x, i) => `${x.result.success ? "✅" : "❌"} <b>${i + 1}. ${this.escape(x.target.name)}</b>\n ${this.escape(x.result.success ? x.result.message || "成功" : x.result.error || "失败")}`)
486 .join("\n");
487 const summary = `🤖 <b>CheckIn 签到汇总报告</b>\n时间: ${new Date().toLocaleString("zh-CN", { timeZone: SH_TZ })}\n来源: ${this.escape(source)}\n结果: ${ok} 成功 / ${fail} 失败\n\n${lines}`;
488
489 let sent = false;
490 if (conf.botToken && conf.pushChatId) {
491 try {
492 await this.sendViaBot(conf.botToken, conf.pushChatId, summary);
493 sent = true;
494 } catch (e) {
495 console.error("[CheckIn] Bot push failed:", e);

Callers 1

runSingleSignMethod · 0.95

Calls 2

sleepMethod · 0.95
errorMethod · 0.80

Tested by

no test coverage detected