Last active
August 6, 2017 18:33
-
-
Save Arm1stice/4a8c64a5d1e3a069838a08bc1955e92a to your computer and use it in GitHub Desktop.
Bot for listening to keystrokes and placing bets on NadekoBot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
robot = require 'robotjs' # Our typing module | |
gkm = require 'gkm' # Listen for keystrokes | |
currentBet = 2 # Base bet | |
profit = 0 # Profit | |
rolls = 0 # Rolls | |
gkm.events.on 'key.released', (data) -> # Listen for released keystrokes | |
key = data[0] # The key that was pressed | |
if key is 'A' # Base bet | |
if rolls isnt 0 then profit += currentBet # Don't change profit if this is the first bet, otherwise increment it by the previous bet | |
currentBet = 2 # Set current bet to base bet | |
rolls++ # Increment rolls | |
robot.keyTap 'backspace' # Press backspace to get rid of character in discord chat | |
robot.typeString ".bf #{currentBet} h" # Type bet command | |
robot.keyTap 'enter' # Press enter | |
console.log "Rolls: #{rolls} / Profit: #{profit}" # Display rolls and profit | |
else if key is 'S' | |
profit -= currentBet # Remove previous bet from profit | |
rolls++ # Increment rolls | |
currentBet = if currentBet is 8 then 8 else currentBet * 2 # If the previous bet was 8, then don't increase it by more, otherwise double the previous bet | |
robot.keyTap 'backspace' # Press backspace to get rid of character in discord chat | |
robot.typeString ".bf #{currentBet} h" # Type bet command | |
robot.keyTap 'enter' # Press enter | |
console.log "Rolls: #{rolls} / Profit: #{profit}" # Display rolls and profit | |
else if key is 'D' | |
robot.keyTap 'backspace' # Press backspace to get rid of character in discord chat | |
robot.typeString ".$$$" # Type balance command | |
robot.keyTap 'enter' # Press enter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment