( message: any, myId: bigint, sendAsTypedKeySet: Set<string>, sendAsRawIdSet: Set<string> )
| 309 | ): boolean { |
| 310 | if (message.senderId?.toString?.() === myId.toString()) { |
| 311 | return true; |
| 312 | } |
| 313 | if (message.out === true) { |
| 314 | return true; |
| 315 | } |
| 316 | const identityCandidates = [message.fromId, message.senderId]; |
| 317 | for (const candidate of identityCandidates) { |
| 318 | const typedKey = peerToTypedKey(candidate); |
| 319 | if (typedKey && sendAsTypedKeySet.has(typedKey)) { |
| 320 | return true; |
| 321 | } |
| 322 | |
| 323 | const rawId = getPeerRawId(candidate); |
| 324 | if (rawId) { |
| 325 | if ( |
| 326 | sendAsRawIdSet.has(rawId) || |
| 327 | sendAsRawIdSet.has(normalizeIdToken(rawId)) |
| 328 | ) { |
| 329 | return true; |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | return false; |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * 增强的消息搜索函数 - 带容错机制 |
| 338 | */ |
| 339 | async function searchMyMessagesOptimized( |
| 340 | client: TelegramClient, |
| 341 | chatEntity: any, |
| 342 | myId: bigint, |
| 343 | userRequestedCount: number |
| 344 | ): Promise<Api.Message[]> { |
no test coverage detected