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

Function extractIdString

shift/shift.ts:448–462  ·  view source on GitHub ↗
(id: any)

Source from the content-addressed store, hash-verified

446 return id.toString();
447 }
448 return String(id);
449}
450
451function ensureChannelId(id: any): number {
452 const idStr = extractIdString(id).trim();
453 if (!idStr) return Number.NaN;
454 if (idStr.startsWith("-100")) return Number(idStr);
455 const normalized = idStr.startsWith("-") ? idStr.slice(1) : idStr;
456 return Number(`-100${normalized}`);
457}
458
459function normalizeChatId(entityOrId: any): number {
460 if (typeof entityOrId === "object" && entityOrId.id) {
461 if (entityOrId.className === "Channel") {
462 return ensureChannelId(entityOrId.id);
463 }
464 const chatId = Number(extractIdString(entityOrId.id));
465 if (entityOrId.className === "Chat" && chatId > 0) {

Callers 2

ensureChannelIdFunction · 0.85
normalizeChatIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected