heystreamer/docs/PLANS.md
Bashy 1c36e80f66 Watch time: one 5-minute tick while live (lurkers included), per-stream check-ins
watchtime.js: stream.online/offline (+ Helix /streams check at start) give the live
state; every 5 min the chatter list (Helix /chat/chatters, new scope
moderator:read:chatters) gets +1 tick = 5 minutes = 5 points, overall and per day,
so watch time and points share one sync. First chat message per stream is stored as
a check-in. Without the scope the tick logs once and skips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:35:21 +02:00

82 lines
5.2 KiB
Markdown

# HeyStreamer plans
Ideas agreed on but not built yet. Newest first. (Started 2026-11-22.)
## 4. Point system (draft, 2026-11-22)
Loyalty points calculated from the per-viewer statistics (src/chatlog.js), so values can change later and
everyone's points recalculate. Name to be decided (e.g. "Streamer points").
| Action | Points | Notes |
|---|---|---|
| Chat message | 10 | max 1 per 5 min per viewer (counted at ingestion: chat_user.scored / chat_user_day.scored) |
| First message in a stream (check-in) | 25 | once per stream (stream_checkin, built with watch time) |
| First message ever on the channel | 50 | Twitch's first-time chatter flag, kept in chat_user.intro |
| Follow | 50 | once |
| Watch streak | 5 x streak | max 100 |
| Channel point redeem | 1 per 100 points spent | |
| Cheer / Power-up / Custom Power-up | 1 per bit | |
| Sub Tier 1 / Prime | 500 per month | resubs: their months |
| Sub Tier 2 / Tier 3 | 1000 / 2500 per month | |
| Gift sub | as a sub, per gifted sub | to the gifter |
| Tip | 100 per 1 EUR | |
| Incoming raid | 100 flat | no reward for raid size |
| Emotes, commands | 0 | stats only, no farming |
| Watch time | 5 per 5 min live (one tick updates watch time and points together; built: src/watchtime.js) | needs moderator:read:chatters (chatter list); import StreamElements' watch time once (SE key already in .env) so viewers keep their history when our bot takes over `!watchtime` |
Levels (cassette theme): Newcomer, Regular 500, Tape Collector 2000, Mixtape Maker 6000, Side B Legend 15000.
Balance: lurker 60/h, active chatter up to 180/h; Tier 1 sub (500) ~ 8 h watching.
Uses: `!points`, on-stream leaderboard, level next to names in the overlay chat, spending on free Power-up uses (1).
Rule: points earned from bits must never be exchanged for things with money value (Bits Acceptable Use Policy).
Activity log stays (her decision 2026-11-22: records of support, like Twitch keeps); forget-a-viewer removes theirs.
## 1. Free uses of Custom Power-ups ("refund")
**Why:** when a viewer paid for a Power-up but it did not show (overlay was off, OBS crashed, server down),
give them one free use to trigger it again.
**How it would work**
- Granting: on the **Redeems page**, a small "Give a free use" control (viewer name + Power-up + count) next to
the page's reload/save controls. Later maybe also a mod chat command (`!giveuse @viewer jumpscare`).
- Using: the viewer types the Power-up's command, made from its name (`Jump Scare` → `!jumpscare`, renameable).
With a free use left it plays like a bits Power-up (random variation, video + box), the box says
**free use** instead of the bits amount. Without one: nothing happens.
- Storage: table `power_up_credits (user_id, user_login, power_up_id, uses, granted_by, granted_at)`.
- Recent activity logs grants and uses (with Replay).
**Needs:** chat read on the server (see 3), credits table, Redeems UI, command handling.
Estimate: about half a day once chat is read server-side.
## 2. Own chat bot in HeyStreamer (instead of StreamElements' bot)
**Why:** one place for alerts, redeems, commands and replies; no third-party bot.
**Rough shape**
- Bot account: `bot_account` logs in to HeyStreamer once (Twitch scopes `user:read:chat`, `user:write:chat`;
the bot also needs to be a mod/VIP in the channel for reliable sending).
- Reads chat via EventSub `channel.chat.message`, sends via Helix `POST /chat/messages`.
- Commands page: custom text commands (`!discord`, `!socials`, …) with cooldowns and permission levels
(everyone / sub / VIP / mod), variables like `{user}`, `{uptime}`, `{count}`.
- Timers (repeating messages while live), shoutouts, free-use replies (see 1).
- Move StreamElements' commands over, then turn its bot off. StreamElements stays for tips until replaced.
## 3. Chat log for statistics
**Why:** advanced statistics later (activity over time, regulars, first-time chatters, emote use, peak moments).
**Rules (GDPR, Twitch developer rules)**
- Log on the server via EventSub `channel.chat.message` (works without OBS, no duplicates).
- Store only: message id, time, user id + login + display name, text, badges, emotes, first-message / reply flags.
- Honour moderation: `channel.chat.message_delete`, `channel.chat.clear_user_messages` (timeouts/bans) and
`channel.chat.clear` remove or blank the stored messages.
- Retention: raw messages 30 days (then deleted), aggregated statistics kept.
- "Delete this user's messages" control for removal requests; a line in the Twitch panels that chat is logged
for stream statistics.
- Size: a few MB per month in SQLite.
Status: **logging built 2026-11-22** (src/chatlog.js), with her choices: per-viewer counts (messages, per day,
emotes incl. 7TV, !commands, first/last seen) parsed as messages arrive; raw messages kept **30 days** only;
moderation removes stored text; hidden chatters (bots) are counted but must be left out of shown
statistics and leaderboards (filter at display time with chatlog.isHidden()). Viewer actions are counted too
(chat_action: rewards + points, Power-ups + bits, cheers, subs, gifts, follows, raids, watch streaks, tips). Still to do: a statistics page, and a
"forget this viewer" button for removal requests (`chatlog.forgetUser()` exists).