重建图片验证码的 caption 文本
(state: CaptchaState)
| 766 | const timeout = cfg.timeout(); |
| 767 | const maxTries = cfg.maxTries(); |
| 768 | const actions = cfg.failActions(); |
| 769 | const actionDesc = actions.length |
| 770 | ? actions.map(a => FAIL_ACTION_LABEL[a] ?? a).join("、") |
| 771 | : "仅归档并静音"; |
| 772 | const digitOnly = state.mode === CaptchaMode.IMG_DIGIT; |
| 773 | const desc = digitOnly ? "5 位数字验证码" : "5 位验证码(字母与数字均为大写)"; |
| 774 | |
| 775 | const lines: string[] = [`🔒 人机验证\n\n请输入图片中的${desc}`]; |
| 776 | if (timeout > 0) lines.push(`⏱ 验证时间:${htmlEscape(timeout)} 秒`); |
| 777 | if (maxTries > 0) lines.push(`🔢 剩余次数:${htmlEscape(maxTries)} 次`); |
| 778 | lines.push(`⚠️ 验证失败将会:${htmlEscape(actionDesc)}`); |
| 779 | return lines.join("\n"); |
| 780 | } |
| 781 | |
| 782 | /** |
| 783 | * 刷新所有正在进行中的验证消息(在超时/次数/失败操作变更后调用)。 |
| 784 | * 图片模式更新 caption,文字模式更新消息正文。 |
| 785 | */ |
| 786 | async function refreshActiveCaptchas(client: TelegramClient): Promise<void> { |
no test coverage detected