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

Function refreshActiveCaptchas

pmcaptcha/pmcaptcha.ts:789–808  ·  view source on GitHub ↗

* 刷新所有正在进行中的验证消息(在超时/次数/失败操作变更后调用)。 * 图片模式更新 caption,文字模式更新消息正文。

(client: TelegramClient)

Source from the content-addressed store, hash-verified

787 const kw = state.question;
788 return custom
789 ? htmlEscape(custom).replace("{keyword}", htmlEscape(kw))
790 : `🔒 <b>人机验证</b>\n\n请回复以下关键词以证明你不是机器人:\n\n${codeTag(kw)}${footer}`;
791 }
792 }
793 default:
794 return "";
795 }
796}
797
798/** 重建图片验证码的 caption 文本 */
799function rebuildImgCaption(state: CaptchaState): string {
800 const timeout = cfg.timeout();
801 const maxTries = cfg.maxTries();
802 const actions = cfg.failActions();
803 const actionDesc = actions.length
804 ? actions.map(a => FAIL_ACTION_LABEL[a] ?? a).join("、")
805 : "仅归档并静音";
806 const digitOnly = state.mode === CaptchaMode.IMG_DIGIT;
807 const desc = digitOnly ? "5 位数字验证码" : "5 位验证码(字母与数字均为大写)";
808
809 const lines: string[] = [`🔒 人机验证\n\n请输入图片中的${desc}`];
810 if (timeout > 0) lines.push(`⏱ 验证时间:${htmlEscape(timeout)} 秒`);
811 if (maxTries > 0) lines.push(`🔢 剩余次数:${htmlEscape(maxTries)} 次`);

Callers 1

pmcaptchaFunction · 0.85

Calls 4

rebuildImgCaptionFunction · 0.85
rebuildCaptchaTextFunction · 0.85
logFunction · 0.85
editMessageMethod · 0.80

Tested by

no test coverage detected