Addon for my twitch-bot executed through the "Execute Script / Command" action to build a custom watch-streak feature
Find a file
Knut Ahlers f1d35ce7c0
Switch to properly tested database interface
and with that support all databases the bot does support

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-03-24 13:29:57 +01:00
pkg/database Switch to properly tested database interface 2024-03-24 13:29:57 +01:00
.gitignore Switch to properly tested database interface 2024-03-24 13:29:57 +01:00
go.mod Switch to properly tested database interface 2024-03-24 13:29:57 +01:00
go.sum Switch to properly tested database interface 2024-03-24 13:29:57 +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 Switch to properly tested database interface 2024-03-24 13:29:57 +01:00
Makefile Switch to properly tested database interface 2024-03-24 13:29:57 +01:00
message.tpl Initital version 2024-03-24 02:57:46 +01:00
README.md Switch to properly tested database interface 2024-03-24 13:29:57 +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 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:

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