Twitch stream event platform with OBS browser source overlay. Features: - Twitch OAuth login (streamer + mod access) - EventSub WebSocket for subs, gift subs, bits, channel points, follows, raids - Chat commands via tmi.js in the overlay - Gap audio — tone plays on new chat message after silence, volume/pitch scale with gap length - Self-hosted media library (upload sounds and videos) - Action configuration — map any event to sound, video, or alert - Per-action cooldowns, test button, enable/disable toggle - Multiple actions per event (all matching actions fire) - Activity log dashboard with EventSub connection status - Layout editor — iframe-based WYSIWYG with drag handles, live style preview - Custom CSS and custom JS injection into overlay - Custom DOM events (bashyoverlay:sub, bashyoverlay:raid, etc.) for custom JS hooks - deploy.sh — one-shot setup and launch script Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
457 B
Python
15 lines
457 B
Python
from datetime import datetime
|
|
|
|
_store: dict[int, tuple[datetime, int]] = {}
|
|
|
|
|
|
def is_on_cooldown(action_id: int) -> bool:
|
|
if action_id not in _store:
|
|
return False
|
|
triggered_at, duration = _store[action_id]
|
|
return (datetime.utcnow() - triggered_at).total_seconds() < duration
|
|
|
|
|
|
def set_cooldown(action_id: int, duration_seconds: int) -> None:
|
|
if duration_seconds > 0:
|
|
_store[action_id] = (datetime.utcnow(), duration_seconds)
|