(
sourceMsg: Api.Message,
replyMsg: Api.Message,
sourceChatId: string,
sourceMessageId: number,
progress: string = "",
options?: { groupDirName?: string; quietSuccess?: boolean }
)
| 893 | |
| 894 | // 确保startId <= endId |
| 895 | const actualStart = Math.min(startId, endId); |
| 896 | const actualEnd = Math.max(startId, endId); |
| 897 | const totalMessages = actualEnd - actualStart + 1; |
| 898 | |
| 899 | await this.safeEditMessage(replyMsg, `🔄 开始处理消息范围 ${actualStart}-${actualEnd} (共${totalMessages}条)...`, true); |
| 900 | |
| 901 | for (let msgId = actualStart; msgId <= actualEnd; msgId++) { |
| 902 | totalProcessed++; |
| 903 | const progress = `[${totalProcessed}/${totalMessages}] `; |
| 904 | |
| 905 | try { |
| 906 | await this.safeEditMessage(replyMsg, `${progress}🔍 获取消息 ${msgId}...`, true); |
| 907 | const sourceMsg = await this.getMessage(chatId, msgId); |
| 908 | |
| 909 | if (!sourceMsg) { |
| 910 | await this.safeEditMessage(replyMsg, `${progress}⏭️ 消息 ${msgId} 不存在,跳过`, true); |
| 911 | continue; |
| 912 | } |
| 913 | |
| 914 | await this.safeEditMessage(replyMsg, `${progress}🔄 处理消息 ${msgId}...`, true); |
| 915 | const result = await this.processMessage( |
| 916 | sourceMsg, |
| 917 | targetPeer, |
| 918 | replyMsg, |
| 919 | chatId, |
| 920 | msgId, |
| 921 | progress |
| 922 | ); |
| 923 | |
| 924 | if (result.success) { |
| 925 | successCount++; |
| 926 | if (result.forwardedMsg) { |
| 927 | lastForwardedMsg = result.forwardedMsg; |
| 928 | } |
| 929 | if (!startSource && result.source) { |
| 930 | startSource = result.source; |
| 931 | } |
| 932 | if (result.source) { |
| 933 | endSource = result.source; |
| 934 | } |
no test coverage detected