Skip to content

Instantly share code, notes, and snippets.

@KorigamiK
Last active April 19, 2022 10:05
Show Gist options
  • Save KorigamiK/4e04c5c8463084f12abce0d81115ce23 to your computer and use it in GitHub Desktop.
Save KorigamiK/4e04c5c8463084f12abce0d81115ce23 to your computer and use it in GitHub Desktop.
telegram game
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
(async () => {
const restart = document.querySelector("#button_correct");
restart.click();
while (1) {
await sleep(500);
let expression =
document.querySelector("#task_x").textContent.toString() +
document.querySelector("#task_op").textContent.toString() +
document.querySelector("#task_y").textContent.toString();
expression = expression.trim().replace("–", "-").replace("×", "*");
const answer = document.querySelector("#task_res").textContent;
const expected = eval(expression);
answer == expected
? document.querySelector("#button_correct").click()
: document.querySelector("#button_wrong").click();
// break;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment