* 刷新所有正在进行中的验证消息(在超时/次数/失败操作变更后调用)。 * 图片模式更新 caption,文字模式更新消息正文。
(client: TelegramClient)
| 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 文本 */ |
| 799 | function 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)} 次`); |
no test coverage detected