mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-22 10:23:56 +00:00
18 lines
400 B
TypeScript
18 lines
400 B
TypeScript
import type { Game } from "@types";
|
|
import { HydraApi } from "../hydra-api";
|
|
|
|
export const trackGamePlaytime = async (
|
|
game: Game,
|
|
deltaInMillis: number,
|
|
lastTimePlayed: Date
|
|
) => {
|
|
if (game.shop === "custom") {
|
|
return;
|
|
}
|
|
|
|
return HydraApi.put(`/profile/games/${game.shop}/${game.objectId}`, {
|
|
playTimeDeltaInSeconds: Math.trunc(deltaInMillis / 1000),
|
|
lastTimePlayed,
|
|
});
|
|
};
|