Addon for my twitch-bot executed through the "Execute Script / Command" action to build a custom watch-streak feature
Find a file
2024-03-24 03:00:16 +01:00
.gitignore Initital version 2024-03-24 02:57:46 +01:00
go.mod Initital version 2024-03-24 02:57:46 +01:00
go.sum Initital version 2024-03-24 02:57:46 +01:00
History.md prepare release v0.1.0 2024-03-24 03:00:16 +01:00
LICENSE Initital version 2024-03-24 02:57:46 +01:00
main.go Initital version 2024-03-24 02:57:46 +01:00
message.tpl Initital version 2024-03-24 02:57:46 +01:00
query.go Initital version 2024-03-24 02:57:46 +01:00
README.md Initital version 2024-03-24 02:57:46 +01:00
schema.sql Initital version 2024-03-24 02:57:46 +01:00
struct.go Initital version 2024-03-24 02:57:46 +01:00

Luzifer / twitch-bot-streak

Addon for my twitch-bot executed through the 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 tables (see schema.sql) to store its data
  • 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 (30m) 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:

- 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" }}'