Addon for my twitch-bot executed through the "Execute Script / Command" action to build a custom watch-streak feature
Find a file
Knut Ahlers 6ef040b2f8
Update default template to spare information
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-04-19 20:16:56 +02:00
pkg/database Fix: Move database logging to stderr 2024-03-24 13:56:08 +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.3.3 2024-03-24 15:05:10 +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 Update default template to spare information 2024-04-19 20:16:56 +02: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" }}'