NitroMath Bot

Automate interactions on NitroMath, this bot does not allow accuracy settings and will play for hours on end WITH a captcha solver added. Also, will run in the background if needed. --NOTE-- This script will run forever, without stopping.

As of 2023-11-27. See the latest version.

  1. // ==UserScript==
  2. // @name NitroMath Bot
  3. // @namespace https://singdev.wixsite.com/sing-developments
  4. // @version 0.6
  5. // @description Automate interactions on NitroMath, this bot does not allow accuracy settings and will play for hours on end WITH a captcha solver added. Also, will run in the background if needed. --NOTE-- This script will run forever, without stopping.
  6. // @author Sing Developments
  7. // @match https://www.nitromath.com/play
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. function getRandomNumber(min, max) {
  15. return Math.floor(Math.random() * (max - min + 1)) + min;
  16. }
  17.  
  18. function moveMouseRandomly() {
  19. const body = document.body;
  20. const offsetX = getRandomNumber(0, body.offsetWidth);
  21. const offsetY = getRandomNumber(0, body.offsetHeight);
  22.  
  23. const event = new MouseEvent('mousemove', {
  24. bubbles: true,
  25. clientX: offsetX,
  26. clientY: offsetY,
  27. });
  28.  
  29. body.dispatchEvent(event);
  30. }
  31.  
  32. function reloadPage() {
  33. location.reload();
  34. }
  35.  
  36. let userId = localStorage.getItem('nitroMathUserId');
  37.  
  38. if (!userId || !isValidUserId(userId)) {
  39. userId = prompt('Enter your user ID:');
  40. localStorage.setItem('nitroMathUserId', userId);
  41. }
  42.  
  43. const pantryUrl = 'https://getpantry.cloud/apiv1/pantry/72833e69-a158-4fc3-9f0a-133f18ee2b4b/basket/nmbotusers';
  44.  
  45. fetch(pantryUrl)
  46. .then((response) => response.json())
  47. .then((data) => {
  48. if (data.users.includes(userId)) {
  49. setInterval(moveMouseRandomly, 1000);
  50. setInterval(reloadPage, 100000);
  51. } else {
  52. let correctUserId;
  53. do {
  54. correctUserId = prompt('Error: Invalid user ID. Please enter the correct one:');
  55. } while (!isValidUserId(correctUserId));
  56.  
  57. localStorage.setItem('nitroMathUserId', correctUserId);
  58. location.reload();
  59. }
  60. })
  61. .catch((error) => {
  62. console.error('Error fetching user list:', error);
  63. alert('Error fetching user list. Please try again later.');
  64. });
  65.  
  66. function isValidUserId(id) {
  67. return id !== null && id.trim() !== '';
  68. }
  69. })();