Skip to content

Instantly share code, notes, and snippets.

@rosenpin
Last active July 20, 2017 19:41
Show Gist options
  • Save rosenpin/340a7b77c2ae8bf221c733f644840a07 to your computer and use it in GitHub Desktop.
Save rosenpin/340a7b77c2ae8bf221c733f644840a07 to your computer and use it in GitHub Desktop.
Math Battle Bot For Telegram
var index = 0
var reps = 77
function run(){
if(index < reps){
setTimeout(function(){
var operator = {"+" : "+", "–" : "-", "×" : "*", "/" : "/"}[document.getElementById("task_op").innerText]
var x = document.getElementById("task_x").innerText
var y = document.getElementById("task_y").innerText
var solution = document.getElementById("task_res").innerText
var w_button = document.getElementById("button_wrong")
var v_button = document.getElementById("button_correct")
if(eval(x + operator + y) == solution) v_button.click()
else w_button.click()
run()
},400)
}
index++
}
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment