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

Function getLastOnlineDays

admin_board/admin_board.ts:207–225  ·  view source on GitHub ↗
(user: Api.User)

Source from the content-addressed store, hash-verified

205 const days = Math.floor(
206 (Date.now() - Number(user.status.wasOnline) * 1000) / DAY_MS,
207 );
208 return Math.max(0, days);
209 }
210 if (user.status instanceof Api.UserStatusLastWeek) return 7;
211 if (user.status instanceof Api.UserStatusLastMonth) return 30;
212 return null;
213}
214
215function getUserIdString(user: Api.User): string {
216 return String(user.id);
217}
218
219function getUserDisplayName(user: Api.User): string {
220 const parts = [user.firstName || "", user.lastName || ""]
221 .map((part) => part.trim())
222 .filter(Boolean);
223 if (parts.length > 0) return parts.join(" ");
224 if (user.username) return user.username;
225 return getUserIdString(user);
226}
227
228function buildTargetDisplay(target: TargetChat): string {

Callers 1

collectAdminStatFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected