Subathon Countdown Timer in C#

Subathon Timer in C#

Description

Using this extension you can now run Subathons on your stream easily.

Import Code

subathonCountdownTimer.sb (15.7 KB)

Steps after import

1. In OBS:

Create a scene called [NS] SubathonTimer (NS is short for nested scene) with a text source called [TS] SubathonCounter (TS is short for text source). Add this nested scene into any other scenes you need.

2. Streamer Bot.

Actions > Subathon Timer Code > Double-click Execute Code (Subathon Timer) > Click the References tab > Click Find Refs and make sure System.dll is added to the list.

  • NOTE: In more recent versions of Streamer Bot, this step may be unnecessary.

Click the Compiling Log tab, click Compile to make sure the code compiles correctly, and then click Save and Compile

3. Depending on which Platform you’re streaming to, you will need to link events to certain actions.

For Twitch (under Platforms > Twitch > Events):

  • Cheers should point to Subathon Add Timer Cheers or as a Run Action within another action.
  • Subshould point to Subathon Add Timer Twitch Sub or as a Run Action within another action.
  • Re-Sub should point to Subathon Add Timer Twitch Sub or as a Run Action within another action.
  • Gift Subshould point to Subathon Add Timer Twitch Sub or as a Run Action within another action.
  • Gift Bomb should point to Subathon Add Timer Twitch Sub or as a Run Action within another action.

For YouTube (under Platforms > YouTube > Super Events):

  • Super Chat Event and Super Sticker Event should point to Subathon Add Timer YouTube Super or as a Run Action within another action.

Other integrations under the Integrations tab can point to their relevent Subathon Add Timer Action.

  • Note: Kofi can be found under the Integrations > Streamer.bot Website tab.

4. Configure action Subathon Configuration and Start !startsubathon

  • You can edit the initial length of the subathon in hours
  • You can edit the max limit lengh of the subathon in hours
  • You can edit the secondsLeftBackupDirectory variable to point the directory where you have three text files: subathonSecondsLeft.txt, subathonTotalTimeInSeconds.txt, and subathonElapsedSeconds.txt. These files keep a backup of your time remaining so you can use !subathonresume if either Streamer Bot crashes or you decide to pause your subathon with !subathonpause
  • Set your OBS connection that corresponds with the assignment in the Stream Apps tab. (Note that the first OBS connection is 0)
  • If you want to change the names of the scene and text source in OBS, make sure it matches here too.

221369613-71632a65-2620-4e50-9f8e-a3865427992c

5. You can configure how many minutes get added for each sub tier event.

  • Subathon Twitch Sub Tier 1 Config Minutes
  • Subathon Twitch Sub Tier 2 Config Minutes
  • Subathon Twitch Sub Tier 3 Config Minutes

For money related events:

  • Editing moneyDivide controls the minimum denomination you want to add time.
  • Editing secondsMultiplier controls how much time gets added to the countdown for each moneyDivide is given.
  • Example: if moneyDivide is 2.50 and secondsMultiplier is 60. If someone gives $5.00, then 2 minutes (120 seconds) gets added to the countdown. $6 will also add 2 minutes. $7.50 would add 3 minutes.
  • NOTE: For calculating time: it is rounded down to the nearest moneyDivide.

208853043-523afa61-d08e-4468-a168-81fc07202243

6. Subathon Chat Commands

  • NOTE: Imported commands are disabled by default as a security measure. Please make sure to enable them.
  • !subathonstart to start the subathon timer. You need to enter it twice to confirm overwriting an existing subathon
  • !subathoncancel to cancel the timer. This also erases the contents of subathonSecondsLeft.txt You need to enter it twice to confirm cancelling the timer
  • !subathonpause to pause the timer
  • !subathonresume to resume the timer. You can resume even if you’ve restarted Streamer Bot. This is done by reading the contents of subathonSecondsLeft.txt, subathonTotalTimeInSeconds.txt, and subathonElapsedSeconds.txt
  • !subathonadd # to add that # of minutes to the timer. This is a manual way of adding minutes to the countdown
  • !subathonelapsed to get a chat message showing how long the subathon has been going

7. Action Subathon Done Action will be triggered once the timer runs out.

1 Like