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

Function isMyMessageByIdentity

dme/dme.ts:311–341  ·  view source on GitHub ↗
(
  message: any,
  myId: bigint,
  sendAsTypedKeySet: Set<string>,
  sendAsRawIdSet: Set<string>
)

Source from the content-addressed store, hash-verified

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 */
339async function searchMyMessagesOptimized(
340 client: TelegramClient,
341 chatEntity: any,
342 myId: bigint,
343 userRequestedCount: number
344): Promise<Api.Message[]> {

Callers 1

Calls 3

peerToTypedKeyFunction · 0.85
getPeerRawIdFunction · 0.85
normalizeIdTokenFunction · 0.85

Tested by

no test coverage detected