Deep Bot - Twitch Streamer Assistant
Deep Bot => Guides, Tutorials & Demo Videos => Topic started by: TheDefiant604 on August 23, 2016, 10:54:55 PM
-
This is a simple command that can be used as an alternative to displaying betting percentages on-screen via OBS.
NOTE: This command requires a DeepBot VIP subscription as @readfile@ is a VIP variable.
Betting Stats: @if@[@readfile@[obs\BettingStats.txt]||||No betting pool currently active.||@readfile@[obs\BettingStats.txt]]
To add this command via chat:
!addcmd !bet% Betting Stats: @if@[@readfile@[obs\BettingStats.txt]||||No betting pool currently active.||@readfile@[obs\BettingStats.txt]]
Replace !bet% with whatever command you want this to be under.
Now, whenever a user in your chat types the command, they will get the percentages of bets on each option, such as:
[07:36:24] @TheDefiant604: !bet%
[07:36:25] @^RRbot: Betting Stats: 1. A(100%), 2. B(%), 3. C(%)
If nobody started a betting pool, the command will return the following:
[07:39:58] @TheDefiant604: !bet%
[07:39:58] @^RRbot: Betting Stats: No betting pool currently active.
-
To add a built-in cooldown to the command...
@if@[>=||@calc@[-|@unixtime@|@readfile@[BettingStatsCmdCD.txt]]||15||@savefile@[BettingStatsCmdCD.txt,@unixtime@]Betting Stats: @if@[@readfile@[obs\BettingStats.txt]||||No betting pool currently active.||@readfile@[obs\BettingStats.txt]]||]
The cooldown as provided is 15 seconds. To change the length of the cooldown, edit the command — this can be done via chat, as the command text isn't very long — and change the 15 to whatever you want the cooldown to be.
When this command succeeds, it writes @unixtime@ to the cooldown file, then reads the BettingStats.txt file, as detailed in my original post. When this command fails, due to still being on cooldown, nothing is output.
NOTE: I am aware there is a cooldown option in the GUI that makes this built-in cooldown unnecessary. I am providing this built-in cooldown check for chat moderators, such as myself, who do not have access to the GUI.