diff --git a/src/cli/nso/friends.ts b/src/cli/nso/friends.ts index a32ff66..4505c1a 100644 --- a/src/cli/nso/friends.ts +++ b/src/cli/nso/friends.ts @@ -1,5 +1,5 @@ import Table from '../../util/table.js'; -import { PresenceState } from '../../api/coral-types.js'; +import { PresencePlatform, PresenceState } from '../../api/coral-types.js'; import type { Arguments as ParentArguments } from './index.js'; import createDebug from '../../util/debug.js'; import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js'; @@ -83,9 +83,13 @@ export async function handler(argv: ArgumentsCamelCase) { friend.name, online ? 'name' in friend.presence.game ? - 'Playing ' + friend.presence.game.name + ';\nplayed for ' + + 'Playing ' + friend.presence.game.name + + ('platform' in friend.presence ? + friend.presence.platform === PresencePlatform.NX ? ' (Nintendo Switch)' : + friend.presence.platform === PresencePlatform.OUNCE ? ' (Nintendo Switch 2)' : '' : '') + + ';\nplayed for ' + hrduration(friend.presence.game.totalPlayTime) + ' since ' + - new Date(friend.presence.game.firstPlayedAt * 1000).toLocaleDateString('en-GB') : + new Date(friend.presence.game.firstPlayedAt * 1000).toISOString() : 'Online' : friend.presence.state === PresenceState.INACTIVE ? 'Console online' + (friend.presence.logoutAt ? diff --git a/src/discord/util.ts b/src/discord/util.ts index a818454..134b508 100644 --- a/src/discord/util.ts +++ b/src/discord/util.ts @@ -120,7 +120,8 @@ function getPlayTimeText(type: DiscordPresencePlayTime, game: PresenceGame) { if (type === DiscordPresencePlayTime.HIDDEN || game.totalPlayTime < 0) return null; - const since = game.firstPlayedAt ? new Date(game.firstPlayedAt * 1000).toLocaleDateString('en-GB') : 'now'; + const since = game.firstPlayedAt ? new Date(game.firstPlayedAt * 1000) + .toLocaleDateString('en-GB', {dateStyle: 'medium'}) : 'now'; switch (type) { case DiscordPresencePlayTime.APPROXIMATE_PLAY_TIME: @@ -160,8 +161,8 @@ function getFirstPlayedText(first_played_at: number) { } function getApproximatePlayTime(minutes: number) { - if (minutes < 300) { - // Less than 5 hours + if (minutes < 600) { + // Less than 10 hours return Math.floor(minutes / 60) * 60; } else { return Math.floor(minutes / 300) * 300;