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

Function rebuildImgCaption

pmcaptcha/pmcaptcha.ts:768–783  ·  view source on GitHub ↗

重建图片验证码的 caption 文本

(state: CaptchaState)

Source from the content-addressed store, hash-verified

766
767 function buildFooter(): string {
768 const lines: string[] = [];
769 if (timeout > 0) lines.push(`⏱ 验证时间:<b>${htmlEscape(timeout)}</b> 秒`);
770 if (maxTries > 0) lines.push(`🔢 剩余次数:<b>${htmlEscape(remaining > 0 ? remaining : maxTries)}</b> 次`);
771 lines.push(`⚠️ 验证失败将会:${htmlEscape(actionDesc)}`);
772 return lines.length ? "\n\n" + lines.join("\n") : "";
773 }
774
775 switch (state.mode) {
776 case CaptchaMode.MATH: {
777 const footer = buildFooter();
778 return custom
779 ? htmlEscape(custom).replace("{question}", htmlEscape(state.question))
780 : `🔒 <b>人机验证</b>\n\n请回复以下算式的答案:\n\n${codeTag(`${state.question} = ?`)}${footer}`;
781 }
782 case CaptchaMode.TEXT: {
783 const footer = buildFooter();
784 if (state.isQA) {
785 return `🔒 <b>人机验证</b>\n\n请回答以下问题:\n\n<b>${htmlEscape(state.question)}</b>${footer}`;
786 } else {

Callers 1

refreshActiveCaptchasFunction · 0.85

Calls 1

htmlEscapeFunction · 0.70

Tested by

no test coverage detected