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

Function normalizeChatId

shift/shift.ts:472–491  ·  view source on GitHub ↗
(entityOrId: any)

Source from the content-addressed store, hash-verified

470 const rawId = extractIdString(entityOrId);
471 if (rawId.startsWith("-100")) return Number(rawId);
472 const chatId = Number(rawId);
473 if (chatId > 1000000000) {
474 return ensureChannelId(rawId);
475 }
476 return chatId;
477 }
478}
479
480function getTargetTypeEmoji(entity: any): string {
481 if (!entity) return "❓";
482 if (entity.className === "User") return entity.bot ? "🤖" : "👤";
483 if (entity.className === "Channel") return entity.broadcast ? "📢" : "👥";
484 if (entity.className === "Chat") return "👥";
485 return "❓";
486}
487
488function parseIndices(
489 indicesStr: string,
490 total: number
491): { indices: number[]; invalid: string[] } {
492 const indices: number[] = [];
493 const invalid: string[] = [];
494

Callers 1

ShiftPluginClass · 0.85

Calls 2

ensureChannelIdFunction · 0.85
extractIdStringFunction · 0.85

Tested by

no test coverage detected