Lumi/docs/platform-tenure.md
2026-07-27 09:42:58 +02:00

45 lines
2.7 KiB
Markdown

# Platform tenure
Lumi records platform membership and role periods as immutable UTC intervals. The same history powers custom-command placeholders, the **Platform tenure** cards on `/stats`, the **Platform tenure** section on `/leaderboards`, and the admin diagnostics page at `/admin/platform-tenure`.
## Supported statistics
| Platform | Statistics | Start timestamp |
| --- | --- | --- |
| Twitch | Follow, subscription, moderator, editor, VIP | Platform timestamp where Twitch supplies one; otherwise first reliable observation |
| YouTube | Paid channel membership and live-chat moderator | Membership event time where available; otherwise first reliable live-chat observation |
| Discord | Server membership and server boost | Discord `joinedTimestamp` and `premiumSinceTimestamp` where available |
YouTube does not expose a reliable timestamp for a viewer's ordinary public channel subscription through the existing live-chat integration. `youtube.user.subscriber_age` therefore represents paid channel membership (sponsor/member state), not a fabricated public-subscription age. YouTube roles are observed only when the live-chat API reports them.
Temporary API failures do not close intervals. Lumi closes missing states only after a complete successful platform snapshot or a reliable end event. Unlinking a platform identity does not delete interval history.
## Placeholders
The current uninterrupted interval and cumulative recorded history are exposed as `current` and `total`:
```text
{{twitch.user.follow_age.current}}
{{twitch.user.subscriber_age.total}}
{{twitch.user.mod_age.current}}
{{twitch.user.editor_age.total}}
{{twitch.user.vip_age.current}}
{{youtube.user.subscriber_age.current}}
{{youtube.user.mod_age.total}}
{{discord.user.member_age.current}}
{{discord.user.nitro_age.total}}
```
The current command context selects the platform user and channel or guild scope. Lumi never combines values across Twitch channels, YouTube channels, or Discord servers.
Append an embedded format to select duration units:
```text
{{twitch.user.follow_age.total}.{format.YY-MM-DD-HH-mm-ss}}
{{discord.user.member_age.current}.{format.DD-HH-mm}}
```
Units are case-sensitive: `Y`, `YY`, or `YYYY` means years; `M` or `MM` months; `D` or `DD` days; `H` or `HH` hours; `m` or `mm` minutes; and `s` or `ss` seconds. Repetition identifies the unit and does not add zero-padding. Units must be ordered largest to smallest and may appear once.
Lumi uses deterministic cumulative-duration units: one year is 365 days and one month is 30 days. Omitted time flows into the next smaller selected unit, so a format containing only `mm` returns total complete minutes. Time below the smallest selected unit is truncated. Zero units are omitted; an all-zero result is empty.