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

Function idToString

music_hub/music_hub.ts:210–224  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

208 if (value.channelId !== undefined) return `channel:${idToString(value.channelId)}`;
209 try {
210 return JSON.stringify(value, (_key, item) =>
211 typeof item === "bigint" ? item.toString() : item
212 );
213 } catch {
214 return String(value);
215 }
216}
217
218function getSessionKey(msg: Api.Message): string {
219 const peerKey = idToString((msg as any).chatId ?? msg.peerId) || "unknown-peer";
220 const userKey =
221 idToString((msg as any).senderId ?? (msg as any).fromId) || "unknown-user";
222 return `${peerKey}:${userKey}`;
223}
224
225function parseIndex(text?: string): number | null {
226 if (!text || !/^\d+$/.test(text)) return null;
227 const index = Number.parseInt(text, 10);

Callers 1

getSessionKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected