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

Function matchesManualSelector

biko/biko.ts:341–372  ·  view source on GitHub ↗
(
  message: any,
  selector: Extract<ResolvedSourceUser, { manualMode: true }>,
)

Source from the content-addressed store, hash-verified

339 return normalizeId(message?.senderId) === selector.manualUserId;
340 }
341
342 const expectedUsername = selector.manualUsername;
343 if (!expectedUsername) return false;
344
345 const directUsername = normalizeUsername(
346 String(message?.sender?.username || ""),
347 );
348 if (directUsername && directUsername === expectedUsername) {
349 return true;
350 }
351
352 if (typeof message?.getSender === "function") {
353 try {
354 const sender = await message.getSender();
355 const senderUsername = normalizeUsername(
356 String((sender as any)?.username || ""),
357 );
358 return Boolean(senderUsername) && senderUsername === expectedUsername;
359 } catch {
360 return false;
361 }
362 }
363
364 return false;
365}
366
367async function collectMessagesOnce(
368 client: any,
369 sourceChat: ResolvedChat,
370 sourceUser: ResolvedSourceUser,
371 requestedCount: number,
372 manualScanLimit?: number,
373): Promise<DigestRecord[]> {
374 const records: DigestRecord[] = [];
375 const iterParams: Record<string, any> = {

Callers 1

collectMessagesOnceFunction · 0.85

Calls 2

normalizeUsernameFunction · 0.85
normalizeIdFunction · 0.70

Tested by

no test coverage detected