I looked over this script, doesn't appear to be anything malicious FYI. Thanks for posting, here is the breakdown of the script for those wondering:
The script defines several variables to configure the bot's behaviour. These variables include baseBet (the initial bet amount), baseMultiplier (the initial multiplier), variableBase (a flag to enable variable betting mode), streakSecurity (a threshold for loss streaks), and maximumBet (the maximum allowed bet).
The script calculates some initial values based on the provided variables, such as baseSatoshi (calculated from baseBet), currentBet (initially set to baseSatoshi), currentMultiplier, currentGameID, firstGame, lossStreak, and coolingDown.
The script logs some information about the bot and the starting balance.
If variableBase is enabled, the script outputs a warning message indicating that variable mode is experimental and describes the bot's resilience to loss streaks.
The script sets up event listeners using the engine.on() method for three events: game_starting, game_started, and cashed_out.
The game_starting event handler contains most of the bot's logic. Here's what happens in this event handler:
The bot logs that a new game is starting.
The current game's ID is recorded.
If the bot is in a cooling down state due to a loss streak, it checks if the loss streak is over. If so, it exits the cooling down state.
If the previous game was a loss (engine.lastGamePlay() is 'LOST') and it's not the first game, the bot handles loss streak and adjusts the betting strategy:
Increment the lossStreak counter.
Calculate the total losses and the last loss amount based on the current bet.
If the loss streak exceeds the streakSecurity, the bot enters a cooling down state and returns.
Otherwise, the current bet is multiplied by 5, and the multiplier is updated based on the total losses.
If the previous game was a win or the first game, the bot resets the loss streak to 2 and, if variableBase is enabled:
Calculates a new base bet using a variable mode formula based on the user's balance and the defined streakSecurity.
Adjusts the base bet and base satoshi if the new base bet is different from the current base bet.
The current bet and multiplier are set based on the current strategy.
If the current bet is within the user's balance:
If the current bet exceeds the maximum allowed bet, the bot lowers the bet size and logs a warning.
The bot places a bet using engine.placeBet() with the calculated bet amount and multiplier.
If the current bet is higher than the user's balance, the bot handles insufficient funds by either stopping the bot if the balance is too low or resetting the base bet if the balance is still sufficient.
The game_started event handler logs when a game has started, but this is only done for games beyond the first one.
The cashed_out event handler logs when the bot successfully cashes out, indicating the multiplier at which the cash out occurred.
The game_crash event handler logs when a game crashes, indicating the crash multiplier.