# Luzifer / twitch-bot-streak Addon for my [twitch-bot](https://github.com/Luzifer/twitch-bot) executed through the [Execute Script / Command](https://luzifer.github.io/twitch-bot/configuration/actors/#execute-script--command) action to build a custom watch-streak feature. ## Features - By default uses same database connection as the bot through the same environment variable - Needs two extra tables to store its data (does not interfere with the bot) - Reward is only counted once per stream (in case Twitch messes up stuff) - If a stream goes offline for a few minutes a grace period is taken which will not reset the stream streak ## Usage The program is used by three rules to register the `stream_online` and `stream_offline` events and to count user presence through a `channelpoint_redeem`: ```yaml - uuid: 67f0b5cf-f20d-4900-8e0d-63d20e550c2a description: 'Stream-Streak: Stream-Online' actions: - type: script attributes: command: - /data/bin/twitch-bot-streak - --action=stream_start - type: respond attributes: message: | /me Der Stream ist gestartet, vergesst nicht euren Stream-Streak zu verlängern! Einfach in den Kanalpunkten "Stream-Streak: Ich bin da!" einlösen… luzife4Kluk match_channels: - '#luziferus' match_event: stream_online # -- - uuid: 682707c1-5080-4eba-9100-e75bf89fe6e7 description: 'Stream-Streak: Stream-Offline' actions: - type: script attributes: command: - /data/bin/twitch-bot-streak - --action=stream_offline match_channels: - '#luziferus' match_event: stream_offline # -- - uuid: 34b9f1bc-cc3b-4003-8a0d-ed5d82e0b96e description: 'Stream-Streak: Count Presence' actions: - type: script attributes: command: - /data/bin/twitch-bot-streak - --action=count_stream - --twitch-id={{ .user_id }} - --twitch-username={{ .user }} match_channels: - '#luziferus' match_event: channelpoint_redeem disable_on_template: '{{ ne .reward_id "b98b9175-a50b-4fb0-9c12-85f07ba6d555" }}' ```