Stats

<% if (live) { %>live · counting<% } %>

<%= overview.since ? `Counting since ${overview.since.slice(0, 10)}` : 'Nothing counted yet: stats start with the next stream.' %> · <%= hiddenCount %> hidden bot<%= hiddenCount === 1 ? '' : 's' %> left out ⓘ

<%= overview.viewers.toLocaleString() %>
viewers seen
<%= overview.messages.toLocaleString() %>
chat messages
<%= overview.watchHours.toLocaleString() %>
hours watched
<%= overview.streams %>
streams
<%= overview.checkins.toLocaleString() %>
check-ins
<% // one single-series bar chart (no legend: the title names it); x = last 30 days const chart = (title, key, unit) => { const W = 600, H = 150, L = 34, B = 18, T = 8, n = perDay.length, max = Math.max(1, ...perDay.map(d => d[key])); const nice = (() => { const p = Math.pow(10, Math.floor(Math.log10(max))); return [1, 2, 2.5, 5, 10].map(m => m * p).find(v => v >= max); })(); const slot = (W - L) / n, bw = Math.max(2, slot - 2), y = v => T + (H - T - B) * (1 - v / nice); let s = ``; for (const g of [0, nice / 2, nice]) s += `${g}`; perDay.forEach((d, i) => { const x = L + i * slot + 1, v = d[key], top = y(v), h = (H - B) - top; const label = `${d.day.slice(5)} · ${v} ${unit}`; s += ``; if (v > 0) s += ``; if (i % 7 === 0 && i < n - 4) s += `${d.day.slice(5)}`; if (i === n - 1) s += `${d.day.slice(5)}`; }); return `

${title}

${s}
`; }; %>
<%- chart('Chat messages per day', 'messages', 'messages') %> <%- chart('Watch hours per day', 'watchHours', 'h') %>

Leaderboards

<% const board = (title, rows, fmt, extra) => { let s = `

${title}

`; if (!rows.length) return s + '

nothing yet

'; s += ''; rows.forEach((r, i) => { s += ``; }); return s + '
${i + 1}${(r.name || r.login || '?').replace(/[<>&"]/g, '')}${extra ? `
${extra(r)}` : ''}
${fmt(r.n)}
'; }; const hm = m => m >= 60 ? `${Math.floor(m / 60)} h ${m % 60} m` : `${m} m`; %>
<%- board('Points', boards.points, n => n.toLocaleString(), r => r.level) %> <%- board('Watch time', boards.watch, hm) %> <%- board('Chat messages', boards.chat, n => n.toLocaleString()) %> <%- board('Bits', boards.bits, n => n.toLocaleString()) %> <%- board('Channel points spent', boards.channelPoints, n => n.toLocaleString()) %>

Top emotes

<% if (!emotes.length) { %>

nothing yet

<% } else { %>
<% for (const e of emotes) { const src = e.source === 'twitch' && e.id ? `https://static-cdn.jtvnw.net/emoticons/v2/${e.id}/default/dark/1.0` : e.source === '7tv' && e.id ? `https://cdn.7tv.app/emote/${e.id}/1x.webp` : null; %> <% if (src) { %><% } %><%= e.emote %> <%= e.uses.toLocaleString() %> <% } %>
<% } %>

Top commands

<% if (!commands.length) { %>

nothing yet

<% } else { %>
<% for (const c of commands) { %><%= c.command %> <%= c.uses.toLocaleString() %><% } %>
<% } %>