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

Function resolveEntityUsername

bs/bs.ts:197–211  ·  view source on GitHub ↗
(entity: any)

Source from the content-addressed store, hash-verified

195}
196
197function resolveEntityUsername(entity: any): string | undefined {
198 if (!entity) return undefined;
199 if (typeof entity.username === "string" && entity.username.trim()) {
200 return entity.username.trim();
201 }
202 if (Array.isArray(entity.usernames) && entity.usernames.length > 0) {
203 const username = entity.usernames.find(
204 (item: any) => item?.active
205 )?.username;
206 if (typeof username === "string" && username.trim()) {
207 return username.trim();
208 }
209 }
210 return undefined;
211}
212
213function cleanEntityId(value: any): string | undefined {
214 if (value === undefined || value === null) return undefined;

Callers 2

buildEntityLinkFunction · 0.85
buildMessageLinkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected